Files
webb/src/components/sections/HeroSection.tsx
T

243 lines
12 KiB
TypeScript
Raw Normal View History

'use client';
import React from 'react';
import Link from 'next/link';
import {
Sparkles,
ArrowRight,
Smartphone,
ShieldCheck,
LockKeyhole,
Check,
Zap,
ArrowDown
} from 'lucide-react';
import { resolveLocalised, ToolItem, AppItem, VariantSpec } from '@/types';
import { TryItWidget } from './TryItWidget';
import { Hero3DCanvas } from '@/components/3d/Hero3DCanvas';
import { TextAnimate } from '@/components/magicui/text-animate';
import { GrainTransformShowcase } from '@/components/ui/GrainTransformShowcase';
interface HeroSectionProps {
title?: any;
subtitle?: any;
variant?: string;
badge?: any;
tryIt?: {
toolRef?: string;
ctaText?: string;
samplePresets?: Array<{ label: string; url: string; resultUrl?: string }>;
};
trustBadges?: Array<{ text: string; icon?: string }>;
primaryCta?: { label?: any; href?: string };
secondaryCta?: { label?: any; href?: string };
tool?: ToolItem | null;
homeApp?: AppItem | null;
variants?: VariantSpec[];
locale?: string;
}
export function HeroSection({
title,
subtitle,
variant = 'centered',
badge,
tryIt,
trustBadges,
primaryCta,
secondaryCta,
tool,
homeApp,
variants = [],
locale = 'en',
}: HeroSectionProps) {
const resolvedSubtitle = resolveLocalised(subtitle, locale) || 'Studio-grade neural vision tools with zero sign-up and zero data retention. Process high-resolution portraits, precision cutouts, and 4K restorations directly in your browser.';
const resolvedBadge = resolveLocalised(badge, locale) || 'Next-Gen Neural AI Studio';
const primaryCtaLabel = resolveLocalised(primaryCta?.label, locale, 'Explore Our Tools');
const primaryCtaHref = primaryCta?.href || '#our-tools';
const secondaryCtaLabel = resolveLocalised(secondaryCta?.label, locale, 'Recommended Apps');
const secondaryCtaHref = secondaryCta?.href || '#recommended-apps';
// Dedicated Tool Landing Hero (for /tools/[slug] SEO pages)
if (variant === 'toolHero' && tool) {
const categoryName = tool.category?.replace('-', ' ').toUpperCase() || 'AI TOOL';
const appName = homeApp ? resolveLocalised(homeApp.name, locale) : 'Mobile App';
const toolMedia = (tool as any).media;
const primaryExample = tool.content?.examples?.[0] || {
before: toolMedia?.before || `/management/pages/tools/${tool.slug}/media/before.jpg`,
after: toolMedia?.after || `/management/pages/tools/${tool.slug}/media/after.jpg`,
caption: 'Sub-pixel neural transformation details',
};
return (
<section className="relative isolate overflow-hidden pt-28 pb-16 sm:pt-32 sm:pb-20 lg:pt-36 lg:pb-24 bg-[#FAF8F5] border-b border-slate-900/[0.07]">
<div className="absolute inset-x-0 top-0 h-[640px] bg-[radial-gradient(ellipse_at_75%_20%,rgba(87,132,220,0.12),transparent_50%),radial-gradient(ellipse_at_15%_0%,rgba(208,182,142,0.15),transparent_40%)] pointer-events-none" />
<div className="relative z-10 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<nav aria-label="Breadcrumb" className="mb-5 flex items-center justify-center gap-2 text-xs font-medium text-slate-500">
<Link href="/" className="hover:text-blue-700 transition-colors">Home</Link>
<span>/</span>
<Link href="/tools" className="hover:text-blue-700 transition-colors">Tools</Link>
<span>/</span>
<span className="text-slate-900 font-semibold">{resolveLocalised(tool.name, locale)}</span>
</nav>
<div className="text-center max-w-4xl mx-auto mb-10 sm:mb-12">
<div className="inline-flex items-center gap-2 rounded-full border border-blue-200/90 bg-white/90 px-4 py-1.5 text-xs font-semibold tracking-[0.14em] uppercase text-blue-800 shadow-sm backdrop-blur">
<Sparkles className="w-3.5 h-3.5 text-blue-600" />
<span>{categoryName} • CRE NEURAL VISION 4.0</span>
</div>
<h1 className="mt-4 text-3xl sm:text-5xl lg:text-6xl font-display font-black tracking-tight text-slate-900 leading-[1.08]">
<TextAnimate animation="slideLeft" by="word">{resolveLocalised(tool.name, locale)}</TextAnimate>
</h1>
<p className="mt-4 text-base sm:text-lg leading-relaxed text-slate-600 max-w-2xl mx-auto font-sans">
<TextAnimate animation="fadeIn" by="word" delay={0.15}>{resolveLocalised(tool.summary, locale)}</TextAnimate>
</p>
<div className="mt-6 flex flex-wrap items-center justify-center gap-2 sm:gap-3 text-xs font-medium text-slate-600">
<span className="inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full bg-white/90 border border-slate-200/80 shadow-2xs">
<Check className="w-3.5 h-3.5 text-blue-600" /> Lossless 4K Reconstruction
</span>
<span className="inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full bg-white/90 border border-slate-200/80 shadow-2xs">
<Zap className="w-3.5 h-3.5 text-amber-500" /> &lt; 0.8s Inference
</span>
<span className="inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full bg-white/90 border border-slate-200/80 shadow-2xs">
<ShieldCheck className="w-3.5 h-3.5 text-emerald-600" /> 100% Private (Never Stored)
</span>
</div>
</div>
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-stretch max-w-7xl mx-auto" id="tool-studio">
<div className="lg:col-span-7 flex flex-col">
<TryItWidget
tool={tool}
homeApp={homeApp}
variants={variants}
locale={locale}
className="h-full flex flex-col justify-between"
/>
</div>
<div className="lg:col-span-5 flex flex-col" id="transformation-preview">
<div className="h-full rounded-3xl overflow-hidden border border-slate-900/[0.1] shadow-2xl bg-slate-950 flex flex-col justify-between min-h-[380px] sm:min-h-[460px]">
<GrainTransformShowcase
beforeUrl={primaryExample.before}
afterUrl={primaryExample.after}
beforeLabel="BEFORE"
afterLabel="AFTER"
/>
</div>
</div>
</div>
</div>
</section>
);
}
// Pure Front Page View (PRD & User Requirements):
// Clean, beautifully formatted typography + interactive 3D visuals strictly behind the text
return (
<section className="relative isolate min-h-[92vh] sm:min-h-[95vh] flex flex-col justify-center items-center text-center overflow-hidden bg-[#FAF8F5] pt-24 pb-16 px-4 sm:px-6 lg:px-8">
{/* 1. Interactive 3D WebGL Canvas & Particle Constellation Mounted Behind Text */}
<div className="absolute inset-0 -z-10 flex items-center justify-center pointer-events-none select-none overflow-hidden">
<div className="w-[520px] h-[520px] sm:w-[780px] sm:h-[780px] lg:w-[980px] lg:h-[980px] opacity-70 transform-gpu transition-opacity duration-1000">
<Hero3DCanvas className="w-full h-full" />
</div>
</div>
{/* 2. Ambient Atmosphere Radial Glows */}
<div
className="absolute inset-0 -z-20 pointer-events-none"
style={{
background: 'radial-gradient(circle at 50% 45%, rgba(37,99,235,0.13) 0%, rgba(14,165,233,0.07) 35%, transparent 70%)',
}}
/>
<div
className="absolute inset-x-0 bottom-0 h-40 bg-gradient-to-t from-[#FAF8F5] to-transparent -z-10 pointer-events-none"
/>
{/* 3. Front Page Content: Flawlessly Formatted, Luxurious Typography */}
<div className="relative z-10 max-w-5xl mx-auto flex flex-col items-center justify-center">
{/* Subtle Elegant Pill Badge */}
<div className="inline-flex items-center gap-2 rounded-full border border-blue-500/20 bg-white/90 backdrop-blur-md px-4 py-1.5 text-xs font-mono font-medium tracking-wider uppercase text-blue-800 shadow-sm mb-6">
<span className="flex h-2 w-2 relative">
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"></span>
<span className="relative inline-flex rounded-full h-2 w-2 bg-blue-600"></span>
</span>
<span>{resolvedBadge}</span>
</div>
{/* Editorial High-Impact Headline (SF Pro & Poppins) */}
<h1 className="text-4xl sm:text-6xl lg:text-[4.5rem] font-display font-extrabold tracking-[-0.035em] text-slate-900 leading-[1.08] max-w-4xl mx-auto text-balance">
<span className="block text-slate-900">
<TextAnimate animation="slideLeft" by="character">
Transform Photos with
</TextAnimate>
</span>
<span className="block mt-2 text-blue-600">
<TextAnimate animation="slideLeft" by="character" delay={0.25}>
Next-Gen Neural AI
</TextAnimate>
</span>
</h1>
{/* Balanced, Readable Subtitle (Inter / SF Pro) */}
<p className="mt-6 text-base sm:text-lg lg:text-xl text-slate-600 max-w-2xl mx-auto font-sans leading-relaxed text-balance">
<TextAnimate animation="fadeIn" by="word" delay={0.25}>
{resolvedSubtitle}
</TextAnimate>
</p>
{/* Primary and Secondary Action Buttons */}
<div className="mt-9 flex flex-wrap items-center justify-center gap-3.5">
<a
href={primaryCtaHref}
className="group inline-flex items-center gap-2.5 rounded-full bg-slate-950 px-8 py-3.5 text-xs sm:text-sm font-bold text-white shadow-lg shadow-slate-900/15 transition-all duration-300 hover:scale-105 hover:bg-blue-600 active:scale-95"
>
<span>{primaryCtaLabel}</span>
<ArrowDown className="w-4 h-4 transition-transform group-hover:translate-y-0.5" />
</a>
<a
href={secondaryCtaHref}
className="inline-flex items-center gap-2 rounded-full border border-slate-300/90 bg-white/80 backdrop-blur-md px-7 py-3.5 text-xs sm:text-sm font-semibold text-slate-800 shadow-sm transition-all duration-300 hover:scale-105 hover:bg-white active:scale-95"
>
<Smartphone className="w-4 h-4 text-blue-600" />
<span>{secondaryCtaLabel}</span>
</a>
</div>
{/* Trust Badges Strip */}
<div className="mt-8 flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs font-medium text-slate-500 font-sans">
<span className="inline-flex items-center gap-1.5">
<ShieldCheck className="h-4 w-4 text-emerald-600" />
<span>Zero-Storage Guarantee</span>
</span>
<span className="inline-flex items-center gap-1.5">
<Check className="h-4 w-4 text-blue-600" />
<span>Lossless 4K Export</span>
</span>
<span className="inline-flex items-center gap-1.5">
<Zap className="h-4 w-4 text-amber-500" />
<span>&lt; 0.8s Inference</span>
</span>
</div>
{/* Gentle Scroll Cue */}
<a
href="#our-tools"
aria-label="Scroll to our tools"
className="mt-12 inline-flex flex-col items-center gap-1.5 text-[11px] font-mono uppercase tracking-widest text-slate-600 hover:text-blue-600 transition-colors"
>
<span>Scroll to Explore</span>
<span className="w-4 h-7 rounded-full border border-slate-300 flex justify-center p-1">
<span className="w-1 h-1.5 rounded-full bg-blue-600 animate-bounce" />
</span>
</a>
</div>
</section>
);
}