feat: add PWA 1-click install, Apple iOS Add-to-Home-Screen guide modal, manifest, and service worker
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import {
|
||||
X,
|
||||
Share2,
|
||||
PlusSquare,
|
||||
CheckCircle2,
|
||||
Download,
|
||||
Smartphone,
|
||||
Laptop,
|
||||
Sparkles,
|
||||
ArrowRight
|
||||
} 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,
|
||||
}) => {
|
||||
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="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"
|
||||
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-5">
|
||||
<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" />
|
||||
</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">
|
||||
{isIOS
|
||||
? "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">
|
||||
<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> বাটনে চাপ দিন
|
||||
</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>
|
||||
<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> চাপুন
|
||||
</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>
|
||||
<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> বাটনে ট্যাপ করুন
|
||||
</p>
|
||||
<p className="text-gray-400 text-[11px] mt-0.5">
|
||||
অ্যাপল ডিভাইসের হোম স্ক্রিনে AuraTrade অ্যাপ আইকন তৈরি হয়ে যাবে।
|
||||
</p>
|
||||
</div>
|
||||
</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">
|
||||
<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-sm 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> অথবা ব্রাউজার সেটিংস মেনু থেকে 'Install AuraTrade' নির্বাচন করুন।
|
||||
</p>
|
||||
</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>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user