228 lines
11 KiB
TypeScript
228 lines
11 KiB
TypeScript
"use client";
|
||
|
||
import React, { useState, useEffect } from "react";
|
||
import {
|
||
X,
|
||
Share2,
|
||
PlusSquare,
|
||
CheckCircle2,
|
||
Download,
|
||
Smartphone,
|
||
Laptop,
|
||
Sparkles,
|
||
Apple,
|
||
Chrome
|
||
} from "lucide-react";
|
||
|
||
interface InstallAppModalProps {
|
||
isOpen: boolean;
|
||
onClose: () => void;
|
||
isIOS: boolean;
|
||
onNativeInstall?: () => void;
|
||
canNativeInstall: boolean;
|
||
}
|
||
|
||
export const InstallAppModal: React.FC<InstallAppModalProps> = ({
|
||
isOpen,
|
||
onClose,
|
||
isIOS,
|
||
onNativeInstall,
|
||
canNativeInstall,
|
||
}) => {
|
||
const [activeTab, setActiveTab] = useState<"apple" | "desktop">("apple");
|
||
|
||
useEffect(() => {
|
||
if (isIOS) {
|
||
setActiveTab("apple");
|
||
} else {
|
||
setActiveTab("desktop");
|
||
}
|
||
}, [isIOS, isOpen]);
|
||
|
||
if (!isOpen) return null;
|
||
|
||
return (
|
||
<div
|
||
className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-md animate-in fade-in duration-200"
|
||
onClick={onClose}
|
||
>
|
||
<div
|
||
className="relative w-full max-w-md p-6 rounded-2xl bg-[#081224] border border-cyan-500/40 shadow-2xl shadow-cyan-950/60 text-gray-100 overflow-hidden"
|
||
onClick={(e) => e.stopPropagation()}
|
||
>
|
||
{/* Luminous Top Accent Glow */}
|
||
<div className="absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-cyan-500 via-amber-400 to-emerald-400" />
|
||
|
||
{/* Close Button */}
|
||
<button
|
||
onClick={onClose}
|
||
className="absolute top-4 right-4 p-1.5 rounded-lg bg-[#0c182e] hover:bg-[#14233d] text-gray-400 hover:text-white transition"
|
||
>
|
||
<X className="w-4 h-4" />
|
||
</button>
|
||
|
||
{/* Modal Header */}
|
||
<div className="flex items-center gap-3 mb-4">
|
||
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-cyan-500/20 to-amber-500/20 border border-cyan-500/40 flex items-center justify-center shadow-lg shadow-cyan-500/10">
|
||
{activeTab === "apple" ? (
|
||
<Apple className="w-6 h-6 text-amber-400" />
|
||
) : (
|
||
<Laptop className="w-6 h-6 text-cyan-400" />
|
||
)}
|
||
</div>
|
||
<div>
|
||
<div className="flex items-center gap-2">
|
||
<h3 className="text-base font-black tracking-wide text-white">
|
||
INSTALL AURATRADE
|
||
</h3>
|
||
<span className="text-[10px] font-bold px-1.5 py-0.5 rounded bg-cyan-950/80 border border-cyan-500/40 text-cyan-400">
|
||
PWA APP
|
||
</span>
|
||
</div>
|
||
<p className="text-xs text-gray-400 mt-0.5">
|
||
{activeTab === "apple"
|
||
? "Apple iPhone / iPad হোম স্ক্রিনে ইনস্টল করুন"
|
||
: "পিসি বা অ্যান্ড্রয়েডে ১-ক্লিক ইনস্টলেশন"}
|
||
</p>
|
||
</div>
|
||
</div>
|
||
|
||
{/* Device Switcher Tabs */}
|
||
<div className="flex items-center gap-1.5 p-1 rounded-xl bg-[#050b17] border border-[#14233d] mb-4">
|
||
<button
|
||
onClick={() => setActiveTab("apple")}
|
||
className={`flex-1 py-1.5 px-3 rounded-lg text-xs font-bold flex items-center justify-center gap-1.5 transition ${
|
||
activeTab === "apple"
|
||
? "bg-amber-500/20 text-amber-300 border border-amber-500/40 shadow-sm"
|
||
: "text-gray-400 hover:text-gray-200"
|
||
}`}
|
||
>
|
||
<Apple className="w-3.5 h-3.5" /> Apple iOS (iPhone/iPad)
|
||
</button>
|
||
<button
|
||
onClick={() => setActiveTab("desktop")}
|
||
className={`flex-1 py-1.5 px-3 rounded-lg text-xs font-bold flex items-center justify-center gap-1.5 transition ${
|
||
activeTab === "desktop"
|
||
? "bg-cyan-500/20 text-cyan-300 border border-cyan-500/40 shadow-sm"
|
||
: "text-gray-400 hover:text-gray-200"
|
||
}`}
|
||
>
|
||
<Laptop className="w-3.5 h-3.5" /> PC / Android (1-Click)
|
||
</button>
|
||
</div>
|
||
|
||
{/* Tab 1: Apple iOS Visual Guide */}
|
||
{activeTab === "apple" && (
|
||
<div className="space-y-3.5 my-3">
|
||
<div className="p-3 rounded-xl bg-[#0c182e] border border-[#182b4a] flex items-start gap-3">
|
||
<div className="w-7 h-7 rounded-lg bg-cyan-950/60 border border-cyan-500/30 flex items-center justify-center shrink-0 mt-0.5">
|
||
<span className="text-xs font-black text-cyan-400">১</span>
|
||
</div>
|
||
<div className="text-xs">
|
||
<p className="text-gray-200 font-semibold flex items-center gap-1.5">
|
||
Safari-র নিচে <Share2 className="w-3.5 h-3.5 text-cyan-400 inline" /> <strong>Share</strong> আইকনে ট্যাপ করুন
|
||
</p>
|
||
<p className="text-gray-400 text-[11px] mt-0.5">
|
||
আইফোন বা আইপ্যাডের সাফারি ব্রাউজারের নিচে শেয়ার বাটনে চাপ দিন।
|
||
</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div className="p-3 rounded-xl bg-[#0c182e] border border-[#182b4a] flex items-start gap-3">
|
||
<div className="w-7 h-7 rounded-lg bg-amber-950/60 border border-amber-500/30 flex items-center justify-center shrink-0 mt-0.5">
|
||
<span className="text-xs font-black text-amber-400">২</span>
|
||
</div>
|
||
<div className="text-xs">
|
||
<p className="text-gray-200 font-semibold flex items-center gap-1.5">
|
||
স্ক্রোল করে <PlusSquare className="w-3.5 h-3.5 text-amber-400 inline" /> <strong>Add to Home Screen</strong> চাপুন
|
||
</p>
|
||
<p className="text-gray-400 text-[11px] mt-0.5">
|
||
শেয়ার শিট মেনু থেকে এই অপশনটিতে ট্যাপ করুন।
|
||
</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div className="p-3 rounded-xl bg-[#0c182e] border border-[#182b4a] flex items-start gap-3">
|
||
<div className="w-7 h-7 rounded-lg bg-emerald-950/60 border border-emerald-500/30 flex items-center justify-center shrink-0 mt-0.5">
|
||
<span className="text-xs font-black text-emerald-400">৩</span>
|
||
</div>
|
||
<div className="text-xs">
|
||
<p className="text-gray-200 font-semibold flex items-center gap-1.5">
|
||
উপরে ডানপাশে <CheckCircle2 className="w-3.5 h-3.5 text-emerald-400 inline" /> <strong>Add</strong> বাটনে ট্যাপ করুন
|
||
</p>
|
||
<p className="text-gray-400 text-[11px] mt-0.5">
|
||
আপনার অ্যাপল হোম স্ক্রিনে নেটিভ AuraTrade অ্যাপ আইকন তৈরি হয়ে যাবে।
|
||
</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div className="p-2.5 rounded-lg bg-emerald-950/30 border border-emerald-500/30 text-[11px] text-emerald-300 flex items-center gap-2">
|
||
<Sparkles className="w-4 h-4 text-emerald-400 shrink-0" />
|
||
<span>ব্রাউজার অ্যাড্রেস বার ছাড়া ফুলস্ক্রিন নেটিভ ডার্ক মোডে চালু হবে।</span>
|
||
</div>
|
||
</div>
|
||
)}
|
||
|
||
{/* Tab 2: PC & Android 1-Click Install */}
|
||
{activeTab === "desktop" && (
|
||
<div className="space-y-4 my-3">
|
||
<div className="p-3.5 rounded-xl bg-gradient-to-br from-[#0c182e] to-[#081224] border border-cyan-500/30 text-xs">
|
||
<div className="flex items-center gap-2 text-cyan-300 font-bold mb-1">
|
||
<Sparkles className="w-4 h-4 text-cyan-400" />
|
||
<span>উইন্ডোজ পিসি, ম্যাক ও অ্যান্ড্রয়েড অ্যাপ</span>
|
||
</div>
|
||
<p className="text-gray-300 leading-relaxed text-[11px]">
|
||
ব্রাউজারের কোনো ট্যাব বা বার ছাড়াই আলাদা সফটওয়্যারের মতো ফুলস্ক্রিনে চলবে। এক্সনেস লাইভ টিক ও চার্ট ০% ল্যাগিংয়ে লোড হবে।
|
||
</p>
|
||
</div>
|
||
|
||
{canNativeInstall ? (
|
||
<button
|
||
onClick={() => {
|
||
if (onNativeInstall) onNativeInstall();
|
||
onClose();
|
||
}}
|
||
className="w-full py-3 px-4 rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 hover:from-cyan-400 hover:to-blue-500 active:scale-98 text-black font-black text-xs tracking-wider uppercase flex items-center justify-center gap-2 shadow-lg shadow-cyan-500/25 transition"
|
||
>
|
||
<Download className="w-4 h-4 text-black stroke-[2.5]" />
|
||
এখনই ইনস্টল করুন (1-Click Install)
|
||
</button>
|
||
) : (
|
||
<div className="space-y-2">
|
||
<button
|
||
onClick={() => {
|
||
if (onNativeInstall) onNativeInstall();
|
||
onClose();
|
||
}}
|
||
className="w-full py-2.5 px-4 rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 hover:from-cyan-400 hover:to-blue-500 active:scale-98 text-black font-black text-xs tracking-wider uppercase flex items-center justify-center gap-2 shadow-lg shadow-cyan-500/25 transition"
|
||
>
|
||
<Download className="w-4 h-4 text-black stroke-[2.5]" />
|
||
ইনস্টল প্রম্পট খুলুন (Launch Install)
|
||
</button>
|
||
<div className="p-2.5 rounded-lg bg-[#0c182e] border border-[#14233d] text-center text-[11px] text-gray-300">
|
||
<p className="text-gray-400">
|
||
অথবা ব্রাউজারের অ্যাড্রেস বারের ডানপাশে থাকা <Download className="w-3.5 h-3.5 inline mx-1 text-cyan-400" /> <strong>Install</strong> আইকনে চাপ দিন।
|
||
</p>
|
||
</div>
|
||
</div>
|
||
)}
|
||
</div>
|
||
)}
|
||
|
||
{/* Benefits Footer */}
|
||
<div className="pt-3 border-t border-[#14233d] flex items-center justify-between text-[11px] text-gray-400">
|
||
<span className="flex items-center gap-1 text-emerald-400">
|
||
<CheckCircle2 className="w-3.5 h-3.5" /> অফলাইন ও ব্যাকগ্রাউন্ড সিঙ্ক
|
||
</span>
|
||
<button
|
||
onClick={onClose}
|
||
className="text-gray-400 hover:text-white transition font-medium"
|
||
>
|
||
বন্ধ করুন (Close)
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
);
|
||
};
|