import { Download, MonitorSmartphone, Share, X } from "lucide-react"; import { useInstallPrompt } from "@/hooks/useInstallPrompt"; import { useTranslation } from "@/hooks/useTranslation"; /** * Post-login PWA install suggestion. * * Owner requirement: after any user signs in, offer installing the platform * as an app — faster access + notifications that actually arrive. Two flavors: * - native: fires the browser's real install dialog (Chrome/Edge/Samsung, * Android + desktop); * - iOS Safari: step-by-step "Share → Add to Home Screen" card (no native * event exists there). * * The show/hide policy lives in src/lib/pwa-install.ts (pure, unit-tested); * this component is presentation only. Placement stays clear of the ChatBot * FAB (bottom-right) and the mobile bottom nav. */ export default function InstallAppPrompt() { const { lang } = useTranslation(); const { visible, flavor, promptInstall, dismiss } = useInstallPrompt(); if (!visible) return null; const title = lang === "ar" ? "ثبّت المنصة على جهازك" : "Install the platform on your device"; const body = lang === "ar" ? "وصول أسرع بضغطة واحدة، وإشعارات الكورسات توصلك فوراً حتى وأنت خارج الموقع." : "One-tap faster access, and course notifications reach you instantly — even outside the site."; const installLabel = lang === "ar" ? "تثبيت الآن" : "Install now"; const laterLabel = lang === "ar" ? "ليس الآن" : "Not now"; const closeLabel = lang === "ar" ? "إغلاق" : "Close"; return (

{title}

{body}

{flavor === "ios" ? (
{lang === "ar" ? "من Safari: اضغط أيقونة المشاركة ثم «إضافة إلى الشاشة الرئيسية»." : "In Safari: tap the Share icon, then \"Add to Home Screen\"."}
) : (
)}
); }