المكوّنات · انضمام بدعوة فريق
انضمام بدعوة فريق
رمز الدعوة يحدّد الفريق والدور معًا
12 تصاميم من هذه العائلة
<div class="sg sgi">
<h5 data-ar="انضم إلى فريقك" data-en="Join your team">انضم إلى فريقك</h5>
<label><span data-ar="رمز الدعوة" data-en="Invite code">رمز الدعوة</span>
<input class="cd" type="text" placeholder="PT-XXXX-XXXX" dir="ltr">
<span class="err"></span></label>
<div class="res" hidden>
<div class="row"><span data-ar="الفريق" data-en="Team">الفريق</span><b class="tm"></b></div>
<div class="row"><span data-ar="الدور" data-en="Role">الدور</span><b class="rl"></b></div>
<p class="note" data-ar="الدور محدّد من الدعوة ولا يمكن تغييره" data-en="The role comes from the invite and cannot be changed">الدور محدّد من الدعوة ولا يمكن تغييره</p>
</div>
<button class="go" disabled data-ar="انضمام" data-en="Join">انضمام</button>
</div>
/* pt-scoped */
/* signup-invite — شركة تقنية */
.sgi{width:100%;height:100%;display:flex;flex-direction:column;
font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.sgi h5{margin:0;font-size:11px;color:var(--pt-text-primary);font-weight:600}
.sgi .sub{margin:0;font-size:8.5px;color:var(--pt-text-muted)}
.sgi label{display:flex;flex-direction:column;gap:3px}
.sgi label > span{font-size:8.5px;color:var(--pt-text-muted)}
.sgi input, .sgi select{width:100%;font:inherit;font-size:9.5px;
color:var(--pt-text-primary);outline:none}
.sgi input::placeholder{color:var(--pt-text-muted)}
.sgi .err{font-size:8px;color:var(--pt-color-danger-400);min-height:0}
.sgi .ok{color:var(--pt-accent)}
.sgi button{font:inherit;cursor:pointer}
.sgi button:focus-visible, .sgi input:focus-visible{outline:2px solid var(--pt-focus-ring);
outline-offset:1px}
/* شخصية: بطاقة دعوة — انحناء كبير، نتيجة تنكشف تحت الحقل */
.sgi{padding:11px;gap:7px;justify-content:center;
border:1px dashed var(--pt-border-strong);border-radius:var(--pt-radius-xl);
background:var(--pt-bg-inset)}
.sgi input{padding:7px 10px;border-radius:var(--pt-radius-lg);
border:1px solid var(--pt-border-default);background:var(--pt-surface);
font-family:var(--pt-font-mono);letter-spacing:.1em;text-transform:uppercase}
.sgi input[aria-invalid=true]{border-color:var(--pt-color-danger-400)}
.sgi .res{display:flex;flex-direction:column;gap:3px;padding:7px 9px;
border-radius:var(--pt-radius-lg);background:var(--pt-surface);
border:1px solid color-mix(in srgb,var(--pt-accent) 40%,transparent)}
.sgi .row{display:flex;align-items:baseline;justify-content:space-between;gap:8px;font-size:8.5px}
.sgi .row b{color:var(--pt-accent);font-size:9.5px}
.sgi .note{margin:2px 0 0;font-size:7.5px;color:var(--pt-text-muted)}
.sgi .go{padding:7px;border-radius:var(--pt-radius-lg);border:0;background:var(--pt-accent);
color:var(--pt-color-ink-900);font-size:9.5px;font-weight:600}
.sgi .go:disabled{opacity:.45;cursor:not-allowed}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.sgi');
if (!host) return;
var snapshot = host.innerHTML;
var timers = [];
var ac = null;
/* الجسم كما كتبه المولِّد. يستقبل بدائل مظلَّلة لـ root وdocument
والمؤقّتات، فينظّف نفسه دون أن يعرف أنه قابل لإعادة التركيب. */
function run(root, document, setTimeout, setInterval) {
/* الخطأ يظهر بعد مغادرة الحقل لا مع كل حرف: القراءة أثناء الكتابة
تُشعر المستخدم بالفشل قبل أن ينتهي من الإدخال. */
function bind(input, check, msg) {
var box = input.closest('label') || input.parentElement;
var err = box.querySelector('.err') || box.parentElement.querySelector('.err');
var touched = false;
function paint() {
var good = check(input.value);
input.setAttribute('aria-invalid', String(touched && !good));
if (err) err.textContent = touched && !good ? msg : '';
return good;
}
input.addEventListener('blur', function () { touched = true; paint(); });
input.addEventListener('input', function () { if (touched) paint(); });
return paint;
}
/* الدور يأتي من الدعوة ولا يختاره المنضمّ — وإلّا فالنموذج ثغرة صلاحيات */
var INVITES = {
'PT-4821-9K3M': { team: 'فريق المنتج', role: 'محرّر' },
'PT-7710-2QF8': { team: 'فريق الهندسة', role: 'مطوّر' },
'PT-3055-XB4T': { team: 'فريق التسويق', role: 'مشاهد' }
};
var cd = root.querySelector('.cd'), res = root.querySelector('.res');
var go = root.querySelector('.go');
var FMT = /^PT-[A-Z0-9]{4}-[A-Z0-9]{4}$/;
function clean(v) { return String(v).toUpperCase().replace(/\s/g, ''); }
function found(v) { return INVITES[clean(v)] || null; }
bind(cd, function (v) { return !!found(v); },
'رمز غير معروف — تحقّق من رسالة الدعوة');
function refresh() {
var inv = found(cd.value);
res.hidden = !inv;
go.disabled = !inv;
if (inv) {
root.querySelector('.tm').textContent = inv.team;
root.querySelector('.rl').textContent = inv.role;
}
}
cd.addEventListener('input', function () {
var v = clean(cd.value);
// تنسيق أثناء الكتابة: مجموعات من أربعة بفواصل — أسهل قراءة ونسخًا
v = v.replace(/^PT-?/, '').replace(/-/g, '');
cd.value = 'PT-' + (v.slice(0, 4) + (v.length > 4 ? '-' + v.slice(4, 8) : ''));
refresh();
});
cd.value = 'PT-4821-9K3M';
refresh();
}
function mount() {
ac = new AbortController();
var real = window.document;
/* وسيط يمرّر كل شيء إلى المستند الحقيقي، ويعلّق كل مستمع بإشارة
تُقطع عند إعادة التركيب — فلا يبقى مستمع من نسخة ماتت. */
var doc = new Proxy(real, {
get: function (t, k) {
if (k === 'addEventListener') {
return function (type, fn, opts) {
var o = (opts && typeof opts === 'object') ? Object.assign({}, opts)
: { capture: !!opts };
o.signal = ac.signal;
return t.addEventListener(type, fn, o);
};
}
var v = t[k];
return typeof v === 'function' ? v.bind(t) : v;
}
});
function track(fn) {
return function (f, ms) { var id = fn(f, ms); timers.push(id); return id; };
}
run(host, doc, track(window.setTimeout.bind(window)),
track(window.setInterval.bind(window)));
}
function unmount() {
if (ac) ac.abort();
// المعرّفان يتشاركان فضاءً واحدًا في المتصفّح، فالإلغاء المزدوج آمن
timers.forEach(function (id) { window.clearTimeout(id); window.clearInterval(id); });
timers = [];
host.innerHTML = snapshot;
}
mount();
addEventListener('pt-lang', function () { unmount(); mount(); });
})();
# Join by Team Invite
**Role:** You are an Arabic-first UI designer and front-end engineer. Read the whole
specification before writing a single line, then follow it literally. If two requirements
conflict, favour usability over visual effect.
**Goal:** Join by Team Invite — The invite code resolves both the team and the role
**Why this component matters:** Never let the joiner pick their own role. Resolve it from the invite code server-side and render it read-only, or the form is a privilege-escalation hole.
**Direction:** Genuine RTL — not a mirrored Latin layout. Use logical properties
(`margin-inline-start`, `padding-inline`, `inset-inline-start`, `text-align: start`),
never physical ones (`margin-left`, `left`). The layout must flip with `dir` on its own,
with no duplicated rules.
**Typography:** Cairo for Arabic, IBM Plex Sans for Latin. Arabic line-height must be
`0.18` higher than the Latin equivalent — dots, hamzas and maddas need more vertical room.
Arabic font-size runs `1.06×` the Latin size at the same optical weight.
**Numerals:** Western digits in both languages (`1,234.50`). Only the currency changes:
`ر.س` **after** the number in Arabic, `$` **before** it in English. Jordanian dinar
uses **three** decimal places, not two.
**Colors:** Dark mode — background `#0D142B` · surfaces `#211F54` · borders `#545C91` · text `#918FC2`.
Accent `#ADA9E8` must never exceed 8% of the screen area.
**Language:** Bilingual — every string carries both Arabic and English, and the layout
flips with `dir` automatically.
**States:** `default` · `hover` · `focus` · `active` · `disabled` · `loading` · `error`.
Do not design the resting state alone.
**Accessibility:** Contrast ratio at least `4.5:1`, complete keyboard navigation,
visible focus rings, and honour `prefers-reduced-motion`.
**Output:** Clean HTML and CSS in two separate files. No frameworks, no libraries,
no external dependencies.