feat: add dual-tab Apple iOS and PC/Android interactive install modal

This commit is contained in:
2026-10-23 00:31:09 +06:00
parent 5a79667bf7
commit 358fdaad3c
2 changed files with 95 additions and 48 deletions
+1 -13
View File
@@ -77,19 +77,7 @@ export const TitanHeader: React.FC<TitanHeaderProps> = ({
const handleInstallClick = () => {
soundFX.playClick();
if (isIOS) {
setShowInstallModal(true);
} else if (deferredPrompt) {
deferredPrompt.prompt();
deferredPrompt.userChoice.then((choiceResult: any) => {
if (choiceResult.outcome === "accepted") {
setIsInstalled(true);
}
setDeferredPrompt(null);
});
} else {
setShowInstallModal(true);
}
setShowInstallModal(true);
};
const handleNativeInstallTrigger = () => {
+94 -35
View File
@@ -1,6 +1,6 @@
"use client";
import React from "react";
import React, { useState, useEffect } from "react";
import {
X,
Share2,
@@ -10,7 +10,8 @@ import {
Smartphone,
Laptop,
Sparkles,
ArrowRight
Apple,
Chrome
} from "lucide-react";
interface InstallAppModalProps {
@@ -28,12 +29,25 @@ export const InstallAppModal: React.FC<InstallAppModalProps> = ({
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">
<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/30 shadow-2xl shadow-cyan-950/50 text-gray-100 overflow-hidden"
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 */}
@@ -48,9 +62,13 @@ export const InstallAppModal: React.FC<InstallAppModalProps> = ({
</button>
{/* Modal Header */}
<div className="flex items-center gap-3 mb-5">
<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">
<Smartphone className="w-6 h-6 text-cyan-400" />
{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">
@@ -62,69 +80,99 @@ export const InstallAppModal: React.FC<InstallAppModalProps> = ({
</span>
</div>
<p className="text-xs text-gray-400 mt-0.5">
{isIOS
{activeTab === "apple"
? "Apple iPhone / iPad হোম স্ক্রিনে ইনস্টল করুন"
: "পিসি বা মোবাইলে ১-ক্লিকে ইনস্টল করুন"}
: "পিসি বা অ্যান্ড্রয়েডে ১-ক্লিক ইনস্টলেশন"}
</p>
</div>
</div>
{/* Content Mode: iOS vs Desktop/Android */}
{isIOS ? (
/* Apple iOS Visual Instructions */
<div className="space-y-3.5 my-4">
{/* 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" /> <strong>Share</strong> বাটনে চাপ দিন
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-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 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" /> <strong>Add to Home Screen</strong> চাপুন
স্ক্রোল করে <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-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 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" /> <strong>Add</strong> বাটনে ট্যাপ করুন
উপরে ডানপাশে <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 অ্যাপ আইকন তৈরি হয়ে যাবে।
আপনার অ্যাপল হোম স্ক্রিনে নেটিভ 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>
) : (
/* Desktop / Android Direct Native 1-Click Trigger */
<div className="space-y-4 my-4">
<div className="p-4 rounded-xl bg-gradient-to-br from-[#0c182e] to-[#081224] border border-cyan-500/30 text-xs">
)}
{/* 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>
<span>উইন্ডোজ পিসি, ম্যাক ও অ্যান্ড্রয়েড অ্যাপ</span>
</div>
<p className="text-gray-300 leading-relaxed text-[11px]">
ব্রাউজারের কোনো অ্যাড্রেস বার বা ট্যাব ছাড়াই আলাদা সফটওয়্যারের মতো ফুলস্ক্রিনে চলবে। এক্সনেস লাইভ টিক ও চার্ট ০% ল্যাগিংয়ে লোড হবে।
ব্রাউজারের কোনো ট্যাব বা বার ছাড়াই আলাদা সফটওয়্যারের মতো ফুলস্ক্রিনে চলবে। এক্সনেস লাইভ টিক ও চার্ট ০% ল্যাগিংয়ে লোড হবে।
</p>
</div>
@@ -134,17 +182,28 @@ export const InstallAppModal: React.FC<InstallAppModalProps> = ({
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-sm tracking-wider uppercase flex items-center justify-center gap-2 shadow-lg shadow-cyan-500/25 transition"
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="p-3 rounded-xl bg-[#0c182e] border border-[#14233d] text-center text-xs text-gray-300">
<p className="font-semibold text-amber-400">ব্রাউজার মেনু থেকে ইনস্টল করুন:</p>
<p className="text-gray-400 text-[11px] mt-1">
ব্রাউজারের অ্যাড্রেস বারের ডানপাশে থাকা <Download className="w-3.5 h-3.5 inline mx-1 text-cyan-400" /> <strong>ইনস্টল আইকন</strong> অথবা ব্রাউজার সেটিংস মেনু থেকে &apos;Install AuraTrade&apos; নির্বাচন করুন।
</p>
<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>
@@ -159,7 +218,7 @@ export const InstallAppModal: React.FC<InstallAppModalProps> = ({
onClick={onClose}
className="text-gray-400 hover:text-white transition font-medium"
>
বুঝেছি (Close)
বন্ধ করুন (Close)
</button>
</div>
</div>