feat(homepage): add travelling image pipeline to how-it-works, round our-tools corners, organize media, and clean hero header

This commit is contained in:
2026-11-05 15:25:23 +05:30
parent b00566fb99
commit 8715e23be0
41 changed files with 407 additions and 68 deletions
+350 -14
View File
@@ -1,6 +1,6 @@
'use client';
import React from 'react';
import React, { useState, useEffect, useRef } from 'react';
import {
Sparkles,
Wand2,
@@ -12,7 +12,10 @@ import {
PartyPopper,
Camera,
Star,
CheckCircle2
CheckCircle2,
Play,
Pause,
RotateCcw
} from 'lucide-react';
import { TextAnimate } from '@/components/magicui/text-animate';
@@ -27,8 +30,65 @@ export function HowItWorks3DSection({
badge = 'SUPER EASY AS 1-2-3',
subtitle = 'No complicated buttons or confusing settings. Just three friendly steps from your photo to pure magic!',
}: HowItWorksSectionProps) {
const [activeStep, setActiveStep] = useState<1 | 2 | 3>(1);
const [isPaused, setIsPaused] = useState(false);
const sectionRef = useRef<HTMLDivElement>(null);
// Auto-advance travelling image through steps with smart offscreen pause
useEffect(() => {
if (isPaused) return;
const section = sectionRef.current;
let isVisible = true;
let timer: any = null;
const runTimer = () => {
if (timer) clearInterval(timer);
timer = setInterval(() => {
if (isVisible && !document.hidden && !isPaused) {
setActiveStep((prev) => (prev === 3 ? 1 : ((prev + 1) as 1 | 2 | 3)));
}
}, 3400);
};
const observer = new IntersectionObserver(
([entry]) => {
isVisible = entry.isIntersecting;
if (isVisible) {
runTimer();
} else if (timer) {
clearInterval(timer);
timer = null;
}
},
{ threshold: 0.1 }
);
if (section) observer.observe(section);
runTimer();
const handleVisibility = () => {
if (document.hidden && timer) {
clearInterval(timer);
timer = null;
} else if (isVisible && !isPaused) {
runTimer();
}
};
document.addEventListener('visibilitychange', handleVisibility);
return () => {
if (timer) clearInterval(timer);
observer.disconnect();
document.removeEventListener('visibilitychange', handleVisibility);
};
}, [isPaused]);
return (
<section id="how-it-works" className="py-20 sm:py-28 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
<section
id="how-it-works"
ref={sectionRef}
className="py-20 sm:py-28 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]"
>
{/* Playful Ambient Background Glows */}
<div
className="absolute inset-0 pointer-events-none -z-10"
@@ -37,7 +97,7 @@ export function HowItWorks3DSection({
}}
/>
<div className="max-w-[1640px] mx-auto space-y-14">
<div className="max-w-[1640px] mx-auto space-y-12 sm:space-y-14">
{/* Playful & Warm Section Header */}
<div className="text-center max-w-3xl mx-auto space-y-4">
<div className="inline-flex items-center gap-2 px-4 py-1.5 rounded-full text-xs font-display font-bold tracking-wider uppercase text-amber-900 bg-amber-100/80 border border-amber-300 shadow-sm">
@@ -58,16 +118,24 @@ export function HowItWorks3DSection({
</p>
</div>
{/* 3 Childhood & Friendly Horizontal Story Cards */}
{/* 1. Dynamic Travelling Image Pipeline Animation */}
<TravellingTransformationPipeline
activeStep={activeStep}
onSelectStep={setActiveStep}
isPaused={isPaused}
onTogglePause={() => setIsPaused(!isPaused)}
/>
{/* 2. Three Childhood & Friendly Horizontal Story Cards */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 sm:gap-8 items-stretch">
{/* Step 1: Upload Your Picture */}
<StepUploadCard />
<StepUploadCard isActive={activeStep === 1} />
{/* Step 2: The Magic Happens */}
<StepMagicCard />
<StepMagicCard isActive={activeStep === 2} />
{/* Step 3: Tada! Download & Enjoy */}
<StepTadaCard />
<StepTadaCard isActive={activeStep === 3} />
</div>
{/* Cheerful Bottom Reassurance Banner */}
@@ -99,16 +167,274 @@ export function HowItWorks3DSection({
);
}
// -------------------------------------------------------------
// Travelling Image Transformation Pipeline
// -------------------------------------------------------------
function TravellingTransformationPipeline({
activeStep,
onSelectStep,
isPaused,
onTogglePause,
}: {
activeStep: 1 | 2 | 3;
onSelectStep: (step: 1 | 2 | 3) => void;
isPaused: boolean;
onTogglePause: () => void;
}) {
return (
<div className="rounded-[32px] sm:rounded-[40px] bg-white border border-slate-200/90 p-5 sm:p-8 shadow-cream-sm overflow-hidden relative isolate">
{/* Dynamic ambient background glow that shifts with active step */}
<div
className="absolute inset-0 pointer-events-none transition-all duration-1000 -z-10"
style={{
background: activeStep === 1
? 'radial-gradient(circle at 18% 50%, rgba(59,130,246,0.1) 0%, transparent 60%)'
: activeStep === 2
? 'radial-gradient(circle at 50% 50%, rgba(245,158,11,0.12) 0%, rgba(168,85,247,0.08) 40%, transparent 70%)'
: 'radial-gradient(circle at 82% 50%, rgba(16,185,129,0.1) 0%, transparent 60%)'
}}
/>
{/* Pipeline Header: Progress Title & Interactive Step Selectors */}
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4 pb-6 border-b border-slate-100">
<div>
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-slate-100 text-slate-800 text-[11px] font-mono font-bold tracking-wider uppercase mb-1">
<span className={`w-2 h-2 rounded-full animate-ping ${
activeStep === 1 ? 'bg-blue-600' : activeStep === 2 ? 'bg-amber-500' : 'bg-emerald-500'
}`} />
<span>Live Photo Journey Pipeline</span>
</div>
<h3 className="text-base sm:text-lg font-display font-extrabold text-slate-900 transition-colors">
{activeStep === 1 && 'Step 1: Your original picture drops onto the conveyor'}
{activeStep === 2 && 'Step 2: AI Neural magic analyzes & transforms pixels'}
{activeStep === 3 && 'Step 3: Flawless 4K masterpiece is instantly ready!'}
</h3>
</div>
{/* Controls: Step Switchers & Play/Pause */}
<div className="flex items-center gap-2 flex-wrap">
<button
type="button"
onClick={() => onSelectStep(1)}
className={`px-3 py-1.5 rounded-full text-xs font-display font-bold transition-all duration-300 ${
activeStep === 1
? 'bg-blue-600 text-white shadow-md shadow-blue-500/20 scale-105'
: 'bg-slate-100 text-slate-600 hover:bg-slate-200'
}`}
>
📸 1. Pick Photo
</button>
<button
type="button"
onClick={() => onSelectStep(2)}
className={`px-3 py-1.5 rounded-full text-xs font-display font-bold transition-all duration-300 ${
activeStep === 2
? 'bg-amber-500 text-white shadow-md shadow-amber-500/20 scale-105'
: 'bg-slate-100 text-slate-600 hover:bg-slate-200'
}`}
>
🪄 2. AI Magic
</button>
<button
type="button"
onClick={() => onSelectStep(3)}
className={`px-3 py-1.5 rounded-full text-xs font-display font-bold transition-all duration-300 ${
activeStep === 3
? 'bg-emerald-600 text-white shadow-md shadow-emerald-500/20 scale-105'
: 'bg-slate-100 text-slate-600 hover:bg-slate-200'
}`}
>
🎉 3. Masterpiece
</button>
<button
type="button"
onClick={onTogglePause}
className="p-2 rounded-full bg-slate-100 hover:bg-slate-200 text-slate-700 transition-colors ml-1"
title={isPaused ? 'Resume auto-play' : 'Pause auto-play'}
aria-label={isPaused ? 'Resume auto-play' : 'Pause auto-play'}
>
{isPaused ? <Play className="w-3.5 h-3.5" /> : <Pause className="w-3.5 h-3.5" />}
</button>
</div>
</div>
{/* DESKTOP PIPELINE TRACK (hidden on small mobile, visible sm+) */}
<div className="hidden sm:block relative pt-6 pb-2 h-[240px] overflow-hidden">
{/* Conveyor Base Track Line */}
<div className="absolute top-[120px] inset-x-12 h-1.5 bg-slate-200/80 rounded-full" />
{/* Animated Active Glowing Energy Beam */}
<div
className="absolute top-[120px] left-12 h-1.5 bg-gradient-to-r from-blue-500 via-amber-400 to-emerald-500 rounded-full transition-all duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] shadow-[0_0_12px_rgba(59,130,246,0.6)]"
style={{
width: activeStep === 1 ? '0%' : activeStep === 2 ? 'calc(50% - 3rem)' : 'calc(100% - 6rem)'
}}
/>
{/* Station 1 Anchor Ring */}
<div className="absolute top-[120px] left-12 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center">
<div className={`w-9 h-9 rounded-full border-2 flex items-center justify-center transition-all duration-300 ${
activeStep === 1 ? 'bg-blue-600 border-blue-300 text-white shadow-lg scale-110' : 'bg-white border-slate-300 text-slate-500'
}`}>
<span className="text-sm">📸</span>
</div>
<span className="mt-2 text-[10px] font-mono font-bold uppercase text-slate-600">1. Pick</span>
</div>
{/* Station 2 Anchor Ring */}
<div className="absolute top-[120px] left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center">
<div className={`w-9 h-9 rounded-full border-2 flex items-center justify-center transition-all duration-300 ${
activeStep === 2 ? 'bg-amber-500 border-amber-300 text-white shadow-lg scale-110' : 'bg-white border-slate-300 text-slate-500'
}`}>
<span className="text-sm">🪄</span>
</div>
<span className="mt-2 text-[10px] font-mono font-bold uppercase text-slate-600">2. Neural Magic</span>
</div>
{/* Station 3 Anchor Ring */}
<div className="absolute top-[120px] right-12 translate-x-1/2 -translate-y-1/2 flex flex-col items-center">
<div className={`w-9 h-9 rounded-full border-2 flex items-center justify-center transition-all duration-300 ${
activeStep === 3 ? 'bg-emerald-600 border-emerald-300 text-white shadow-lg scale-110' : 'bg-white border-slate-300 text-slate-500'
}`}>
<span className="text-sm">🎉</span>
</div>
<span className="mt-2 text-[10px] font-mono font-bold uppercase text-slate-600">3. Download</span>
</div>
{/* THE TRAVELLING PHOTO CARD */}
<div
className="absolute top-1/2 z-20 transition-all duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] transform-gpu will-change-[left,transform]"
style={{
left: activeStep === 1 ? 'calc(3rem + 30px)' : activeStep === 2 ? '50%' : 'calc(100% - 3rem - 30px)',
transform: 'translate(-50%, -50%)',
}}
>
<div className={`relative w-44 h-32 rounded-2xl bg-white p-1.5 shadow-2xl border-2 transition-all duration-500 overflow-hidden ${
activeStep === 1
? 'border-blue-400 shadow-blue-500/25 rotate-[-2deg]'
: activeStep === 2
? 'border-amber-400 shadow-amber-500/35 scale-110 rotate-[0deg]'
: 'border-emerald-400 shadow-emerald-500/30 rotate-[2deg] scale-105'
}`}>
{/* Raw Source Photo (active in step 1, crossfades out) */}
<img
src="/management/pages/home/sections/how-it-works/media/before.jpg"
alt="Source Raw Photo"
className={`absolute inset-1.5 w-[calc(100%-12px)] h-[calc(100%-12px)] object-cover rounded-xl transition-opacity duration-700 ${
activeStep === 1 ? 'opacity-100' : 'opacity-0'
}`}
/>
{/* AI Transformed Masterpiece Photo (fades in step 2 & 3) */}
<img
src="/management/pages/home/sections/how-it-works/media/after.jpg"
alt="Transformed Masterpiece"
className={`absolute inset-1.5 w-[calc(100%-12px)] h-[calc(100%-12px)] object-cover rounded-xl transition-opacity duration-700 ${
activeStep >= 2 ? 'opacity-100' : 'opacity-0'
}`}
/>
{/* Step 2 Neural Laser Scanner Beam */}
{activeStep === 2 && (
<div
className="absolute inset-y-1.5 w-10 bg-gradient-to-r from-transparent via-cyan-400/90 to-transparent animate-laser-scan pointer-events-none z-20 rounded-xl"
/>
)}
{/* Badges on Travelling Card */}
<div className="absolute bottom-2.5 left-2.5 right-2.5 z-30 flex items-center justify-between">
<span className={`px-2 py-0.5 rounded-full text-[9px] font-mono font-bold uppercase tracking-wider backdrop-blur-md shadow-xs text-white ${
activeStep === 1 ? 'bg-blue-600/95' : activeStep === 2 ? 'bg-amber-600/95' : 'bg-emerald-600/95'
}`}>
{activeStep === 1 && 'Raw Photo'}
{activeStep === 2 && 'AI Magic...'}
{activeStep === 3 && '4K Masterpiece'}
</span>
{activeStep === 2 && (
<span className="text-xs animate-spin" style={{ animationDuration: '3s' }}>✨</span>
)}
{activeStep === 3 && (
<span className="text-xs">🎉</span>
)}
</div>
</div>
</div>
</div>
{/* MOBILE PIPELINE TRACK (sm:hidden) */}
<div className="sm:hidden pt-3 pb-1 space-y-4">
{/* Mobile Animated Travelling Card Stage */}
<div className="relative w-full h-[180px] rounded-2xl bg-gradient-to-b from-slate-900 to-slate-950 p-3 overflow-hidden flex flex-col items-center justify-center">
<div className="relative w-48 h-32 rounded-xl bg-white p-1 shadow-xl overflow-hidden border-2 border-white/20">
{/* Raw Photo */}
<img
src="/management/pages/home/sections/how-it-works/media/before.jpg"
alt="Source Photo"
className={`absolute inset-1 w-[calc(100%-8px)] h-[calc(100%-8px)] object-cover rounded-lg transition-opacity duration-700 ${
activeStep === 1 ? 'opacity-100' : 'opacity-0'
}`}
/>
{/* Transformed Photo */}
<img
src="/management/pages/home/sections/how-it-works/media/after.jpg"
alt="Transformed Photo"
className={`absolute inset-1 w-[calc(100%-8px)] h-[calc(100%-8px)] object-cover rounded-lg transition-opacity duration-700 ${
activeStep >= 2 ? 'opacity-100' : 'opacity-0'
}`}
/>
{/* Laser Beam during magic step */}
{activeStep === 2 && (
<div className="absolute inset-y-1 w-8 bg-gradient-to-r from-transparent via-cyan-400 to-transparent animate-laser-scan pointer-events-none z-20" />
)}
<div className="absolute bottom-2 left-2 right-2 z-30 flex items-center justify-between">
<span className={`px-2 py-0.5 rounded-full text-[9px] font-mono font-bold uppercase tracking-wider text-white ${
activeStep === 1 ? 'bg-blue-600' : activeStep === 2 ? 'bg-amber-600' : 'bg-emerald-600'
}`}>
{activeStep === 1 && 'Step 1: Raw Photo'}
{activeStep === 2 && 'Step 2: AI Magic'}
{activeStep === 3 && 'Step 3: 4K Finished'}
</span>
</div>
</div>
{/* Dotted Step Bar on Mobile */}
<div className="mt-3 flex items-center justify-center gap-2">
{[1, 2, 3].map((s) => (
<button
key={s}
onClick={() => onSelectStep(s as 1 | 2 | 3)}
className={`h-2 rounded-full transition-all duration-300 ${
activeStep === s ? 'w-8 bg-amber-400' : 'w-2 bg-slate-700'
}`}
aria-label={`Go to step ${s}`}
/>
))}
</div>
</div>
</div>
</div>
);
}
// -------------------------------------------------------------
// Card 1: Upload Your Picture (Super Warm & Visual)
// -------------------------------------------------------------
function StepUploadCard() {
function StepUploadCard({ isActive = false }: { isActive?: boolean }) {
return (
<div className="group relative flex flex-col justify-between rounded-[36px] bg-white border border-slate-200/90 p-7 shadow-cream-sm hover:shadow-cream-lg transition-all duration-300 hover:-translate-y-1.5 hover:border-blue-400/60">
<div className={`group relative flex flex-col justify-between rounded-[36px] bg-white border p-7 shadow-cream-sm transition-all duration-500 ${
isActive
? 'border-blue-400 ring-4 ring-blue-500/20 shadow-cream-lg -translate-y-2'
: 'border-slate-200/90 hover:shadow-cream-lg hover:-translate-y-1.5 hover:border-blue-400/60'
}`}>
<div>
{/* Step Badge */}
<div className="flex items-center justify-between mb-5">
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-blue-50 border border-blue-200 text-blue-700 text-xs font-display font-bold uppercase tracking-wider">
{isActive && <span className="w-2 h-2 rounded-full bg-blue-600 animate-ping" />}
<span>STEP 01</span>
</div>
<span className="text-xl">📸</span>
@@ -171,13 +497,18 @@ function StepUploadCard() {
// -------------------------------------------------------------
// Card 2: The Magic Happens (Playful & Magical)
// -------------------------------------------------------------
function StepMagicCard() {
function StepMagicCard({ isActive = false }: { isActive?: boolean }) {
return (
<div className="group relative flex flex-col justify-between rounded-[36px] bg-white border border-slate-200/90 p-7 shadow-cream-sm hover:shadow-cream-lg transition-all duration-300 hover:-translate-y-1.5 hover:border-amber-400/60">
<div className={`group relative flex flex-col justify-between rounded-[36px] bg-white border p-7 shadow-cream-sm transition-all duration-500 ${
isActive
? 'border-amber-400 ring-4 ring-amber-500/20 shadow-cream-lg -translate-y-2'
: 'border-slate-200/90 hover:shadow-cream-lg hover:-translate-y-1.5 hover:border-amber-400/60'
}`}>
<div>
{/* Step Badge */}
<div className="flex items-center justify-between mb-5">
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-amber-50 border border-amber-200 text-amber-800 text-xs font-display font-bold uppercase tracking-wider">
{isActive && <span className="w-2 h-2 rounded-full bg-amber-500 animate-ping" />}
<span>STEP 02</span>
</div>
<span className="text-xl">🪄</span>
@@ -244,13 +575,18 @@ function StepMagicCard() {
// -------------------------------------------------------------
// Card 3: Tada! Your Picture is Ready (Celebration & Joy)
// -------------------------------------------------------------
function StepTadaCard() {
function StepTadaCard({ isActive = false }: { isActive?: boolean }) {
return (
<div className="group relative flex flex-col justify-between rounded-[36px] bg-white border border-slate-200/90 p-7 shadow-cream-sm hover:shadow-cream-lg transition-all duration-300 hover:-translate-y-1.5 hover:border-emerald-400/60">
<div className={`group relative flex flex-col justify-between rounded-[36px] bg-white border p-7 shadow-cream-sm transition-all duration-500 ${
isActive
? 'border-emerald-400 ring-4 ring-emerald-500/20 shadow-cream-lg -translate-y-2'
: 'border-slate-200/90 hover:shadow-cream-lg hover:-translate-y-1.5 hover:border-emerald-400/60'
}`}>
<div>
{/* Step Badge */}
<div className="flex items-center justify-between mb-5">
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-emerald-50 border border-emerald-200 text-emerald-800 text-xs font-display font-bold uppercase tracking-wider">
{isActive && <span className="w-2 h-2 rounded-full bg-emerald-500 animate-ping" />}
<span>STEP 03</span>
</div>
<span className="text-xl">🎉</span>