'use client'; import React, { useState, useEffect } from 'react'; import QRCode from 'qrcode'; import { Smartphone, QrCode, Copy, Check, Gift, ExternalLink } from 'lucide-react'; 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(''); 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, { width: 200, 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 (
{/* Left Column: Copy & Store CTA */}
NATIVE IOS & ANDROID APPS

{tool ? `Continue in ${resolveLocalised(app.name, locale)} with 4K Lossless Export` : `Download ${resolveLocalised(app.name, locale)}`}

Experience zero-latency hardware-accelerated neural processing, batch photoshoot enhancement, and professional fine-tuning sliders on your phone.

{/* Welcome Bonus Promo Banner */} {showBonus && (

{app.welcomeBonus?.title || '50 Free HD Export Credits'}

Claim promo code on first mobile launch

)} {/* Store Download Buttons */} {/* Disclaimer */}

{resolveLocalised(app.creditsNote, locale, 'Credits and in-app purchases are specific to this app.')}

{/* Right Column: QR Code Handoff */} {showQr && qrDataUrl && (
{/* eslint-disable-next-line @next/next/no-img-element */} Scan QR code to install app
Scan with phone camera

Instant redirect to store listing

)}
); }