285 lines
12 KiB
TypeScript
285 lines
12 KiB
TypeScript
'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';
|
||
|
|
|
||
|
|
export interface MediaItem {
|
||
|
|
id: string;
|
||
|
|
type: 'video' | 'photo' | 'comparison' | 'banner';
|
||
|
|
title: string;
|
||
|
|
category: string;
|
||
|
|
badge?: string;
|
||
|
|
description: string;
|
||
|
|
videoUrl?: string;
|
||
|
|
poster?: string;
|
||
|
|
image?: string;
|
||
|
|
beforeUrl?: string;
|
||
|
|
afterUrl?: string;
|
||
|
|
link: string;
|
||
|
|
tag?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
interface MediaShowcaseProps {
|
||
|
|
title?: string;
|
||
|
|
badge?: string;
|
||
|
|
subtitle?: string;
|
||
|
|
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,
|
||
|
|
}: 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>
|
||
|
|
</div>
|
||
|
|
</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>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
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);
|
||
|
|
};
|
||
|
|
|
||
|
|
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">
|
||
|
|
{/* 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>
|
||
|
|
</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" />
|
||
|
|
</Link>
|
||
|
|
</div>
|
||
|
|
</SpotlightCard>
|
||
|
|
);
|
||
|
|
}
|