feat: implement management folder architecture, hover-only tool sliders, grain transform animation, and prominent upload studio
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
'use client';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
const Hero3DCanvas = dynamic(
|
||||
() => import('./Hero3DCanvas').then((module) => module.Hero3DCanvas),
|
||||
{ ssr: false, loading: () => null }
|
||||
);
|
||||
|
||||
/** Loads WebGL only for wide, precise-pointer devices that have not requested reduced motion. */
|
||||
export function HeroPrism() {
|
||||
const [canRender, setCanRender] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const media = window.matchMedia('(min-width: 1024px) and (hover: hover) and (pointer: fine)');
|
||||
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
const update = () => setCanRender(media.matches && !reduced.matches);
|
||||
update();
|
||||
media.addEventListener('change', update);
|
||||
reduced.addEventListener('change', update);
|
||||
return () => {
|
||||
media.removeEventListener('change', update);
|
||||
reduced.removeEventListener('change', update);
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (!canRender) return null;
|
||||
|
||||
return <Hero3DCanvas className="h-full w-full" />;
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import { Kinetic3DText } from '@/components/ui/Kinetic3DText';
|
||||
import { ShimmerBadge } from '@/components/animate-ui/ShimmerBadge';
|
||||
import { CardBeforeAfterSlider } from '@/components/ui/CardBeforeAfterSlider';
|
||||
import { BeforeAfterSlider } from '@/components/ui/BeforeAfterSlider';
|
||||
import { NeuralGrainOverlay } from '@/components/ui/NeuralGrainOverlay';
|
||||
|
||||
interface HeroSectionProps {
|
||||
title?: any;
|
||||
@@ -48,6 +49,7 @@ export function HeroSection({
|
||||
locale = 'en',
|
||||
}: HeroSectionProps) {
|
||||
const [mobileTab, setMobileTab] = useState<'upload' | 'compare'>('upload');
|
||||
const [grainActive, setGrainActive] = useState<boolean>(true);
|
||||
const resolvedTitle = resolveLocalised(title, locale);
|
||||
const resolvedSubtitle = resolveLocalised(subtitle, locale);
|
||||
const resolvedBadge = resolveLocalised(badge, locale);
|
||||
@@ -127,29 +129,45 @@ export function HeroSection({
|
||||
<span className="text-slate-900 font-semibold">{resolvedTitle}</span>
|
||||
</nav>
|
||||
|
||||
{/* Centered Tool Header */}
|
||||
<div className="text-center max-w-3xl mx-auto mb-6 sm:mb-8">
|
||||
<div className="inline-flex items-center gap-2 rounded-full border border-blue-200/80 bg-white/80 px-3.5 py-1.5 text-[11px] font-semibold tracking-[0.14em] uppercase text-blue-800 shadow-sm backdrop-blur">
|
||||
{/* Centered Editorial Tool Header (Typography OUTSIDE cards) */}
|
||||
<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} • AI NEURAL TOOL</span>
|
||||
<span>{categoryName} • CRE NEURAL VISION 4.0</span>
|
||||
</div>
|
||||
|
||||
<h1 className="mt-3.5 text-3xl sm:text-4xl lg:text-5xl font-display font-black tracking-tight text-slate-900 leading-[1.1]">
|
||||
<h1 className="mt-4 text-3xl sm:text-5xl lg:text-6xl font-display font-black tracking-tight text-slate-900 leading-[1.08]">
|
||||
{resolvedTitle}
|
||||
</h1>
|
||||
|
||||
<p className="mt-3 text-sm sm:text-base leading-relaxed text-slate-600 max-w-2xl mx-auto">
|
||||
<p className="mt-4 text-base sm:text-lg leading-relaxed text-slate-600 max-w-2xl mx-auto">
|
||||
{resolvedSubtitle}
|
||||
</p>
|
||||
|
||||
{/* Model Specs Row Outside Cards */}
|
||||
<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" /> < 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>
|
||||
<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">
|
||||
<Sparkles className="w-3.5 h-3.5 text-indigo-600" /> Free Browser Trial
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Intelligent Mobile Tab Switcher (Visible ONLY on Mobile < 768px) */}
|
||||
<div className="flex md:hidden items-center justify-center mb-5">
|
||||
{/* Intelligent Mobile Tab Switcher (Visible ONLY on Mobile < 1024px) */}
|
||||
<div className="flex lg:hidden items-center justify-center mb-6">
|
||||
<div className="inline-flex rounded-2xl bg-white p-1 border border-slate-200/90 shadow-2xs">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMobileTab('upload')}
|
||||
className={`flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all ${
|
||||
className={`flex items-center gap-2 px-5 py-2.5 rounded-xl text-xs font-bold transition-all ${
|
||||
mobileTab === 'upload'
|
||||
? 'bg-blue-600 text-white shadow-sm'
|
||||
: 'text-slate-600 hover:text-slate-900'
|
||||
@@ -161,91 +179,92 @@ export function HeroSection({
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMobileTab('compare')}
|
||||
className={`flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all ${
|
||||
className={`flex items-center gap-2 px-5 py-2.5 rounded-xl text-xs font-bold transition-all ${
|
||||
mobileTab === 'compare'
|
||||
? 'bg-blue-600 text-white shadow-sm'
|
||||
: 'text-slate-600 hover:text-slate-900'
|
||||
}`}
|
||||
>
|
||||
<SlidersHorizontal className="w-3.5 h-3.5" />
|
||||
<span>Before & After</span>
|
||||
<span>Transform Result</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Intelligent Side-by-Side Tool Studio (Side-by-Side on Tablet & Desktop) */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 lg:gap-8 items-stretch max-w-6xl mx-auto" id="tool-studio">
|
||||
{/* Column 1: Live Comparison Showcase */}
|
||||
<div className={`flex flex-col ${mobileTab === 'compare' ? 'block' : 'hidden md:flex'}`}>
|
||||
<div className="flex flex-col justify-between h-full bg-white rounded-3xl p-5 sm:p-7 lg:p-8 border border-slate-900/[0.08] shadow-cream-md overflow-hidden">
|
||||
<div>
|
||||
{/* Card Header */}
|
||||
<div className="flex items-center justify-between pb-4 sm:pb-5 border-b border-slate-100">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<div className="w-8 h-8 rounded-xl bg-indigo-50 border border-indigo-200/80 flex items-center justify-center text-indigo-600">
|
||||
<Sparkles className="w-4 h-4" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-xs sm:text-sm font-display font-bold text-slate-900">
|
||||
Neural Transformation Preview
|
||||
</h3>
|
||||
<p className="text-[11px] font-mono text-slate-500">Interactive Model Result</p>
|
||||
</div>
|
||||
</div>
|
||||
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-[10px] font-mono font-semibold text-emerald-800 bg-emerald-50 border border-emerald-200/90 shadow-2xs">
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse" />
|
||||
Live Demo
|
||||
</span>
|
||||
{/* Intelligent Side-by-Side Tool Studio */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-stretch max-w-7xl mx-auto" id="tool-studio">
|
||||
{/* Column 1: Result-Focused Display Stage (Edge-to-Edge Media Focus with Neural Grain Transform Animation) */}
|
||||
<div className={`lg:col-span-7 flex flex-col ${mobileTab === 'compare' ? 'block' : 'hidden lg:flex'}`}>
|
||||
<div className="relative flex flex-col justify-between h-full rounded-3xl overflow-hidden border border-slate-900/[0.1] bg-slate-950 shadow-cinematic-3d group">
|
||||
{/* Floating Glass Top Bar */}
|
||||
<div className="absolute top-4 left-4 right-4 z-20 flex items-center justify-between pointer-events-none">
|
||||
<div className="pointer-events-auto inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-slate-900/80 backdrop-blur-md border border-white/15 text-white text-xs font-semibold shadow-md">
|
||||
<Sparkles className="w-3.5 h-3.5 text-blue-400" />
|
||||
<span>Neural Model Result</span>
|
||||
</div>
|
||||
|
||||
{/* Comparison Slider */}
|
||||
<div className="mt-5">
|
||||
<BeforeAfterSlider
|
||||
beforeUrl={primaryExample.before}
|
||||
afterUrl={primaryExample.after}
|
||||
beforeLabel="Original"
|
||||
afterLabel="CRE AI Result"
|
||||
caption={primaryExample.caption}
|
||||
aspectRatio="aspect-[4/3] sm:aspect-[16/11]"
|
||||
autoSlide={true}
|
||||
/>
|
||||
</div>
|
||||
{/* Neural Grain Synthesis Toggle */}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setGrainActive(!grainActive)}
|
||||
className="pointer-events-auto inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/90 hover:bg-white text-slate-800 text-xs font-semibold shadow-md backdrop-blur-md transition-all active:scale-95"
|
||||
title="Toggle Generative Latent Grain Synthesis"
|
||||
>
|
||||
<span className={`w-2 h-2 rounded-full ${grainActive ? 'bg-indigo-500 animate-pulse' : 'bg-slate-400'}`} />
|
||||
<span>Film Grain Transform: {grainActive ? 'ON' : 'OFF'}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{/* Model Specs Strip */}
|
||||
<div className="mt-5 pt-4 border-t border-slate-100 flex flex-wrap items-center justify-between gap-3 text-xs text-slate-500 font-mono">
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<Check className="w-3.5 h-3.5 text-blue-600" /> Lossless 4K preservation
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<Zap className="w-3.5 h-3.5 text-amber-500" /> Instant sub-second inference
|
||||
</span>
|
||||
</div>
|
||||
{/* The Pure Result-Focused Viewport */}
|
||||
<div className="relative flex-1 min-h-[380px] sm:min-h-[460px] overflow-hidden">
|
||||
<BeforeAfterSlider
|
||||
beforeUrl={primaryExample.before}
|
||||
afterUrl={primaryExample.after}
|
||||
beforeLabel="RAW INPUT"
|
||||
afterLabel="AI SYNTHESIZED"
|
||||
caption={primaryExample.caption}
|
||||
aspectRatio="aspect-[4/3] lg:aspect-auto lg:h-full"
|
||||
autoSlide={true}
|
||||
className="h-full"
|
||||
/>
|
||||
|
||||
{/* Mobile Jump to Upload */}
|
||||
<div className="mt-4 md:hidden">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMobileTab('upload')}
|
||||
className="w-full py-3 px-4 rounded-xl text-xs font-bold text-white bg-blue-600 hover:bg-blue-700 flex items-center justify-center gap-2 shadow-sm"
|
||||
>
|
||||
<UploadCloud className="w-4 h-4" />
|
||||
<span>Upload Your Photo Now</span>
|
||||
</button>
|
||||
</div>
|
||||
{/* Generative AI Latent Grain Transform Animation */}
|
||||
<NeuralGrainOverlay active={grainActive} intensity={0.25} />
|
||||
</div>
|
||||
|
||||
{/* Floating Bottom Hint Bar */}
|
||||
<div className="p-4 bg-slate-900/90 border-t border-white/10 flex flex-wrap items-center justify-between gap-3 text-xs text-slate-300 font-mono">
|
||||
<span className="flex items-center gap-1.5">
|
||||
<SlidersHorizontal className="w-3.5 h-3.5 text-blue-400" />
|
||||
Drag divider to inspect sub-pixel linework & textures
|
||||
</span>
|
||||
<span className="text-[11px] text-slate-400">
|
||||
High-Res Neural Synthesis
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Mobile Jump to Upload */}
|
||||
<div className="p-4 bg-slate-900 lg:hidden">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMobileTab('upload')}
|
||||
className="w-full py-3 px-4 rounded-xl text-xs font-bold text-white bg-blue-600 hover:bg-blue-700 flex items-center justify-center gap-2 shadow-sm"
|
||||
>
|
||||
<UploadCloud className="w-4 h-4" />
|
||||
<span>Upload Your Photo to Try</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Column 2: Upload Action Studio */}
|
||||
<div className={`flex flex-col ${mobileTab === 'upload' ? 'block' : 'hidden md:flex'}`}>
|
||||
{/* Column 2: Spacious, Prominent Upload Studio */}
|
||||
<div className={`lg:col-span-5 flex flex-col ${mobileTab === 'upload' ? 'block' : 'hidden lg:flex'}`}>
|
||||
<TryItWidget
|
||||
tool={tool}
|
||||
homeApp={homeApp}
|
||||
variants={variants}
|
||||
locale={locale}
|
||||
className="h-full"
|
||||
className="h-full flex flex-col justify-between"
|
||||
onSwitchToCompare={() => setMobileTab('compare')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,24 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import React, { useRef, useState } from 'react';
|
||||
import Link from 'next/link';
|
||||
import {
|
||||
Play,
|
||||
Pause,
|
||||
Volume2,
|
||||
VolumeX,
|
||||
ArrowRight,
|
||||
Sparkles,
|
||||
Image as ImageIcon,
|
||||
Video as VideoIcon,
|
||||
Layers,
|
||||
CheckCircle2
|
||||
} from 'lucide-react';
|
||||
import { ShimmerBadge } from '@/components/animate-ui/ShimmerBadge';
|
||||
import { SpotlightCard } from '@/components/animate-ui/SpotlightCard';
|
||||
import { BorderBeam } from '@/components/animate-ui/BorderBeam';
|
||||
import { MotionTextReveal } from '@/components/animate-ui/MotionTextReveal';
|
||||
import { AnimatedGradientText } from '@/components/animate-ui/AnimatedGradientText';
|
||||
import { ArrowRight, Image as ImageIcon, Play, Video } from 'lucide-react';
|
||||
|
||||
export interface MediaItem {
|
||||
id: string;
|
||||
@@ -43,94 +24,28 @@ interface MediaShowcaseProps {
|
||||
items?: MediaItem[];
|
||||
}
|
||||
|
||||
const DEFAULT_MEDIA_ITEMS: MediaItem[] = [
|
||||
{
|
||||
id: 'video-retouch-reel',
|
||||
type: 'video',
|
||||
title: '4K Studio Model Portrait Session',
|
||||
category: 'VIDEO ENHANCEMENT',
|
||||
badge: '4K 60FPS VIDEO',
|
||||
description: 'Continuous temporal facial neural retouching across dynamic video frames with zero flicker.',
|
||||
videoUrl: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4',
|
||||
poster: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=800&auto=format&fit=crop&q=80',
|
||||
link: '/tools/blemish-remover',
|
||||
tag: 'Temporal Retouching',
|
||||
},
|
||||
{
|
||||
id: 'hair-alpha-photo',
|
||||
type: 'photo',
|
||||
title: 'Fine Flyaway Strand Alpha Extraction',
|
||||
category: 'HAIR CUTOUT',
|
||||
badge: 'ULTRA HD PHOTO',
|
||||
description: 'Microscopic hair fiber separation preserving semi-transparent boundary details for editorial covers.',
|
||||
image: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=800&auto=format&fit=crop&q=80',
|
||||
link: '/tools/background-remover',
|
||||
tag: '0.02px Edge Trim',
|
||||
},
|
||||
{
|
||||
id: 'restoration-comparison',
|
||||
type: 'comparison',
|
||||
title: '4K Generative Facial Restoration',
|
||||
category: 'SUPER-RESOLUTION',
|
||||
badge: 'SIDE-BY-SIDE',
|
||||
description: 'Deep neural priors reconstruct iris sharpness and realistic skin pores from compressed source photos.',
|
||||
beforeUrl: 'https://images.unsplash.com/photo-1544005313-94ddf0286df2?w=800&auto=format&fit=crop&q=80',
|
||||
afterUrl: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=800&auto=format&fit=crop&q=80',
|
||||
link: '/tools/photo-enhancer',
|
||||
tag: 'Iris Sharpness',
|
||||
},
|
||||
];
|
||||
|
||||
export function MediaShowcaseSection({
|
||||
title = 'Visual Media & Transformation Reel',
|
||||
badge = 'CURATED CREATIVE GALLERY',
|
||||
subtitle = 'Explore high-resolution photography, 4K video clips, and creative transformations produced by CRE neural tools.',
|
||||
items = DEFAULT_MEDIA_ITEMS,
|
||||
subtitle = 'Explore high-resolution photography, video, and creative transformations produced by CRE neural tools.',
|
||||
items = [],
|
||||
}: MediaShowcaseProps) {
|
||||
const mediaItems = items && items.length > 0 ? items : DEFAULT_MEDIA_ITEMS;
|
||||
|
||||
return (
|
||||
<section className="py-20 sm:py-24 bg-[#F5F2EB] border-y border-slate-900/[0.08] relative overflow-hidden">
|
||||
{/* Ambient background glow */}
|
||||
<div className="absolute top-1/4 right-1/4 w-96 h-96 bg-blue-500/[0.03] rounded-full blur-3xl pointer-events-none" />
|
||||
|
||||
<div className="w-full max-w-[1640px] 2xl:max-w-[1720px] mx-auto px-4 sm:px-6 lg:px-8 xl:px-10 relative z-10">
|
||||
{/* Section Header */}
|
||||
<div className="flex flex-col md:flex-row md:items-end justify-between gap-4 mb-12 pb-6 border-b border-slate-900/[0.08]">
|
||||
<div>
|
||||
<div className="mb-2.5">
|
||||
<ShimmerBadge>
|
||||
<Sparkles className="w-3.5 h-3.5 text-blue-600" />
|
||||
<span>{badge}</span>
|
||||
</ShimmerBadge>
|
||||
</div>
|
||||
<h3 className="text-2xl sm:text-3xl lg:text-4xl font-display font-black text-slate-900 tracking-tight">
|
||||
<MotionTextReveal text="Visual Media &" className="text-slate-900 inline" />{' '}
|
||||
<AnimatedGradientText className="font-black">
|
||||
Transformation Reel
|
||||
</AnimatedGradientText>
|
||||
</h3>
|
||||
<p className="text-xs sm:text-sm text-slate-600 mt-1 max-w-2xl font-normal">
|
||||
{subtitle}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3 self-start md:self-end">
|
||||
<Link
|
||||
href="/#studio-suite"
|
||||
className="text-xs font-mono font-bold text-blue-700 bg-white hover:bg-blue-50 border border-slate-200 px-4 py-2 rounded-full flex items-center gap-1.5 shadow-sm transition-all duration-200 hover:-translate-y-0.5"
|
||||
>
|
||||
<span>Explore The Suite</span>
|
||||
<ArrowRight className="w-3.5 h-3.5" />
|
||||
</Link>
|
||||
<section className="relative overflow-hidden border-y border-slate-900/[0.08] bg-[#F5F2EB] py-16 sm:py-20 lg:py-24">
|
||||
<div className="mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="mb-9 flex flex-col gap-4 border-b border-slate-900/[0.08] pb-7 sm:mb-12 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div className="max-w-2xl">
|
||||
<p className="eyebrow">{badge}</p>
|
||||
<h2 className="mt-3 text-3xl font-display font-bold tracking-tight text-slate-900 sm:text-4xl">{title}</h2>
|
||||
<p className="mt-3 text-sm leading-relaxed text-slate-600 sm:text-base">{subtitle}</p>
|
||||
</div>
|
||||
<Link href="/#studio-suite" className="button-secondary shrink-0">
|
||||
Explore the suite <ArrowRight className="h-4 w-4" />
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{/* Dynamic Media Grid: Video Cards, Photo Showcases & Side-by-Side Frames */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 sm:gap-8">
|
||||
{mediaItems.map((item) => (
|
||||
<MediaCard key={item.id} item={item} />
|
||||
))}
|
||||
<div className="grid gap-5 md:grid-cols-3">
|
||||
{items.map((item) => <MediaCard key={item.id} item={item} />)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -138,147 +53,50 @@ export function MediaShowcaseSection({
|
||||
}
|
||||
|
||||
function MediaCard({ item }: { item: MediaItem }) {
|
||||
const videoRef = useRef<HTMLVideoElement>(null);
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [isMuted, setIsMuted] = useState(true);
|
||||
|
||||
const togglePlay = () => {
|
||||
if (!videoRef.current) return;
|
||||
if (isPlaying) {
|
||||
videoRef.current.pause();
|
||||
setIsPlaying(false);
|
||||
} else {
|
||||
videoRef.current.play().catch(() => {});
|
||||
setIsPlaying(true);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleMute = () => {
|
||||
if (!videoRef.current) return;
|
||||
videoRef.current.muted = !isMuted;
|
||||
setIsMuted(!isMuted);
|
||||
};
|
||||
const image = item.image || item.poster || item.beforeUrl;
|
||||
|
||||
return (
|
||||
<SpotlightCard className="group bg-white rounded-3xl p-5 sm:p-6 border border-slate-900/[0.08] shadow-sm hover:shadow-2xl hover:border-blue-400/80 hover:-translate-y-1.5 transition-all duration-300 flex flex-col justify-between relative">
|
||||
<BorderBeam duration={12} size={250} borderWidth={1.5} colorFrom="#3b82f6" colorTo="#a855f7" />
|
||||
|
||||
<div>
|
||||
{/* Card Header Tag */}
|
||||
<div className="flex items-center justify-between gap-2 mb-4 pb-3 border-b border-slate-100">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-[10px] font-mono font-bold uppercase tracking-wider text-blue-700 bg-blue-50 border border-blue-200/80 px-2.5 py-0.5 rounded-full flex items-center gap-1">
|
||||
{item.type === 'video' ? <VideoIcon className="w-3 h-3 text-blue-600" /> : <ImageIcon className="w-3 h-3 text-blue-600" />}
|
||||
<span>{item.category}</span>
|
||||
</span>
|
||||
</div>
|
||||
{item.badge && (
|
||||
<span className="text-[10px] font-mono font-bold text-slate-700 bg-slate-100 border border-slate-200 px-2.5 py-0.5 rounded-full">
|
||||
{item.badge}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Media Viewport Container */}
|
||||
<div className="relative aspect-[16/10] rounded-2xl overflow-hidden mb-5 bg-slate-950 border border-slate-200 shadow-inner group/media">
|
||||
{item.type === 'video' && item.videoUrl ? (
|
||||
/* HTML5 Video Player Viewport */
|
||||
<div className="relative w-full h-full">
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={item.videoUrl}
|
||||
poster={item.poster}
|
||||
loop
|
||||
muted={isMuted}
|
||||
playsInline
|
||||
className="w-full h-full object-cover"
|
||||
onPlay={() => setIsPlaying(true)}
|
||||
onPause={() => setIsPlaying(false)}
|
||||
/>
|
||||
|
||||
{/* Video Controls Overlay */}
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent flex items-end justify-between p-3.5 pointer-events-none">
|
||||
<button
|
||||
onClick={togglePlay}
|
||||
aria-label={isPlaying ? 'Pause video' : 'Play video'}
|
||||
className="pointer-events-auto w-9 h-9 rounded-full bg-white/95 text-slate-900 shadow-lg flex items-center justify-center hover:scale-110 active:scale-95 transition-all"
|
||||
>
|
||||
{isPlaying ? <Pause className="w-4 h-4 fill-slate-900" /> : <Play className="w-4 h-4 fill-slate-900 ml-0.5" />}
|
||||
</button>
|
||||
|
||||
<div className="flex items-center gap-2 pointer-events-auto">
|
||||
<button
|
||||
onClick={toggleMute}
|
||||
aria-label={isMuted ? 'Unmute' : 'Mute'}
|
||||
className="w-8 h-8 rounded-full bg-black/60 text-white backdrop-blur-md flex items-center justify-center hover:bg-black/80 transition-colors"
|
||||
>
|
||||
{isMuted ? <VolumeX className="w-3.5 h-3.5" /> : <Volume2 className="w-3.5 h-3.5" />}
|
||||
</button>
|
||||
<span className="px-2 py-0.5 rounded bg-black/70 backdrop-blur-md text-[9px] font-mono font-bold text-white">
|
||||
4K VIDEO
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : item.type === 'comparison' && item.beforeUrl && item.afterUrl ? (
|
||||
/* Clean Side-by-Side Dual Split Frame */
|
||||
<div className="grid grid-cols-2 h-full w-full">
|
||||
<div className="relative h-full overflow-hidden border-r border-white/20">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={item.beforeUrl} alt="Original source" className="h-full w-full object-cover" />
|
||||
<span className="absolute bottom-2 left-2 bg-black/80 backdrop-blur-md px-2 py-0.5 rounded text-[9px] font-mono font-bold text-white shadow-sm">
|
||||
RAW INPUT
|
||||
</span>
|
||||
</div>
|
||||
<div className="relative h-full overflow-hidden">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={item.afterUrl} alt="CRE Reconstructed result" className="h-full w-full object-cover group-hover/media:scale-105 transition-transform duration-700" />
|
||||
<span className="absolute bottom-2 right-2 bg-blue-600/90 backdrop-blur-md px-2 py-0.5 rounded text-[9px] font-mono font-bold text-white shadow-sm">
|
||||
CRE AI
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
/* High-Res Photo Showcase Viewport */
|
||||
<div className="relative w-full h-full">
|
||||
<article className="group overflow-hidden rounded-3xl border border-slate-900/[0.08] bg-white shadow-cream-sm transition-shadow duration-300 hover:shadow-cream-md">
|
||||
<div className="relative aspect-[16/10] overflow-hidden bg-slate-100">
|
||||
{item.type === 'video' && item.videoUrl ? (
|
||||
<video controls preload="none" playsInline poster={item.poster} className="h-full w-full object-cover" aria-label={item.title}>
|
||||
<source src={item.videoUrl} type="video/mp4" />
|
||||
</video>
|
||||
) : item.type === 'comparison' && item.beforeUrl && item.afterUrl ? (
|
||||
<div className="grid h-full grid-cols-2">
|
||||
<figure className="relative overflow-hidden border-r border-white/30">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
src={item.image || item.poster || item.beforeUrl || 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=800&auto=format&fit=crop&q=80'}
|
||||
alt={item.title}
|
||||
className="w-full h-full object-cover group-hover/media:scale-105 transition-transform duration-700"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/60 via-transparent to-transparent pointer-events-none" />
|
||||
{item.tag && (
|
||||
<span className="absolute bottom-3 left-3 bg-white/90 backdrop-blur-md px-2.5 py-1 rounded-lg text-[10px] font-mono font-bold text-slate-800 shadow-sm">
|
||||
{item.tag}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Card Copy */}
|
||||
<h4 className="text-lg sm:text-xl font-display font-bold text-slate-900 group-hover:text-blue-600 transition-colors tracking-tight mb-2">
|
||||
{item.title}
|
||||
</h4>
|
||||
<p className="text-xs sm:text-sm text-slate-600 font-normal leading-relaxed mb-4">
|
||||
{item.description}
|
||||
</p>
|
||||
<img src={item.beforeUrl} alt="Original image" loading="lazy" decoding="async" className="h-full w-full object-cover" />
|
||||
<figcaption className="media-label left-2">Before</figcaption>
|
||||
</figure>
|
||||
<figure className="relative overflow-hidden">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={item.afterUrl} alt="Enhanced image" loading="lazy" decoding="async" className="h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.03]" />
|
||||
<figcaption className="media-label right-2">After</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
) : image ? (
|
||||
<>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={image} alt={item.title} loading="lazy" decoding="async" className="h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.03]" />
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/45 to-transparent" />
|
||||
</>
|
||||
) : null}
|
||||
<span className="absolute left-3 top-3 inline-flex items-center gap-1.5 rounded-full bg-white/94 px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wide text-slate-700 shadow-sm">
|
||||
{item.type === 'video' ? <Video className="h-3 w-3 text-blue-700" /> : <ImageIcon className="h-3 w-3 text-blue-700" />}
|
||||
{item.category}
|
||||
</span>
|
||||
{item.type === 'video' && <Play className="pointer-events-none absolute bottom-3 right-3 h-8 w-8 rounded-full bg-white/90 p-2 text-slate-900 shadow-sm" />}
|
||||
</div>
|
||||
|
||||
{/* Action Link */}
|
||||
<div className="pt-3 border-t border-slate-100 flex items-center justify-between">
|
||||
<span className="text-[11px] font-mono text-slate-400">
|
||||
Studio Preset
|
||||
</span>
|
||||
<Link
|
||||
href={item.link}
|
||||
className="inline-flex items-center gap-1.5 text-xs font-mono font-bold text-blue-600 group-hover:text-blue-700 group-hover:translate-x-0.5 transition-all"
|
||||
>
|
||||
<span>Open Tool</span>
|
||||
<ArrowRight className="w-3.5 h-3.5" />
|
||||
<div className="p-5">
|
||||
{item.tag && <p className="text-xs font-semibold uppercase tracking-[0.12em] text-blue-700">{item.tag}</p>}
|
||||
<h3 className="mt-2 text-xl font-display font-bold tracking-tight text-slate-900">{item.title}</h3>
|
||||
<p className="mt-2 text-sm leading-relaxed text-slate-600">{item.description}</p>
|
||||
<Link href={item.link} className="mt-5 inline-flex items-center gap-1.5 text-sm font-semibold text-blue-700 transition-transform hover:translate-x-0.5">
|
||||
Open tool <ArrowRight className="h-4 w-4" />
|
||||
</Link>
|
||||
</div>
|
||||
</SpotlightCard>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { NumberCounter } from '@/components/animate-ui/NumberCounter';
|
||||
import { AnimatedGradientText } from '@/components/animate-ui/AnimatedGradientText';
|
||||
|
||||
interface StatsSectionProps {
|
||||
items?: Array<{
|
||||
@@ -19,14 +15,12 @@ export function StatsSection({ items = [] }: StatsSectionProps) {
|
||||
<div className="w-full max-w-[1640px] 2xl:max-w-[1720px] mx-auto px-4 sm:px-6 lg:px-8 xl:px-10 relative z-10">
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-8 text-center divide-y md:divide-y-0 md:divide-x divide-slate-200">
|
||||
{items.map((stat, idx) => (
|
||||
<div
|
||||
<div
|
||||
key={idx}
|
||||
className="pt-4 md:pt-0 space-y-2 group hover:-translate-y-1 transition-all duration-300"
|
||||
className="pt-4 md:pt-0 space-y-2"
|
||||
>
|
||||
<div className="text-4xl sm:text-5xl lg:text-6xl font-display font-black tracking-tight inline-block">
|
||||
<AnimatedGradientText duration={5}>
|
||||
<NumberCounter value={stat.value} duration={1.8} />
|
||||
</AnimatedGradientText>
|
||||
<div className="text-4xl sm:text-5xl lg:text-6xl font-display font-black tracking-tight text-gradient-brand">
|
||||
{stat.value}
|
||||
</div>
|
||||
<p className="text-xs sm:text-sm font-mono uppercase tracking-wider text-slate-600 font-bold block">
|
||||
{stat.label}
|
||||
|
||||
@@ -196,7 +196,7 @@ export function TryItWidget({
|
||||
<div className="mt-7">
|
||||
{status === 'idle' && (
|
||||
<div className="space-y-6">
|
||||
{/* Drag & Drop Upload Zone */}
|
||||
{/* Drag & Drop Upload Zone - Prominent & Spacious */}
|
||||
<div
|
||||
onDrop={handleDrop}
|
||||
onDragOver={(e) => {
|
||||
@@ -214,10 +214,10 @@ export function TryItWidget({
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-label="Upload photo to edit"
|
||||
className={`border-2 border-dashed rounded-3xl p-8 sm:p-12 text-center cursor-pointer transition-all duration-300 group ${
|
||||
className={`border-2 border-dashed rounded-3xl p-8 sm:p-12 lg:p-14 text-center cursor-pointer transition-all duration-300 min-h-[300px] sm:min-h-[340px] flex flex-col items-center justify-center group ${
|
||||
isDragOver
|
||||
? 'border-blue-500 bg-blue-50/60 scale-[1.01]'
|
||||
: 'border-slate-300 hover:border-blue-500 bg-slate-50/50 hover:bg-blue-50/20'
|
||||
? 'border-blue-500 bg-blue-50/70 scale-[1.01] shadow-lg shadow-blue-500/10'
|
||||
: 'border-slate-300/90 hover:border-blue-500 bg-gradient-to-b from-blue-50/30 via-white to-slate-50/40 hover:bg-blue-50/20'
|
||||
}`}
|
||||
>
|
||||
<input
|
||||
@@ -227,20 +227,20 @@ export function TryItWidget({
|
||||
className="hidden"
|
||||
onChange={(e) => e.target.files?.[0] && handleFileChange(e.target.files[0])}
|
||||
/>
|
||||
<div className="w-16 h-16 sm:w-20 sm:h-20 mx-auto mb-4 rounded-3xl bg-blue-50 border border-blue-100 flex items-center justify-center text-blue-600 group-hover:scale-110 transition-all duration-300 shadow-sm">
|
||||
<div className="w-16 h-16 sm:w-20 sm:h-20 mx-auto mb-5 rounded-3xl bg-blue-50 border border-blue-200/80 flex items-center justify-center text-blue-600 group-hover:scale-110 group-hover:bg-blue-600 group-hover:text-white transition-all duration-300 shadow-sm">
|
||||
<UploadCloud className="w-8 h-8 sm:w-10 sm:h-10" />
|
||||
</div>
|
||||
|
||||
<div className="inline-flex items-center gap-2 px-6 py-3 rounded-full bg-blue-600 hover:bg-blue-700 text-white font-semibold text-sm shadow-md shadow-blue-500/20 group-hover:shadow-lg transition-all mb-3">
|
||||
<div className="inline-flex items-center gap-2.5 px-8 py-3.5 rounded-full bg-gradient-to-r from-blue-600 via-indigo-600 to-blue-700 hover:from-blue-700 hover:to-indigo-800 text-white font-bold text-sm shadow-md shadow-blue-500/25 group-hover:shadow-lg group-hover:scale-105 active:scale-95 transition-all mb-3.5">
|
||||
<UploadCloud className="w-4 h-4" />
|
||||
<span>Upload Image</span>
|
||||
</div>
|
||||
|
||||
<p className="text-sm sm:text-base font-display font-medium text-slate-700">
|
||||
or drag and drop your photo here
|
||||
<p className="text-sm sm:text-base font-display font-semibold text-slate-800">
|
||||
or drag and drop your photo anywhere here
|
||||
</p>
|
||||
<p className="mt-2 text-xs font-mono text-slate-500">
|
||||
Supports JPG, PNG, WEBP up to {tool.tryIt?.limits?.maxMB || 12}MB • High-res 4K processing
|
||||
Supports JPG, PNG, WEBP up to {tool.tryIt?.limits?.maxMB || 12}MB • Lossless 4K processing
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import React, { useRef, useEffect, useCallback } from 'react';
|
||||
import React, { useRef, useState, useEffect, useCallback } from 'react';
|
||||
|
||||
interface CardBeforeAfterSliderProps {
|
||||
beforeUrl: string;
|
||||
@@ -18,9 +18,11 @@ export function CardBeforeAfterSlider({
|
||||
aspectRatio = 'aspect-[16/10]',
|
||||
}: CardBeforeAfterSliderProps) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const isHoveredRef = useRef(false);
|
||||
const isDraggingRef = useRef(false);
|
||||
const isInteractedRef = useRef(false);
|
||||
const animIdRef = useRef<number>(0);
|
||||
const [isHoveredState, setIsHoveredState] = useState(false);
|
||||
|
||||
const setSplit = useCallback((percent: number) => {
|
||||
const clamped = Math.max(3, Math.min(97, percent));
|
||||
@@ -41,51 +43,50 @@ export function CardBeforeAfterSlider({
|
||||
[setSplit]
|
||||
);
|
||||
|
||||
// Gentle auto-sliding animation until the user actively clicks
|
||||
// Smooth, gentle before/after slide sweep: RUNS ONLY ON HOVER OVER THIS SPECIFIC CARD!
|
||||
useEffect(() => {
|
||||
let startTime: number | null = null;
|
||||
let isVisible = true;
|
||||
|
||||
const animate = (time: number) => {
|
||||
if (!isVisible) return;
|
||||
if (!isInteractedRef.current) {
|
||||
// ONLY animate when actively hovered and not manually dragging
|
||||
if (isHoveredRef.current && !isDraggingRef.current && !isInteractedRef.current) {
|
||||
if (startTime === null) startTime = time;
|
||||
const elapsed = time - startTime;
|
||||
// Smooth sine wave between 28% and 72% over a 3.4-second cycle
|
||||
const currentSplit = 50 + 22 * Math.sin((elapsed / 3400) * 2 * Math.PI);
|
||||
// Calm, luxurious 3.6-second oscillation between 28% and 72%
|
||||
const currentSplit = 50 + 22 * Math.sin((elapsed / 3600) * 2 * Math.PI);
|
||||
setSplit(currentSplit);
|
||||
animIdRef.current = requestAnimationFrame(animate);
|
||||
}
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
isVisible = entry.isIntersecting;
|
||||
if (isVisible && !isInteractedRef.current) {
|
||||
startTime = null;
|
||||
animIdRef.current = requestAnimationFrame(animate);
|
||||
} else {
|
||||
cancelAnimationFrame(animIdRef.current);
|
||||
}
|
||||
},
|
||||
{ threshold: 0.05 }
|
||||
);
|
||||
|
||||
if (containerRef.current) {
|
||||
observer.observe(containerRef.current);
|
||||
}
|
||||
|
||||
if (!isInteractedRef.current) {
|
||||
if (isHoveredState && !isInteractedRef.current) {
|
||||
startTime = null;
|
||||
animIdRef.current = requestAnimationFrame(animate);
|
||||
} else {
|
||||
cancelAnimationFrame(animIdRef.current);
|
||||
}
|
||||
|
||||
return () => {
|
||||
cancelAnimationFrame(animIdRef.current);
|
||||
observer.disconnect();
|
||||
};
|
||||
}, [isHoveredState, setSplit]);
|
||||
|
||||
const handleMouseEnter = useCallback(() => {
|
||||
isHoveredRef.current = true;
|
||||
setIsHoveredState(true);
|
||||
}, []);
|
||||
|
||||
const handleMouseLeave = useCallback(() => {
|
||||
isHoveredRef.current = false;
|
||||
isDraggingRef.current = false;
|
||||
setIsHoveredState(false);
|
||||
// Smoothly return to clean 50% rest state
|
||||
if (!isInteractedRef.current) {
|
||||
setSplit(50);
|
||||
}
|
||||
}, [setSplit]);
|
||||
|
||||
// Click & Drag handlers: DOES NOT WORK ON HOVER - REQUIRES CURSOR CLICK!
|
||||
// Click & Drag handlers: manual inspection when user clicks or drags
|
||||
const handleMouseDown = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
@@ -138,6 +139,8 @@ export function CardBeforeAfterSlider({
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
onMouseDown={handleMouseDown}
|
||||
onTouchStart={handleTouchStart}
|
||||
onTouchMove={handleTouchMove}
|
||||
@@ -147,7 +150,7 @@ export function CardBeforeAfterSlider({
|
||||
aria-valuenow={50}
|
||||
tabIndex={0}
|
||||
style={{ '--split': '50%' } as React.CSSProperties}
|
||||
className={`relative w-full ${aspectRatio} overflow-hidden cursor-ew-resize select-none bg-slate-900 group/slider`}
|
||||
className={`relative w-full ${aspectRatio} overflow-hidden cursor-ew-resize select-none bg-slate-900 group/slider transition-shadow duration-300 hover:shadow-cream-lg`}
|
||||
>
|
||||
{/* Layer 1: After Image (Transformed Neural Result) */}
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
@@ -198,9 +201,9 @@ export function CardBeforeAfterSlider({
|
||||
{afterLabel}
|
||||
</div>
|
||||
|
||||
{/* Click / Drag Hint */}
|
||||
<div className="pointer-events-none absolute top-2.5 right-2.5 z-20 rounded-full bg-white/90 px-2.5 py-0.5 text-[9px] font-semibold text-slate-700 shadow-sm backdrop-blur-xs opacity-0 group-hover/slider:opacity-100 transition-opacity">
|
||||
Click & drag to compare
|
||||
{/* Hover & Slide Hint */}
|
||||
<div className="pointer-events-none absolute top-2.5 right-2.5 z-20 rounded-full bg-white/92 px-2.5 py-0.5 text-[9px] font-semibold text-slate-700 shadow-sm backdrop-blur-xs opacity-0 group-hover/slider:opacity-100 transition-opacity">
|
||||
Drag to inspect
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
'use client';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
const Cinematic3DComparison = dynamic(
|
||||
() => import('./Cinematic3DComparison').then((module) => module.Cinematic3DComparison),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
interface DeferredComparisonProps {
|
||||
beforeUrl: string;
|
||||
afterUrl: string;
|
||||
beforeLabel?: string;
|
||||
afterLabel?: string;
|
||||
aspectRatio?: string;
|
||||
}
|
||||
|
||||
/** A fast static preview that upgrades to the comparison control near the viewport. */
|
||||
export function DeferredComparison({ beforeUrl, afterUrl, beforeLabel, afterLabel, aspectRatio = 'aspect-[4/3]' }: DeferredComparisonProps) {
|
||||
const previewRef = useRef<HTMLDivElement>(null);
|
||||
const [active, setActive] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const element = previewRef.current;
|
||||
if (!element) return;
|
||||
const observer = new IntersectionObserver(([entry]) => {
|
||||
if (!entry.isIntersecting) return;
|
||||
setActive(true);
|
||||
observer.disconnect();
|
||||
}, { rootMargin: '240px 0px' });
|
||||
observer.observe(element);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
if (active) {
|
||||
return <Cinematic3DComparison beforeUrl={beforeUrl} afterUrl={afterUrl} beforeLabel={beforeLabel} afterLabel={afterLabel} aspectRatio={aspectRatio} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={previewRef} className={`relative overflow-hidden bg-slate-100 ${aspectRatio}`}>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={afterUrl} alt="AI-enhanced preview" loading="lazy" decoding="async" className="h-full w-full object-cover" />
|
||||
<span className="absolute bottom-3 left-3 rounded-full bg-white/92 px-3 py-1 text-xs font-semibold text-slate-800 shadow-sm">Drag to compare</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { Menu, X, Smartphone, Layers, ArrowUpRight } from 'lucide-react';
|
||||
@@ -16,8 +16,6 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
|
||||
const [isScrolled, setIsScrolled] = useState(false);
|
||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||
const pathname = usePathname();
|
||||
const navRef = useRef<HTMLDivElement>(null);
|
||||
const glintRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
@@ -36,41 +34,13 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
|
||||
return () => document.removeEventListener('keydown', closeOnEscape);
|
||||
}, [mobileMenuOpen]);
|
||||
|
||||
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!glintRef.current) return;
|
||||
const rect = e.currentTarget.getBoundingClientRect();
|
||||
const x = ((e.clientX - rect.left) / rect.width) * 100;
|
||||
const y = ((e.clientY - rect.top) / rect.height) * 100;
|
||||
glintRef.current.style.opacity = '0.6';
|
||||
glintRef.current.style.background = `radial-gradient(ellipse 260px 80px at ${x.toFixed(1)}% ${y.toFixed(1)}%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.08) 40%, transparent 70%)`;
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (glintRef.current) {
|
||||
glintRef.current.style.opacity = '0';
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="fixed top-3 sm:top-5 left-0 right-0 z-50 px-3 sm:px-6 lg:px-8 pointer-events-none transition-all duration-300">
|
||||
<div
|
||||
ref={navRef}
|
||||
onMouseMove={handleMouseMove}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
className={`relative max-w-6xl mx-auto liquid-glass-nav rounded-2xl sm:rounded-[22px] px-3.5 sm:px-6 py-2.5 sm:py-3 flex items-center justify-between transition-all duration-300 pointer-events-auto ${
|
||||
isScrolled ? 'nav-scrolled' : ''
|
||||
}`}
|
||||
>
|
||||
{/* Optical Glass Caustic Reflection Sheen */}
|
||||
<div className="liquid-caustic-refraction" aria-hidden="true" />
|
||||
|
||||
{/* Dynamic Specular Caustic Glint - Direct DOM, 0 React re-renders */}
|
||||
<div
|
||||
ref={glintRef}
|
||||
className="absolute inset-0 pointer-events-none transition-opacity duration-300 z-[2] opacity-0"
|
||||
/>
|
||||
|
||||
{/* Foreground Content: 100% Crisp, High-Contrast, Rock-Solid Static (Zero Wobble) */}
|
||||
<div className="relative z-20 flex items-center justify-between w-full">
|
||||
{/* Brand Logo */}
|
||||
<div className="relative z-20">
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
interface NeuralGrainOverlayProps {
|
||||
intensity?: number;
|
||||
active?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function NeuralGrainOverlay({
|
||||
intensity = 0.22,
|
||||
active = true,
|
||||
className = '',
|
||||
}: NeuralGrainOverlayProps) {
|
||||
if (!active) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className={`pointer-events-none absolute inset-0 z-10 overflow-hidden mix-blend-overlay ${className}`}
|
||||
style={{ opacity: intensity }}
|
||||
>
|
||||
{/* High-frequency animated SVG noise filter */}
|
||||
<svg className="absolute inset-0 h-full w-full opacity-65">
|
||||
<filter id="neural-grain-noise">
|
||||
<feTurbulence
|
||||
type="fractalNoise"
|
||||
baseFrequency="0.75"
|
||||
numOctaves="3"
|
||||
stitchTiles="stitch"
|
||||
>
|
||||
<animate
|
||||
attributeName="seed"
|
||||
from="1"
|
||||
to="60"
|
||||
dur="1.8s"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</feTurbulence>
|
||||
<feColorMatrix type="saturate" values="0" />
|
||||
</filter>
|
||||
<rect width="100%" height="100%" filter="url(#neural-grain-noise)" />
|
||||
</svg>
|
||||
|
||||
{/* Latent Neural Scan Sweep Beam */}
|
||||
<div className="absolute inset-y-0 w-28 bg-gradient-to-r from-transparent via-blue-400/25 to-transparent animate-neural-sweep pointer-events-none" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,20 +1,36 @@
|
||||
'use client';
|
||||
|
||||
import { motion, useReducedMotion } from 'framer-motion';
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
/** Subtle, viewport-triggered entrance shared by every JSON-driven page section. */
|
||||
/** Lightweight progressive enhancement: content is visible before JavaScript runs. */
|
||||
export function SectionEntrance({ children, id }: { children: React.ReactNode; id: string }) {
|
||||
const reduceMotion = useReducedMotion();
|
||||
const sectionRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const element = sectionRef.current;
|
||||
if (!element || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
if (!entry.isIntersecting) return;
|
||||
element.dataset.revealed = 'true';
|
||||
observer.disconnect();
|
||||
},
|
||||
{ rootMargin: '0px 0px -6% 0px', threshold: 0.03 }
|
||||
);
|
||||
|
||||
observer.observe(element);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
<div
|
||||
ref={sectionRef}
|
||||
data-section-entrance={id}
|
||||
initial={reduceMotion ? false : { opacity: 0, y: 14 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: 0.08, margin: '0px 0px -24px 0px' }}
|
||||
transition={{ duration: 0.42, ease: [0.22, 1, 0.36, 1] }}
|
||||
data-revealed="false"
|
||||
className={id === 'hero-section' ? 'section-shell section-shell--hero' : 'section-shell'}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user