From 358fdaad3c912e6ca53ef476e6c3b2808cb3810b Mon Sep 17 00:00:00 2001 From: khondokar Date: Fri, 23 Oct 2026 00:31:09 +0600 Subject: [PATCH] feat: add dual-tab Apple iOS and PC/Android interactive install modal --- .../src/components/header/TitanHeader.tsx | 14 +- .../src/components/pwa/InstallAppModal.tsx | 129 +++++++++++++----- 2 files changed, 95 insertions(+), 48 deletions(-) diff --git a/frontend/src/components/header/TitanHeader.tsx b/frontend/src/components/header/TitanHeader.tsx index 64112b1..fbc9ad9 100644 --- a/frontend/src/components/header/TitanHeader.tsx +++ b/frontend/src/components/header/TitanHeader.tsx @@ -77,19 +77,7 @@ export const TitanHeader: React.FC = ({ 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 = () => { diff --git a/frontend/src/components/pwa/InstallAppModal.tsx b/frontend/src/components/pwa/InstallAppModal.tsx index b02f4b2..4a31cfc 100644 --- a/frontend/src/components/pwa/InstallAppModal.tsx +++ b/frontend/src/components/pwa/InstallAppModal.tsx @@ -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 = ({ onNativeInstall, canNativeInstall, }) => { + const [activeTab, setActiveTab] = useState<"apple" | "desktop">("apple"); + + useEffect(() => { + if (isIOS) { + setActiveTab("apple"); + } else { + setActiveTab("desktop"); + } + }, [isIOS, isOpen]); + if (!isOpen) return null; return ( -
+
e.stopPropagation()} > {/* Luminous Top Accent Glow */} @@ -48,9 +62,13 @@ export const InstallAppModal: React.FC = ({ {/* Modal Header */} -
+
- + {activeTab === "apple" ? ( + + ) : ( + + )}
@@ -62,69 +80,99 @@ export const InstallAppModal: React.FC = ({

- {isIOS + {activeTab === "apple" ? "Apple iPhone / iPad হোম স্ক্রিনে ইনস্টল করুন" - : "পিসি বা মোবাইলে ১-ক্লিকে ইনস্টল করুন"} + : "পিসি বা অ্যান্ড্রয়েডে ১-ক্লিক ইনস্টলেশন"}

- {/* Content Mode: iOS vs Desktop/Android */} - {isIOS ? ( - /* Apple iOS Visual Instructions */ -
+ {/* Device Switcher Tabs */} +
+ + +
+ + {/* Tab 1: Apple iOS Visual Guide */} + {activeTab === "apple" && ( +
১

- Safari-এর নিচে Share বাটনে চাপ দিন + Safari-র নিচে Share আইকনে ট্যাপ করুন

- আইফোনের সাফারি ব্রাউজারের নিচে শেয়ার আইকনে ট্যাপ করুন। + আইফোন বা আইপ্যাডের সাফারি ব্রাউজারের নিচে শেয়ার বাটনে চাপ দিন।

-
- ২ +
+ ২

- স্ক্রোল করে Add to Home Screen চাপুন + স্ক্রোল করে Add to Home Screen চাপুন

- মেনুটি একটু নিচে স্ক্রোল করে এই অপশনটি নির্বাচন করুন। + শেয়ার শিট মেনু থেকে এই অপশনটিতে ট্যাপ করুন।

-
- ৩ +
+ ৩

- উপরে ডানে Add বাটনে ট্যাপ করুন + উপরে ডানপাশে Add বাটনে ট্যাপ করুন

- অ্যাপল ডিভাইসের হোম স্ক্রিনে AuraTrade অ্যাপ আইকন তৈরি হয়ে যাবে। + আপনার অ্যাপল হোম স্ক্রিনে নেটিভ AuraTrade অ্যাপ আইকন তৈরি হয়ে যাবে।

+ +
+ + ব্রাউজার অ্যাড্রেস বার ছাড়া ফুলস্ক্রিন নেটিভ ডার্ক মোডে চালু হবে। +
- ) : ( - /* Desktop / Android Direct Native 1-Click Trigger */ -
-
+ )} + + {/* Tab 2: PC & Android 1-Click Install */} + {activeTab === "desktop" && ( +
+
- নেটিভ উইন্ডো ও ইনস্ট্যান্ট স্পিড + উইন্ডোজ পিসি, ম্যাক ও অ্যান্ড্রয়েড অ্যাপ

- ব্রাউজারের কোনো অ্যাড্রেস বার বা ট্যাব ছাড়াই আলাদা সফটওয়্যারের মতো ফুলস্ক্রিনে চলবে। এক্সনেস লাইভ টিক ও চার্ট ০% ল্যাগিংয়ে লোড হবে। + ব্রাউজারের কোনো ট্যাব বা বার ছাড়াই আলাদা সফটওয়্যারের মতো ফুলস্ক্রিনে চলবে। এক্সনেস লাইভ টিক ও চার্ট ০% ল্যাগিংয়ে লোড হবে।

@@ -134,17 +182,28 @@ export const InstallAppModal: React.FC = ({ 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" > এখনই ইনস্টল করুন (1-Click Install) ) : ( -
-

ব্রাউজার মেনু থেকে ইনস্টল করুন:

-

- ব্রাউজারের অ্যাড্রেস বারের ডানপাশে থাকা ইনস্টল আইকন অথবা ব্রাউজার সেটিংস মেনু থেকে 'Install AuraTrade' নির্বাচন করুন। -

+
+ +
+

+ অথবা ব্রাউজারের অ্যাড্রেস বারের ডানপাশে থাকা Install আইকনে চাপ দিন। +

+
)}
@@ -159,7 +218,7 @@ export const InstallAppModal: React.FC = ({ onClick={onClose} className="text-gray-400 hover:text-white transition font-medium" > - বুঝেছি (Close) + বন্ধ করুন (Close)