427 lines
20 KiB
TypeScript
427 lines
20 KiB
TypeScript
'use client';
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
import Link from 'next/link';
|
|
import dynamic from 'next/dynamic';
|
|
import {
|
|
Sparkles,
|
|
ArrowRight,
|
|
Smartphone,
|
|
ShieldCheck,
|
|
Cpu,
|
|
Zap,
|
|
Layers
|
|
} from 'lucide-react';
|
|
import { ToolItem, VariantSpec, resolveLocalised } from '@/types';
|
|
import { TryItWidget } from './TryItWidget';
|
|
import { CardBeforeAfterSlider } from '@/components/ui/CardBeforeAfterSlider';
|
|
|
|
import { BorderBeam } from '@/components/magicui/border-beam';
|
|
import { LightRays } from '@/components/magicui/light-rays';
|
|
import { RainbowButton } from '@/components/magicui/rainbow-button';
|
|
import { InteractiveHoverButton } from '@/components/magicui/interactive-hover-button';
|
|
import { BlurFade } from '@/components/magicui/blur-fade';
|
|
import { KineticText } from '@/components/magicui/kinetic-text';
|
|
import { AnimatedShinyText } from '@/components/magicui/animated-shiny-text';
|
|
import { TextAnimate } from '@/components/magicui/text-animate';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
/**
|
|
* Interactive Hero Headline Item:
|
|
* - At first: Magic UI TextAnimate character entrance (blurInUp stagger)
|
|
* - After hovering: Magic UI AnimatedShinyText specular shimmer reflection
|
|
* - 0% text shift: unified single DOM node with zero layout jitter
|
|
*/
|
|
function HeroHeadlineItem({
|
|
text,
|
|
delay = 0,
|
|
}: {
|
|
text: string;
|
|
delay?: number;
|
|
}) {
|
|
const [isEntranceDone, setIsEntranceDone] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const timer = setTimeout(() => {
|
|
setIsEntranceDone(true);
|
|
}, (delay + 0.75) * 1000);
|
|
return () => clearTimeout(timer);
|
|
}, [delay]);
|
|
|
|
return (
|
|
<AnimatedShinyText
|
|
shimmerWidth={220}
|
|
hoverOnly={true}
|
|
className="font-display font-black font-[950] text-ink tracking-tight inline-block cursor-pointer select-none overflow-visible pb-[0.25em] -mb-[0.25em] [text-shadow:_0_0.5px_0_currentColor]"
|
|
>
|
|
{isEntranceDone ? (
|
|
<span className="font-display font-black font-[950] text-ink tracking-tight inline-block overflow-visible pb-[0.25em] -mb-[0.25em] [text-shadow:_0_0.5px_0_currentColor]">
|
|
{text}
|
|
</span>
|
|
) : (
|
|
<TextAnimate
|
|
animation="blurInUp"
|
|
by="character"
|
|
duration={0.55}
|
|
delay={delay}
|
|
startOnView={false}
|
|
accessible={false}
|
|
as="span"
|
|
className="font-display font-black font-[950] text-ink tracking-tight inline-block overflow-visible pb-[0.25em] -mb-[0.25em] [text-shadow:_0_0.5px_0_currentColor]"
|
|
segmentClassName="inline-block whitespace-pre overflow-visible pb-[0.25em] -mb-[0.25em]"
|
|
>
|
|
{text}
|
|
</TextAnimate>
|
|
)}
|
|
</AnimatedShinyText>
|
|
);
|
|
}
|
|
|
|
interface HeroSectionProps {
|
|
title?: Record<string, string> | string;
|
|
badge?: Record<string, string> | string;
|
|
subtitle?: Record<string, string> | string;
|
|
primaryCta?: { label?: Record<string, string> | string; href?: string };
|
|
secondaryCta?: { label?: Record<string, string> | string; href?: string };
|
|
variant?: string;
|
|
tool?: ToolItem;
|
|
homeApp?: any;
|
|
variants?: VariantSpec[];
|
|
locale?: string;
|
|
}
|
|
|
|
export function HeroSection({
|
|
title,
|
|
badge,
|
|
subtitle,
|
|
primaryCta,
|
|
secondaryCta,
|
|
variant = 'frontpage',
|
|
tool,
|
|
homeApp,
|
|
variants = [],
|
|
locale = 'en',
|
|
}: HeroSectionProps) {
|
|
const primaryCtaLabel = resolveLocalised(primaryCta?.label, locale, 'Explore our tools');
|
|
const primaryCtaHref = primaryCta?.href || '#our-tools';
|
|
const secondaryCtaLabel = resolveLocalised(secondaryCta?.label, locale, 'Mobile studio apps');
|
|
const secondaryCtaHref = secondaryCta?.href || '#recommended-apps';
|
|
|
|
// 1. Tool Detail Page Hero (/tools/[slug]) — Where actual operations live
|
|
if (variant === 'toolHero' && tool) {
|
|
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 bg-paper border-b border-rule pt-12 pb-20 px-4 sm:px-6 lg:px-10 overflow-hidden">
|
|
{/* Subtle Ambient Studio Background */}
|
|
<div
|
|
className="pointer-events-none absolute inset-0 opacity-20 studio-proof-grid"
|
|
aria-hidden="true"
|
|
/>
|
|
<div
|
|
className="pointer-events-none absolute top-0 right-0 w-[550px] h-[550px] [background:radial-gradient(circle_at_center,color-mix(in_oklab,var(--color-accent)_12%,transparent)_0%,transparent_70%)]"
|
|
aria-hidden="true"
|
|
/>
|
|
|
|
<div className="max-w-container mx-auto relative z-10">
|
|
{/* Breadcrumb Navigation */}
|
|
<nav className="flex items-center gap-2 text-xs font-body text-muted mb-8">
|
|
<Link href="/" className="hover:text-ink motion-safe:transition-colors">Home</Link>
|
|
<span>/</span>
|
|
<Link href="/tools" className="hover:text-ink motion-safe:transition-colors">Tools</Link>
|
|
<span>/</span>
|
|
<span className="text-ink font-semibold">{resolveLocalised(tool.name, locale)}</span>
|
|
</nav>
|
|
|
|
{/* Heading Block */}
|
|
<div className="max-w-3xl mb-12">
|
|
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-paper-hi border border-rule text-xs font-body text-ink shadow-xs mb-4">
|
|
<Sparkles className="w-3.5 h-3.5 text-accent" />
|
|
<span>Studio neural vision</span>
|
|
</div>
|
|
<h1 className="text-3xl sm:text-5xl font-display font-extrabold text-ink tracking-tight">
|
|
<AnimatedShinyText>{resolveLocalised(tool.name, locale)}</AnimatedShinyText>
|
|
</h1>
|
|
<p className="mt-3 text-base sm:text-lg text-ink-2 font-body max-w-2xl leading-relaxed">
|
|
{resolveLocalised(tool.summary, locale)}
|
|
</p>
|
|
</div>
|
|
|
|
{/* Studio Workspace: Upload Studio on Left, Comparison on Right */}
|
|
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">
|
|
{/* Upload Studio */}
|
|
<div className="lg:col-span-6 bg-paper-hi border border-rule rounded-card p-6 sm:p-8 shadow-sheet relative overflow-hidden">
|
|
<BorderBeam size={120} duration={10} borderWidth={1.5} colorFrom="var(--color-accent)" colorTo="var(--color-accent-hi)" />
|
|
<div className="border-b border-rule pb-3.5 mb-6 flex items-center justify-between">
|
|
<span className="studio-label font-semibold text-ink">Interactive tool studio</span>
|
|
<span className="text-xs text-muted font-body">Zero server retention</span>
|
|
</div>
|
|
<TryItWidget
|
|
tool={tool}
|
|
homeApp={homeApp}
|
|
variants={variants}
|
|
locale={locale}
|
|
/>
|
|
</div>
|
|
|
|
{/* Specimen View */}
|
|
<div className="lg:col-span-6">
|
|
<div className="studio-sheet p-5 rounded-card">
|
|
<div className="mb-3.5 flex items-center justify-between text-xs text-muted font-body">
|
|
<span className="font-medium text-ink">Transformation specimen</span>
|
|
<span>Drag slider to inspect details</span>
|
|
</div>
|
|
<div className="aspect-[4/3] rounded-2xl overflow-hidden bg-paper-2 border border-rule">
|
|
<CardBeforeAfterSlider
|
|
beforeUrl={primaryExample.before}
|
|
afterUrl={primaryExample.after}
|
|
title={resolveLocalised(tool.name, locale)}
|
|
slug={tool.slug}
|
|
aspectRatio="aspect-[4/3]"
|
|
/>
|
|
</div>
|
|
<div className="mt-3.5 text-xs text-muted font-body text-center">
|
|
Full 4K batch processing available in the {homeApp ? resolveLocalised(homeApp.name, locale) : 'mobile app'}.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|
|
|
|
// 2. Centered Directory Hero (for /tools, /apps, /pricing, /trust)
|
|
if (variant === 'centered') {
|
|
const resolvedTitle = resolveLocalised(title, locale) || 'Creative studio';
|
|
const resolvedSubtitle = resolveLocalised(subtitle, locale);
|
|
|
|
const isTrustOrPrivacy =
|
|
resolvedTitle.toLowerCase().includes('trust') ||
|
|
resolvedTitle.toLowerCase().includes('privacy') ||
|
|
resolvedTitle.toLowerCase().includes('security');
|
|
|
|
return (
|
|
<section className="relative pt-24 sm:pt-28 pb-16 sm:pb-20 text-center bg-paper border-b border-rule overflow-hidden">
|
|
{/* Layered Studio Lighting Ambient Glow */}
|
|
<div
|
|
className="pointer-events-none absolute top-0 left-1/2 -translate-x-1/2 w-[750px] h-[450px] [background:radial-gradient(ellipse_at_top,color-mix(in_oklab,var(--color-accent)_12%,transparent)_0%,transparent_70%)]"
|
|
aria-hidden="true"
|
|
/>
|
|
<div
|
|
className="pointer-events-none absolute inset-0 opacity-20 studio-proof-grid"
|
|
aria-hidden="true"
|
|
/>
|
|
|
|
{/* Layered Light Rays */}
|
|
<LightRays className="opacity-40" />
|
|
|
|
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6 relative z-10">
|
|
<BlurFade delay={0.06}>
|
|
<div className="inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-paper-hi border border-rule text-xs font-body text-ink shadow-xs">
|
|
<span className="w-2 h-2 rounded-full bg-accent animate-pulse" />
|
|
<span className="font-semibold text-accent">
|
|
{isTrustOrPrivacy ? 'Security & Biometric Architecture' : 'Studio Neural Directory'}
|
|
</span>
|
|
<span className="w-1 h-1 rounded-full bg-muted/40" />
|
|
<span className="text-muted">
|
|
{isTrustOrPrivacy ? 'Zero photo retention' : 'Direct browser trials'}
|
|
</span>
|
|
</div>
|
|
</BlurFade>
|
|
|
|
<BlurFade delay={0.12}>
|
|
<h1 className="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-display font-extrabold text-ink tracking-tight max-w-4xl mx-auto leading-[1.12]">
|
|
{resolvedTitle.includes('\n') ? (
|
|
resolvedTitle.split('\n').map((line, idx) => (
|
|
<span key={idx} className="block">
|
|
<KineticText>{line.trim()}</KineticText>
|
|
</span>
|
|
))
|
|
) : (
|
|
<KineticText>{resolvedTitle}</KineticText>
|
|
)}
|
|
</h1>
|
|
</BlurFade>
|
|
|
|
{resolvedSubtitle && (
|
|
<BlurFade delay={0.18}>
|
|
<p className="text-sm sm:text-base lg:text-lg text-ink-2 font-body max-w-2xl mx-auto leading-relaxed text-pretty">
|
|
{resolvedSubtitle}
|
|
</p>
|
|
</BlurFade>
|
|
)}
|
|
|
|
{/* Studio Capability Highlights */}
|
|
<BlurFade delay={0.22}>
|
|
<div className="pt-1 flex flex-wrap items-center justify-center gap-2 text-xs font-body text-muted">
|
|
{isTrustOrPrivacy ? (
|
|
<>
|
|
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-paper-hi/90 border border-rule shadow-2xs">
|
|
<ShieldCheck className="w-3.5 h-3.5 text-emerald-600" />
|
|
<span>0-Second server retention</span>
|
|
</span>
|
|
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-paper-hi/90 border border-rule shadow-2xs">
|
|
<Zap className="w-3.5 h-3.5 text-blue-600" />
|
|
<span>Volatile RAM only</span>
|
|
</span>
|
|
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-paper-hi/90 border border-rule shadow-2xs">
|
|
<Sparkles className="w-3.5 h-3.5 text-accent" />
|
|
<span>Zero AI model training</span>
|
|
</span>
|
|
</>
|
|
) : (
|
|
<>
|
|
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-paper-hi/90 border border-rule shadow-2xs">
|
|
<Sparkles className="w-3.5 h-3.5 text-accent" />
|
|
<span>12 neural models</span>
|
|
</span>
|
|
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-paper-hi/90 border border-rule shadow-2xs">
|
|
<ShieldCheck className="w-3.5 h-3.5 text-emerald-600" />
|
|
<span>Zero server storage</span>
|
|
</span>
|
|
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-paper-hi/90 border border-rule shadow-2xs">
|
|
<Zap className="w-3.5 h-3.5 text-amber-500" />
|
|
<span>Live comparison sliders</span>
|
|
</span>
|
|
</>
|
|
)}
|
|
</div>
|
|
</BlurFade>
|
|
|
|
<BlurFade delay={0.26}>
|
|
<div className="flex flex-wrap items-center justify-center gap-4 pt-2">
|
|
{isTrustOrPrivacy ? (
|
|
<>
|
|
<RainbowButton href="/tools">
|
|
<span>Explore Free AI Tools</span>
|
|
<ArrowRight className="w-4 h-4 ml-1.5 inline" aria-hidden="true" />
|
|
</RainbowButton>
|
|
<InteractiveHoverButton text="View Privacy Policy" href="/privacy" />
|
|
</>
|
|
) : (
|
|
<>
|
|
<RainbowButton href="#tools-catalog">
|
|
<span>Browse all tools</span>
|
|
<ArrowRight className="w-4 h-4 ml-1.5 inline" aria-hidden="true" />
|
|
</RainbowButton>
|
|
<InteractiveHoverButton text="Mobile apps suite" href="/apps" />
|
|
</>
|
|
)}
|
|
</div>
|
|
</BlurFade>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|
|
|
|
// 3. Front Page Hero (Pure Website Intro, UI, and Animations — NO IMAGE FUNCTIONS, NO OPERATIONS)
|
|
return (
|
|
<section
|
|
id="hero-section"
|
|
className="relative min-h-[80vh] sm:min-h-[85vh] flex items-center overflow-hidden bg-paper pt-16 sm:pt-20 pb-8 sm:pb-12"
|
|
>
|
|
{/* Background Layer 1: High-Resolution Responsive Background Image */}
|
|
<div className="absolute inset-0 z-0 overflow-hidden">
|
|
<picture
|
|
className="absolute inset-0 block w-full h-full"
|
|
style={{
|
|
maskImage: 'linear-gradient(to top, transparent 0%, rgba(0,0,0,0.3) 15%, black 45%)',
|
|
WebkitMaskImage: 'linear-gradient(to top, transparent 0%, rgba(0,0,0,0.3) 15%, black 45%)',
|
|
}}
|
|
>
|
|
<source media="(max-width: 768px)" srcSet="/management/pages/home/hero_mobile.webp" type="image/webp" />
|
|
<source media="(max-width: 768px)" srcSet="/management/pages/home/hero_mobile.jpg" type="image/jpeg" />
|
|
<source srcSet="/management/pages/home/hero_desktop.webp" type="image/webp" />
|
|
<img
|
|
src="/management/pages/home/hero_desktop.jpg"
|
|
alt="CRE Innovations Photo Studio"
|
|
className="w-full h-full object-cover object-[right_top] sm:object-[right_top] -translate-y-3 sm:-translate-y-5 scale-[1.03] sm:scale-[1.04] origin-top-right select-none pointer-events-none opacity-85 sm:opacity-95 brightness-[0.98] sm:brightness-[0.97]"
|
|
loading="eager"
|
|
decoding="sync"
|
|
/>
|
|
</picture>
|
|
|
|
{/* Dynamic Studio Gradient Feathering (Light Theme Porcelain Scrims) */}
|
|
{/* Left Side Scrim for Desktop: Ensures 100% typography contrast while keeping the photography vibrant */}
|
|
<div className="absolute inset-0 bg-gradient-to-r from-paper via-paper/85 via-35% to-transparent to-60% hidden sm:block pointer-events-none" />
|
|
{/* Ultra-Deep Soft Bottom Fade: Seamlessly dissolves into pure white/porcelain theme */}
|
|
<div className="absolute inset-x-0 bottom-0 h-48 sm:h-72 md:h-96 lg:h-[450px] bg-gradient-to-t from-paper from-15% via-paper/95 via-40% via-paper/60 via-70% to-transparent to-100% pointer-events-none" />
|
|
<div className="absolute inset-x-0 bottom-0 h-24 sm:h-36 bg-gradient-to-t from-paper to-paper/90 pointer-events-none" />
|
|
</div>
|
|
|
|
{/* Background Layer 2: Magic UI Atmospheric Light Rays */}
|
|
<LightRays className="opacity-45" />
|
|
|
|
{/* Background Layer 3: Fine Dot Matrix Pattern */}
|
|
<div
|
|
className="pointer-events-none absolute inset-0 opacity-20 studio-proof-grid z-0"
|
|
aria-hidden="true"
|
|
/>
|
|
|
|
{/* Content Container (Website Introduction, Visual Hierarchy, Kinetic Motion) */}
|
|
<div className="relative z-10 max-w-[1720px] w-full mx-auto px-4 sm:px-8 lg:px-14 flex flex-col justify-center min-h-[75vh] sm:min-h-[80vh]">
|
|
<div className="max-w-2xl sm:max-w-3xl lg:max-w-4xl space-y-4 sm:space-y-6 text-center sm:text-left mx-auto sm:mx-0">
|
|
|
|
{/* Masterpiece 3-Line Headline:
|
|
Line 1: Imagine -> Magic UI TextAnimate on first, AnimatedShinyText on hover
|
|
Line 2: Transform -> Magic UI TextAnimate on first, AnimatedShinyText on hover
|
|
Line 3: Create Impossible -> Bold bluish-purple accent */}
|
|
<div className="space-y-0.5 sm:space-y-1">
|
|
<h1 className="sr-only">Imagine Transform Create Impossible</h1>
|
|
|
|
{/* Line 1 - Imagine */}
|
|
<div className="text-3xl sm:text-5xl md:text-6xl lg:text-7xl font-display font-black font-[950] tracking-tight leading-[1.2] sm:leading-[1.15] pb-1.5 sm:pb-2 block overflow-visible [text-shadow:_0_0.5px_0_currentColor]">
|
|
<HeroHeadlineItem text="Imagine" delay={0.08} />
|
|
</div>
|
|
|
|
{/* Line 2 - Transform */}
|
|
<div className="text-3xl sm:text-5xl md:text-6xl lg:text-7xl font-display font-black font-[950] tracking-tight leading-[1.2] sm:leading-[1.15] pb-1.5 sm:pb-2 block overflow-visible [text-shadow:_0_0.5px_0_currentColor]">
|
|
<HeroHeadlineItem text="Transform" delay={0.28} />
|
|
</div>
|
|
|
|
{/* Line 3 - Create Impossible */}
|
|
<div className="text-3xl sm:text-5xl md:text-6xl lg:text-7xl font-display font-black font-[950] tracking-tight bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600 bg-clip-text text-transparent leading-[1.2] sm:leading-[1.15] pt-0.5 block overflow-visible [text-shadow:_0_0.5px_0_rgba(37,99,235,0.2)]">
|
|
Create Impossible
|
|
</div>
|
|
</div>
|
|
|
|
{/* Subtitle - reduced by 1 */}
|
|
<BlurFade delay={0.16}>
|
|
<div className="space-y-3 max-w-xl mx-auto sm:mx-0">
|
|
<p className="text-sm sm:text-lg md:text-xl text-ink-2 font-body font-normal leading-relaxed text-pretty">
|
|
Turn ordinary moments into extraordinary visual art. Instant and private photo transformation right in your browser with hardware acceleration.
|
|
</p>
|
|
</div>
|
|
</BlurFade>
|
|
|
|
{/* Action Buttons: Redesigned with RainbowButton & InteractiveHoverButton */}
|
|
<BlurFade delay={0.24}>
|
|
<div className="flex flex-col sm:flex-row items-center sm:items-start justify-center sm:justify-start gap-4 pt-1">
|
|
<RainbowButton
|
|
href={primaryCtaHref}
|
|
className="w-full max-w-[280px] sm:max-w-none sm:w-auto"
|
|
>
|
|
<span>{primaryCtaLabel}</span>
|
|
<ArrowRight className="w-4 h-4 ml-1.5 inline shrink-0" aria-hidden="true" />
|
|
</RainbowButton>
|
|
|
|
<InteractiveHoverButton
|
|
text={secondaryCtaLabel}
|
|
href={secondaryCtaHref}
|
|
className="w-full max-w-[280px] sm:max-w-none sm:w-auto min-h-[50px]"
|
|
/>
|
|
</div>
|
|
</BlurFade>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|