2026-11-03 12:24:43 +05:30
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
|
import QRCode from 'qrcode';
|
2026-11-03 12:31:06 +05:30
|
|
|
import { Smartphone, QrCode, Copy, Check, Gift, ExternalLink } from 'lucide-react';
|
2026-11-03 12:24:43 +05:30
|
|
|
import { AppItem, ToolItem, resolveLocalised } from '@/types';
|
|
|
|
|
|
|
|
|
|
interface AppHandoffSectionProps {
|
|
|
|
|
app?: AppItem;
|
|
|
|
|
tool?: ToolItem | null;
|
|
|
|
|
locale?: string;
|
|
|
|
|
showBonus?: boolean;
|
|
|
|
|
showQr?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function AppHandoffSection({
|
|
|
|
|
app,
|
|
|
|
|
tool,
|
|
|
|
|
locale = 'en',
|
|
|
|
|
showBonus = true,
|
|
|
|
|
showQr = true,
|
|
|
|
|
}: AppHandoffSectionProps) {
|
|
|
|
|
const [qrDataUrl, setQrDataUrl] = useState<string>('');
|
|
|
|
|
const [copied, setCopied] = useState(false);
|
|
|
|
|
|
|
|
|
|
if (!app) return null;
|
|
|
|
|
|
|
|
|
|
const bonusCode = app.welcomeBonus?.code || 'TRYWEB50';
|
|
|
|
|
const targetUrl = tool
|
|
|
|
|
? `http://localhost:3000/go/${tool.slug}/${app.slug}?promo=${bonusCode}`
|
|
|
|
|
: `http://localhost:3000/apps/${app.slug}?promo=${bonusCode}`;
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (showQr) {
|
|
|
|
|
QRCode.toDataURL(targetUrl, {
|
2026-11-03 12:31:06 +05:30
|
|
|
width: 200,
|
2026-11-03 12:24:43 +05:30
|
|
|
margin: 1,
|
|
|
|
|
color: {
|
|
|
|
|
dark: '#0f172a',
|
|
|
|
|
light: '#ffffff',
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
.then(setQrDataUrl)
|
|
|
|
|
.catch(console.error);
|
|
|
|
|
}
|
|
|
|
|
}, [targetUrl, showQr]);
|
|
|
|
|
|
|
|
|
|
const copyPromo = () => {
|
|
|
|
|
navigator.clipboard.writeText(bonusCode);
|
|
|
|
|
setCopied(true);
|
|
|
|
|
setTimeout(() => setCopied(false), 2000);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-11-03 12:31:06 +05:30
|
|
|
<section className="py-12 sm:py-16 bg-gradient-to-br from-blue-50/50 via-white to-cyan-50/50 dark:from-slate-900/60 dark:via-slate-900/40 dark:to-slate-950/60 border-y border-slate-200/80 dark:border-slate-800/80">
|
2026-11-03 12:24:43 +05:30
|
|
|
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
|
2026-11-03 12:31:06 +05:30
|
|
|
<div className="bg-white/95 dark:bg-slate-900/95 backdrop-blur-xl rounded-3xl p-6 sm:p-10 border border-slate-200/80 dark:border-slate-800/80 shadow-2xl flex flex-col md:flex-row items-center justify-between gap-8 sm:gap-12">
|
2026-11-03 12:24:43 +05:30
|
|
|
{/* Left Column: Copy & Store CTA */}
|
|
|
|
|
<div className="space-y-4 max-w-xl">
|
2026-11-03 12:31:06 +05:30
|
|
|
<div className="inline-flex items-center space-x-2 px-3.5 py-1.5 rounded-full bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-cyan-400 text-xs font-bold border border-blue-100 dark:border-blue-900/40">
|
2026-11-03 12:24:43 +05:30
|
|
|
<Smartphone className="w-3.5 h-3.5" />
|
2026-11-03 12:31:06 +05:30
|
|
|
<span>Native iOS & Android Application</span>
|
2026-11-03 12:24:43 +05:30
|
|
|
</div>
|
|
|
|
|
|
2026-11-03 12:31:06 +05:30
|
|
|
<h3 className="text-2xl sm:text-3xl font-black text-slate-900 dark:text-white tracking-tight">
|
2026-11-03 12:24:43 +05:30
|
|
|
{tool
|
|
|
|
|
? `Continue in ${resolveLocalised(app.name, locale)} with 4K Lossless Export`
|
|
|
|
|
: `Download ${resolveLocalised(app.name, locale)}`}
|
|
|
|
|
</h3>
|
|
|
|
|
|
2026-11-03 12:31:06 +05:30
|
|
|
<p className="text-xs sm:text-sm text-slate-600 dark:text-slate-400 leading-relaxed">
|
|
|
|
|
Experience zero-latency hardware-accelerated neural processing, batch photoshoot enhancement, and professional fine-tuning sliders on your phone.
|
2026-11-03 12:24:43 +05:30
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
{/* Welcome Bonus Promo Banner */}
|
|
|
|
|
{showBonus && (
|
2026-11-03 12:31:06 +05:30
|
|
|
<div className="p-4 sm:p-5 rounded-2xl bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/40 dark:to-orange-950/40 border border-amber-200/80 dark:border-amber-800/60 flex items-center justify-between shadow-sm">
|
|
|
|
|
<div className="flex items-center space-x-3.5">
|
|
|
|
|
<div className="w-11 h-11 rounded-xl bg-amber-100 dark:bg-amber-900/60 flex items-center justify-center text-amber-600 shrink-0">
|
2026-11-03 12:24:43 +05:30
|
|
|
<Gift className="w-5 h-5" />
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2026-11-03 12:31:06 +05:30
|
|
|
<p className="text-xs sm:text-sm font-extrabold text-slate-900 dark:text-white">
|
2026-11-03 12:24:43 +05:30
|
|
|
{app.welcomeBonus?.title || '50 Free HD Export Credits'}
|
|
|
|
|
</p>
|
2026-11-03 12:31:06 +05:30
|
|
|
<p className="text-[11px] text-slate-600 dark:text-slate-400">
|
|
|
|
|
Claim promo code upon first mobile install
|
2026-11-03 12:24:43 +05:30
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onClick={copyPromo}
|
2026-11-03 12:31:06 +05:30
|
|
|
className="inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-xl text-xs font-mono font-bold bg-white dark:bg-slate-900 border border-amber-300 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-950 shadow-sm transition-colors"
|
2026-11-03 12:24:43 +05:30
|
|
|
>
|
|
|
|
|
{copied ? <Check className="w-3.5 h-3.5 text-emerald-600" /> : <Copy className="w-3.5 h-3.5" />}
|
|
|
|
|
<span>{bonusCode}</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* Store Download Buttons */}
|
|
|
|
|
<div className="flex flex-wrap items-center gap-3 pt-2">
|
|
|
|
|
<a
|
|
|
|
|
href={app.stores.android?.url || '#'}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noreferrer"
|
2026-11-03 12:31:06 +05:30
|
|
|
className="px-5 py-3 rounded-2xl text-xs font-bold text-white bg-slate-900 hover:bg-slate-800 dark:bg-white dark:text-slate-900 dark:hover:bg-slate-100 shadow-md transition-all flex items-center space-x-2"
|
2026-11-03 12:24:43 +05:30
|
|
|
>
|
|
|
|
|
<span>Google Play</span>
|
2026-11-03 12:31:06 +05:30
|
|
|
<ExternalLink className="w-3.5 h-3.5 opacity-60" />
|
2026-11-03 12:24:43 +05:30
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href={app.stores.ios?.url || '#'}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noreferrer"
|
2026-11-03 12:31:06 +05:30
|
|
|
className="px-5 py-3 rounded-2xl text-xs font-bold text-white bg-slate-900 hover:bg-slate-800 dark:bg-white dark:text-slate-900 dark:hover:bg-slate-100 shadow-md transition-all flex items-center space-x-2"
|
2026-11-03 12:24:43 +05:30
|
|
|
>
|
|
|
|
|
<span>Apple App Store</span>
|
2026-11-03 12:31:06 +05:30
|
|
|
<ExternalLink className="w-3.5 h-3.5 opacity-60" />
|
2026-11-03 12:24:43 +05:30
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Disclaimer */}
|
|
|
|
|
<p className="text-[11px] text-slate-400 dark:text-slate-500 italic">
|
|
|
|
|
{resolveLocalised(app.creditsNote, locale, 'Credits and in-app purchases are specific to this app.')}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-11-03 12:31:06 +05:30
|
|
|
{/* Right Column: QR Code Handoff */}
|
2026-11-03 12:24:43 +05:30
|
|
|
{showQr && qrDataUrl && (
|
2026-11-03 12:31:06 +05:30
|
|
|
<div className="text-center p-6 sm:p-8 rounded-3xl bg-slate-50/80 dark:bg-slate-950/80 border border-slate-200/80 dark:border-slate-800/80 shadow-inner shrink-0">
|
|
|
|
|
<div className="p-3 bg-white rounded-2xl shadow-md inline-block">
|
2026-11-03 12:24:43 +05:30
|
|
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
2026-11-03 12:31:06 +05:30
|
|
|
<img src={qrDataUrl} alt="Scan QR code to install app" className="w-36 h-36 sm:w-40 sm:h-40" />
|
2026-11-03 12:24:43 +05:30
|
|
|
</div>
|
2026-11-03 12:31:06 +05:30
|
|
|
<div className="mt-3.5 flex items-center justify-center space-x-2 text-xs font-bold text-slate-700 dark:text-slate-300">
|
|
|
|
|
<QrCode className="w-4 h-4 text-blue-600 dark:text-cyan-400" />
|
2026-11-03 12:24:43 +05:30
|
|
|
<span>Scan with phone camera</span>
|
|
|
|
|
</div>
|
2026-11-03 12:31:06 +05:30
|
|
|
<p className="text-[10px] text-slate-500 mt-0.5">Instant redirect to store listing</p>
|
2026-11-03 12:24:43 +05:30
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|