// Features 5-8: AI, Doctors, Samples, Payroll — each ~13s
// F5: Ask Fajr AI
function Feature5_AI() {
const { localTime } = useSprite();
const question = 'شنو أداء فريق بغداد هاي الأسبوع؟';
const qChars = Math.floor(clamp((localTime - 1.5) / 2.0, 0, 1) * question.length);
const qShown = question.slice(0, qChars);
const thinking = localTime > 4.0 && localTime < 5.5;
const answerStart = 5.5;
const answer = [
{ text: 'فريق بغداد حقق 87% من التارغت هذا الأسبوع', appearAt: answerStart + 0.5 },
{ text: '📈 أعلى مندوب: سارة (92%)', appearAt: answerStart + 1.3 },
{ text: '📊 إجمالي الزيارات: 156 زيارة', appearAt: answerStart + 2.0 },
{ text: '💰 التحصيل: 12.4 مليون دينار', appearAt: answerStart + 2.7 },
];
const lastQ = React.useRef(0);
React.useEffect(() => {
if (qChars > lastQ.current) {
if (window.FajrAudio) window.FajrAudio.play('soft-tick', { freq: 1400 + Math.random() * 500, gain: 0.05 });
}
lastQ.current = qChars;
}, [qChars]);
return (
<>
✨
اسأل فجر
AI ASSISTANT · ONLINE
{/* User question */}
{qShown}{qChars < question.length && localTime > 1.5 ? '▊' : ''}
{/* Thinking dots */}
{thinking && (
)}
{/* AI Answer */}
{localTime > answerStart && (
{answer.map((a, i) => {
if (localTime < a.appearAt) return null;
const t = clamp((localTime - a.appearAt) / 0.3, 0, 1);
return (
{a.text}
);
})}
)}
>
);
}
// F6: Doctors DB
function Feature6_Doctors() {
const { localTime } = useSprite();
const pins = [
{ x: 25, y: 30, appearAt: 1.5, name: 'د. أحمد', field: 'باطنية', active: true },
{ x: 55, y: 45, appearAt: 1.8, name: 'ص. النور', field: 'صيدلية' },
{ x: 40, y: 60, appearAt: 2.1, name: 'د. سارة', field: 'جلدية' },
{ x: 70, y: 25, appearAt: 2.4, name: 'ص. الحياة', field: 'صيدلية' },
{ x: 20, y: 60, appearAt: 2.7, name: 'د. محمد', field: 'أطفال' },
{ x: 60, y: 70, appearAt: 3.0, name: 'ص. الشفاء', field: 'صيدلية' },
{ x: 80, y: 50, appearAt: 3.3, name: 'د. علي', field: 'قلبية' },
{ x: 35, y: 20, appearAt: 3.6, name: 'د. ليلى', field: 'عيون' },
];
return (
<>
{/* Map */}
DOCTORS & PHARMACIES · BAGHDAD
{pins.map((p, i) => {
if (localTime < p.appearAt) return null;
const t = clamp((localTime - p.appearAt) / 0.4, 0, 1);
return (
);
})}
{/* Counter */}
{pins.filter(p => localTime >= p.appearAt).length} / 247 LOCATIONS
{/* Detail card (after 4.5s) */}
{localTime > 4.5 && (() => {
const t = clamp((localTime - 4.5) / 0.6, 0, 1);
return (
د.أ
د. أحمد الجبوري
باطنية — مستشفى اليرموك
LOCATION
الكرادة — شارع الرواد
33.3152°N · 44.3661°E
{localTime > 6.5 && (
🗺️ ابدأ الملاحة
)}
);
})()}
>
);
}
// F7: Samples
function Feature7_Samples() {
const { localTime } = useSprite();
const startBalance = 50;
const events = [
{ doc: 'د. أحمد', qty: 10, at: 2.0 },
{ doc: 'د. سارة', qty: 8, at: 3.2 },
{ doc: 'د. محمد', qty: 12, at: 4.4 },
];
let balance = startBalance;
events.forEach(e => { if (localTime >= e.at) balance -= e.qty; });
return (
<>
{/* Balance card */}
SAMPLES BALANCE
{balance}
عيّنة متبقّية
السحب الشهري
{startBalance}
المصروف
{startBalance - balance}
{/* Distribution log */}
DISTRIBUTION LOG
{events.map((e, i) => {
if (localTime < e.at) return null;
const t = clamp((localTime - e.at) / 0.4, 0, 1);
return (
💊
{e.doc}
{['09:42', '11:18', '13:05'][i]}
−{e.qty}
);
})}
>
);
}
// F8: Payroll tied to performance
function Feature8_Payroll() {
const { localTime } = useSprite();
const rows = [
{ label: 'الراتب الأساسي', val: 600000, color: 'rgba(245,241,232,.85)', at: 1.8 },
{ label: 'مكافأة الزيارات', sub: '(92%)', val: 180000, color: FAJR.green, at: 3.0 },
{ label: 'مكافأة التارغت', sub: '(87%)', val: 220000, color: FAJR.green, at: 4.2 },
];
const totalAt = 6.0;
const totalT = clamp((localTime - totalAt) / 1.0, 0, 1);
const total = Math.round(1000000 * Easing.easeOutCubic(totalT));
return (
<>
أحمد حسين
PAYSLIP · APRIL 2026
AUTO-CALCULATED
{rows.map((r, i) => {
if (localTime < r.at) return null;
const t = clamp((localTime - r.at) / 0.5, 0, 1);
const val = Math.round(r.val * Easing.easeOutCubic(t));
return (
{r.label}
{r.sub && {r.sub}}
+{val.toLocaleString()}
);
})}
{/* Total */}
{localTime > totalAt && (
)}
>
);
}
// ══ ACT 4: Ecosystem + CTA ══
function Act4_Ecosystem() {
const { localTime } = useSprite();
const icons = [
{ label: 'GPS', icon: '📍' },
{ label: 'الموافقات', icon: '✓' },
{ label: 'التحصيل', icon: '💵' },
{ label: 'KPI', icon: '📊' },
{ label: 'اسأل فجر', icon: '✨' },
{ label: 'الأطباء', icon: '🏥' },
{ label: 'العينات', icon: '💊' },
{ label: 'الرواتب', icon: '💰' },
];
const logoT = clamp(localTime / 0.8, 0, 1);
const iconsAt = 0.5;
const titleT = clamp((localTime - 4.5) / 0.6, 0, 1);
const exitT = localTime > 7.0 ? (localTime - 7.0) / 1.0 : 0;
const exitFade = 1 - exitT;
return (
{/* Center logo */}

{ e.target.outerHTML = '
ف'; }} />
{/* 8 icons in circle */}
{icons.map((ic, i) => {
const angle = (i / 8) * Math.PI * 2 - Math.PI / 2 + (localTime * 0.15);
const r = 240;
const x = 300 + Math.cos(angle) * r;
const y = 300 + Math.sin(angle) * r;
const appearT = clamp((localTime - iconsAt - i * 0.12) / 0.5, 0, 1);
return (
{/* Line from center */}
);
})}
{/* Bottom title */}
نظام واحد — لكل عملياتك الميدانية
);
}
// CTA
function Act4_CTA() {
const { localTime } = useSprite();
const logoT = clamp(localTime / 0.7, 0, 1);
const titleT = clamp((localTime - 0.8) / 0.7, 0, 1);
const subT = clamp((localTime - 1.5) / 0.7, 0, 1);
const btnT = clamp((localTime - 2.3) / 0.6, 0, 1);
const pulse = 1 + Math.sin((localTime - 2.5) * 2.5) * 0.03;
const chimeFired = React.useRef(false);
React.useEffect(() => {
if (localTime > 2.3 && localTime < 2.4 && !chimeFired.current) {
chimeFired.current = true;
if (window.FajrAudio) window.FajrAudio.play('chime');
}
if (localTime < 2.2) chimeFired.current = false;
}, [localTime]);
return (
{/* Logo */}

{ e.target.outerHTML = '
ف'; }} />
{/* Brand name */}
فجر ون
شاهد النظام على بياناتك الحقيقية
{/* CTA Button */}
احجز عرضاً تجريبياً ←
);
}
Object.assign(window, {
Feature5_AI, Feature6_Doctors, Feature7_Samples, Feature8_Payroll,
Act4_Ecosystem, Act4_CTA,
});