feat: restore QR code handoff, clickable app store buttons, and tool studio on dedicated tool page
This commit is contained in:
@@ -2,7 +2,18 @@
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import QRCode from 'qrcode';
|
||||
import { Smartphone, QrCode, Copy, Check, Gift, ExternalLink } from 'lucide-react';
|
||||
import {
|
||||
Smartphone,
|
||||
QrCode,
|
||||
Copy,
|
||||
Check,
|
||||
Gift,
|
||||
ExternalLink,
|
||||
Sparkles,
|
||||
Zap,
|
||||
ShieldCheck,
|
||||
Star
|
||||
} from 'lucide-react';
|
||||
import { AppItem, ToolItem, resolveLocalised } from '@/types';
|
||||
|
||||
interface AppHandoffSectionProps {
|
||||
@@ -21,22 +32,31 @@ export function AppHandoffSection({
|
||||
showQr = true,
|
||||
}: AppHandoffSectionProps) {
|
||||
const [qrDataUrl, setQrDataUrl] = useState<string>('');
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [copiedPromo, setCopiedPromo] = useState(false);
|
||||
const [copiedLink, setCopiedLink] = useState(false);
|
||||
const [origin, setOrigin] = useState<string>('');
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
setOrigin(window.location.origin);
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (!app) return null;
|
||||
|
||||
const bonusCode = app.welcomeBonus?.code || 'TRYWEB50';
|
||||
const baseHost = origin || 'http://localhost:3000';
|
||||
const targetUrl = tool
|
||||
? `http://localhost:3000/go/${tool.slug}/${app.slug}?promo=${bonusCode}`
|
||||
: `http://localhost:3000/apps/${app.slug}?promo=${bonusCode}`;
|
||||
? `${baseHost}/go/${tool.slug}/${app.slug}?promo=${bonusCode}`
|
||||
: `${baseHost}/apps/${app.slug}?promo=${bonusCode}`;
|
||||
|
||||
useEffect(() => {
|
||||
if (showQr) {
|
||||
QRCode.toDataURL(targetUrl, {
|
||||
width: 200,
|
||||
width: 240,
|
||||
margin: 1,
|
||||
color: {
|
||||
dark: '#0f172a',
|
||||
dark: '#020617',
|
||||
light: '#ffffff',
|
||||
},
|
||||
})
|
||||
@@ -47,41 +67,100 @@ export function AppHandoffSection({
|
||||
|
||||
const copyPromo = () => {
|
||||
navigator.clipboard.writeText(bonusCode);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
setCopiedPromo(true);
|
||||
setTimeout(() => setCopiedPromo(false), 2000);
|
||||
};
|
||||
|
||||
const copyTargetUrl = () => {
|
||||
navigator.clipboard.writeText(targetUrl);
|
||||
setCopiedLink(true);
|
||||
setTimeout(() => setCopiedLink(false), 2000);
|
||||
};
|
||||
|
||||
const appName = resolveLocalised(app.name, locale);
|
||||
const appTagline = resolveLocalised(app.tagline, locale);
|
||||
|
||||
return (
|
||||
<section className="py-20 sm:py-28 bg-[#FAF8F5] border-t border-slate-900/[0.08] relative overflow-hidden">
|
||||
<section
|
||||
id="app-handoff"
|
||||
className="py-16 sm:py-24 bg-gradient-to-b from-[#FAF8F5] via-white to-[#FAF8F5] border-t border-slate-900/[0.08] relative overflow-hidden scroll-mt-24"
|
||||
>
|
||||
{/* Ambient background glow */}
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-7xl h-96 bg-gradient-to-r from-blue-500/[0.04] via-indigo-500/[0.05] to-teal-500/[0.04] blur-3xl pointer-events-none -z-10" />
|
||||
|
||||
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
|
||||
<div className="bg-white rounded-3xl p-8 sm:p-12 border border-slate-900/[0.08] shadow-cream-md flex flex-col md:flex-row items-center justify-between gap-8 sm:gap-12">
|
||||
{/* Left Column: Copy & Store CTA */}
|
||||
<div className="space-y-5 max-w-xl">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700">
|
||||
<Smartphone className="w-3.5 h-3.5 text-blue-600" />
|
||||
<span>NATIVE IOS & ANDROID APPS</span>
|
||||
<div className="bg-white rounded-[2.5rem] p-8 sm:p-12 lg:p-14 border border-slate-900/[0.09] shadow-cinematic-3d flex flex-col lg:flex-row items-center justify-between gap-10 lg:gap-14">
|
||||
|
||||
{/* Left Column: Copy, Bonus & Clickable Store Buttons */}
|
||||
<div className="space-y-6 max-w-xl">
|
||||
{/* Header Badge */}
|
||||
<div className="flex flex-wrap items-center gap-2.5">
|
||||
<span className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200/80 text-xs font-mono font-bold text-blue-700 shadow-2xs">
|
||||
<Smartphone className="w-3.5 h-3.5 text-blue-600" />
|
||||
<span>NATIVE IOS & ANDROID APP</span>
|
||||
</span>
|
||||
|
||||
{app.rating && (
|
||||
<span className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-amber-50 border border-amber-200 text-xs font-bold text-amber-800 shadow-2xs">
|
||||
<Star className="w-3.5 h-3.5 fill-amber-400 text-amber-400" />
|
||||
<span>{app.rating.value}</span>
|
||||
<span className="text-[11px] font-mono text-amber-700 font-normal">
|
||||
({(app.rating.count / 1000).toFixed(0)}k+ creators)
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<h3 className="text-2xl sm:text-3xl lg:text-4xl font-display font-black text-slate-900 tracking-tight">
|
||||
{tool
|
||||
? `Continue in ${resolveLocalised(app.name, locale)} with 4K Lossless Export`
|
||||
: `Download ${resolveLocalised(app.name, locale)}`}
|
||||
</h3>
|
||||
{/* Main Headline */}
|
||||
<div>
|
||||
<h2 className="text-2xl sm:text-3xl lg:text-4xl font-display font-black text-slate-900 tracking-tight leading-snug">
|
||||
{tool
|
||||
? `Continue in ${appName} with 4K Lossless Export`
|
||||
: `Download ${appName}`}
|
||||
</h2>
|
||||
<p className="mt-2 text-xs sm:text-sm text-slate-600 font-normal leading-relaxed">
|
||||
Experience zero-latency hardware-accelerated neural processing, batch photoshoot enhancement, fine-tuning sliders, and uncompressed 4K export directly on your phone.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p className="text-xs sm:text-sm text-slate-600 leading-relaxed font-normal">
|
||||
Experience zero-latency hardware-accelerated neural processing, batch photoshoot enhancement, and professional fine-tuning sliders on your phone.
|
||||
</p>
|
||||
{/* Key Feature Perks List */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2.5 pt-1 text-xs text-slate-700">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-5 h-5 rounded-full bg-emerald-50 border border-emerald-200 flex items-center justify-center shrink-0">
|
||||
<Check className="w-3 h-3 text-emerald-600" />
|
||||
</div>
|
||||
<span className="font-medium">4K Lossless Uncompressed Export</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-5 h-5 rounded-full bg-blue-50 border border-blue-200 flex items-center justify-center shrink-0">
|
||||
<Zap className="w-3 h-3 text-blue-600" />
|
||||
</div>
|
||||
<span className="font-medium">On-Device Neural Engine Acceleration</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-5 h-5 rounded-full bg-indigo-50 border border-indigo-200 flex items-center justify-center shrink-0">
|
||||
<Sparkles className="w-3 h-3 text-indigo-600" />
|
||||
</div>
|
||||
<span className="font-medium">Batch Multi-Photo Enhancement</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-5 h-5 rounded-full bg-emerald-50 border border-emerald-200 flex items-center justify-center shrink-0">
|
||||
<ShieldCheck className="w-3 h-3 text-emerald-600" />
|
||||
</div>
|
||||
<span className="font-medium">Offline Private Mode (100% Private)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Welcome Bonus Promo Banner */}
|
||||
{showBonus && (
|
||||
<div className="p-4 sm:p-5 rounded-2xl bg-amber-50/70 border border-amber-200 flex items-center justify-between shadow-sm">
|
||||
<div className="p-4 sm:p-5 rounded-2xl bg-gradient-to-r from-amber-500/10 via-amber-400/5 to-amber-500/10 border border-amber-300/80 flex items-center justify-between gap-4 shadow-sm">
|
||||
<div className="flex items-center gap-3.5">
|
||||
<div className="w-11 h-11 rounded-xl bg-amber-100 border border-amber-300 flex items-center justify-center text-amber-700 shrink-0">
|
||||
<div className="w-11 h-11 rounded-2xl bg-amber-100 border border-amber-300 flex items-center justify-center text-amber-700 shrink-0 shadow-sm">
|
||||
<Gift className="w-5 h-5" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs sm:text-sm font-display font-bold text-slate-900">
|
||||
{app.welcomeBonus?.title || '50 Free HD Export Credits'}
|
||||
{app.welcomeBonus?.title || '50 Free 4K HD Export Credits'}
|
||||
</p>
|
||||
<p className="text-[11px] font-mono text-slate-600">
|
||||
Claim promo code on first mobile launch
|
||||
@@ -90,57 +169,118 @@ export function AppHandoffSection({
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={copyPromo}
|
||||
className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-xl text-xs font-mono font-bold bg-white border border-amber-300 text-amber-900 hover:bg-amber-100 shadow-sm transition-all active:scale-95"
|
||||
className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-xl text-xs font-mono font-bold bg-white border border-amber-300 text-amber-900 hover:bg-amber-100 shadow-sm transition-all active:scale-95 shrink-0"
|
||||
title="Click to copy promo code"
|
||||
>
|
||||
{copied ? <Check className="w-3.5 h-3.5 text-emerald-600" /> : <Copy className="w-3.5 h-3.5 text-amber-700" />}
|
||||
<span>{bonusCode}</span>
|
||||
{copiedPromo ? <Check className="w-3.5 h-3.5 text-emerald-600" /> : <Copy className="w-3.5 h-3.5 text-amber-700" />}
|
||||
<span>{copiedPromo ? 'COPIED!' : 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"
|
||||
className="px-6 py-3 rounded-full text-xs font-bold text-white bg-slate-900 hover:bg-slate-800 shadow-sm transition-all flex items-center gap-2 hover:scale-105 active:scale-95"
|
||||
>
|
||||
<span>Google Play</span>
|
||||
<ExternalLink className="w-3.5 h-3.5 opacity-60" />
|
||||
</a>
|
||||
<a
|
||||
href={app.stores.ios?.url || '#'}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="px-6 py-3 rounded-full text-xs font-bold text-slate-900 bg-slate-100 border border-slate-300 hover:bg-slate-200 shadow-sm transition-all flex items-center gap-2 hover:scale-105 active:scale-95"
|
||||
>
|
||||
<span>Apple App Store</span>
|
||||
<ExternalLink className="w-3.5 h-3.5 opacity-60" />
|
||||
</a>
|
||||
{/* Official Clickable App Store & Google Play Buttons */}
|
||||
<div className="pt-2 space-y-2">
|
||||
<p className="text-[11px] font-mono uppercase tracking-wider text-slate-500 font-semibold">
|
||||
Available now for instant install:
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center gap-3.5">
|
||||
{/* Apple App Store Official Badge Button */}
|
||||
<a
|
||||
href={app.stores?.ios?.url || `/go/${tool?.slug || 'explore'}/${app.slug}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="px-6 py-3 rounded-2xl text-white bg-slate-950 hover:bg-black border border-slate-800 shadow-md hover:shadow-xl hover:-translate-y-0.5 active:translate-y-0 transition-all flex items-center gap-3.5 group"
|
||||
>
|
||||
<svg className="w-6 h-6 fill-white group-hover:scale-110 transition-transform" viewBox="0 0 24 24">
|
||||
<path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M15.97 6.37c.62-.75 1.04-1.8 0.92-2.87-.9.04-2 .6-2.65 1.36-.58.67-1.08 1.74-.95 2.78 1.01.08 2.05-.52 2.68-1.27z" />
|
||||
</svg>
|
||||
<div className="text-left leading-tight">
|
||||
<span className="block text-[9.5px] uppercase font-mono tracking-wider text-slate-400">Download on the</span>
|
||||
<span className="block text-sm font-bold text-white font-display">Apple App Store</span>
|
||||
</div>
|
||||
<ExternalLink className="w-3.5 h-3.5 text-slate-400 group-hover:text-white transition-colors ml-1" />
|
||||
</a>
|
||||
|
||||
{/* Google Play Store Official Badge Button */}
|
||||
<a
|
||||
href={app.stores?.android?.url || `/go/${tool?.slug || 'explore'}/${app.slug}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="px-6 py-3 rounded-2xl text-white bg-slate-950 hover:bg-black border border-slate-800 shadow-md hover:shadow-xl hover:-translate-y-0.5 active:translate-y-0 transition-all flex items-center gap-3.5 group"
|
||||
>
|
||||
<svg className="w-5 h-5 group-hover:scale-110 transition-transform" viewBox="0 0 24 24">
|
||||
<path fill="#4285F4" d="M3.609 1.814L13.792 12 3.61 22.186c-.378-.344-.61-.853-.61-1.436V3.25c0-.583.232-1.092.61-1.436z" />
|
||||
<path fill="#FBBC04" d="M17.156 8.636l-3.364 3.364 3.364 3.364 3.805-2.174c.773-.442.773-1.162 0-1.604l-3.805-2.95z" />
|
||||
<path fill="#EA4335" d="M13.792 12L3.609 1.814c.31-.282.72-.454 1.171-.454.407 0 .807.14 1.157.34l11.219 6.936-3.364 3.364z" />
|
||||
<path fill="#34A853" d="M13.792 12l3.364 3.364-11.219 6.936c-.35.2-.75.34-1.157.34-.451 0-.861-.172-1.171-.454L13.792 12z" />
|
||||
</svg>
|
||||
<div className="text-left leading-tight">
|
||||
<span className="block text-[9.5px] uppercase font-mono tracking-wider text-slate-400">GET IT ON</span>
|
||||
<span className="block text-sm font-bold text-white font-display">Google Play</span>
|
||||
</div>
|
||||
<ExternalLink className="w-3.5 h-3.5 text-slate-400 group-hover:text-white transition-colors ml-1" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Disclaimer */}
|
||||
<p className="text-[11px] font-mono text-slate-500 italic">
|
||||
<p className="text-[11px] font-mono text-slate-400 italic">
|
||||
{resolveLocalised(app.creditsNote, locale, 'Credits and in-app purchases are specific to this app.')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Right Column: QR Code Handoff */}
|
||||
{/* Right Column: High-Tech Futuristic QR Code Scanner Card */}
|
||||
{showQr && qrDataUrl && (
|
||||
<div className="text-center p-6 sm:p-8 rounded-3xl bg-[#FAF8F5] border border-slate-200 shadow-inner shrink-0">
|
||||
<div className="p-3 bg-white rounded-2xl shadow-md inline-block border border-slate-100">
|
||||
<div className="relative group text-center p-6 sm:p-8 rounded-3xl bg-slate-950 border border-slate-800 shadow-2xl shrink-0 overflow-hidden w-full sm:w-auto flex flex-col items-center">
|
||||
{/* Ambient Glow */}
|
||||
<div className="absolute -inset-1 bg-gradient-to-tr from-blue-600/30 via-indigo-600/25 to-teal-500/30 rounded-3xl blur-2xl opacity-40 group-hover:opacity-70 transition-opacity pointer-events-none" />
|
||||
|
||||
{/* Animated Futuristic Laser Reticle Corners */}
|
||||
<span className="absolute top-3 left-3 w-4 h-4 border-t-2 border-l-2 border-blue-400 rounded-tl-sm pointer-events-none" />
|
||||
<span className="absolute top-3 right-3 w-4 h-4 border-t-2 border-r-2 border-blue-400 rounded-tr-sm pointer-events-none" />
|
||||
<span className="absolute bottom-3 left-3 w-4 h-4 border-b-2 border-l-2 border-blue-400 rounded-bl-sm pointer-events-none" />
|
||||
<span className="absolute bottom-3 right-3 w-4 h-4 border-b-2 border-r-2 border-blue-400 rounded-br-sm pointer-events-none" />
|
||||
|
||||
{/* QR Code Presentation Canvas */}
|
||||
<div className="relative z-10 p-3.5 bg-white rounded-2xl shadow-xl inline-block border border-white/20 transition-transform duration-300 group-hover:scale-[1.02]">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={qrDataUrl} alt="Scan QR code to install app" className="w-36 h-36 sm:w-40 sm:h-40" />
|
||||
<img
|
||||
src={qrDataUrl}
|
||||
alt="Scan QR code to install app"
|
||||
className="w-40 h-40 sm:w-44 sm:h-44 object-contain rounded-lg"
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-4 flex items-center justify-center gap-2 text-xs font-mono font-bold text-slate-800">
|
||||
<QrCode className="w-4 h-4 text-blue-600" />
|
||||
<span>Scan with phone camera</span>
|
||||
|
||||
{/* Status Beacon & Camera Target */}
|
||||
<div className="relative z-10 mt-4 flex items-center justify-center gap-2">
|
||||
<span className="relative flex h-2 w-2">
|
||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
|
||||
<span className="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span>
|
||||
</span>
|
||||
<span className="text-xs font-mono font-bold tracking-wider uppercase text-slate-200">
|
||||
Point Camera to Scan
|
||||
</span>
|
||||
</div>
|
||||
<p className="relative z-10 text-[11px] font-mono text-slate-400 mt-1 max-w-[210px] mx-auto">
|
||||
Opens app store listing instantly with promo code pre-applied
|
||||
</p>
|
||||
|
||||
{/* Quick Copy Link Action */}
|
||||
<div className="relative z-10 mt-3 pt-3 border-t border-slate-800/80 w-full flex justify-center">
|
||||
<button
|
||||
type="button"
|
||||
onClick={copyTargetUrl}
|
||||
className="inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-lg text-[11px] font-mono text-slate-400 hover:text-white bg-slate-900 border border-slate-800 hover:border-slate-700 transition-colors shadow-2xs active:scale-95"
|
||||
>
|
||||
{copiedLink ? <Check className="w-3.5 h-3.5 text-emerald-400" /> : <Copy className="w-3.5 h-3.5" />}
|
||||
<span>{copiedLink ? 'Copied Link!' : 'Copy Mobile Link'}</span>
|
||||
</button>
|
||||
</div>
|
||||
<p className="text-[10px] font-mono text-slate-500 mt-1">Instant redirect to store listing</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user