feat: implement management folder architecture, hover-only tool sliders, grain transform animation, and prominent upload studio

This commit is contained in:
2026-11-04 12:28:32 +05:30
parent ad9a3ab000
commit 3cb202399f
56 changed files with 2339 additions and 466 deletions
+5 -4
View File
@@ -1,6 +1,6 @@
import { Metadata } from 'next';
import { notFound } from 'next/navigation';
import { getAllApps, getAppBySlug, getAllTools, getTemplate } from '@/lib/config/loader';
import { getAllApps, getAppBySlug, getAllTools, getTemplate, getSiteConfig } from '@/lib/config/loader';
import { SectionRenderer } from '@/components/sections/SectionRenderer';
import { resolveLocalised } from '@/types';
@@ -55,6 +55,7 @@ export default function AppDetailPage({ params }: AppPageProps) {
const appName = resolveLocalised(app.name, 'en');
const appTagline = resolveLocalised(app.tagline, 'en');
const siteUrl = (process.env.SITE_URL || getSiteConfig().seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
// Structured Data (JSON-LD) per PRD §10 SEO-07
const structuredData = [
@@ -83,19 +84,19 @@ export default function AppDetailPage({ params }: AppPageProps) {
'@type': 'ListItem',
position: 1,
name: 'Home',
item: 'http://localhost:3000',
item: siteUrl,
},
{
'@type': 'ListItem',
position: 2,
name: 'Apps',
item: 'http://localhost:3000/apps',
item: `${siteUrl}/apps`,
},
{
'@type': 'ListItem',
position: 3,
name: appName,
item: `http://localhost:3000/apps/${app.slug}`,
item: `${siteUrl}/apps/${app.slug}`,
},
],
},
+112 -43
View File
@@ -3,23 +3,6 @@
@tailwind utilities;
@layer base {
/* Lenis Ultra-Smooth Fluid Scroll */
html.lenis, html.lenis body {
height: auto;
}
.lenis.lenis-smooth {
scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
overscroll-behavior: contain;
}
.lenis.lenis-stopped {
overflow: hidden;
}
.lenis.lenis-scrolling iframe {
pointer-events: none;
}
:root {
--color-primary: #2563EB;
--color-primary-hover: #1D4ED8;
@@ -43,9 +26,9 @@
radial-gradient(circle at 50% -10%, rgba(37, 99, 235, 0.05) 0%, transparent 60%),
radial-gradient(circle at 90% 25%, rgba(2, 132, 199, 0.04) 0%, transparent 50%),
radial-gradient(circle at 10% 75%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
background-attachment: fixed;
background-attachment: scroll;
font-family: var(--font-sans), system-ui, -apple-system, sans-serif;
overflow-x: hidden;
overflow-x: clip;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@@ -78,15 +61,8 @@
/* Authentic True Liquid Glass Capsule with High Refraction & Specular Gloss */
.liquid-glass-nav {
position: relative;
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.48) 0%,
rgba(250, 248, 245, 0.32) 50%,
rgba(255, 255, 255, 0.42) 100%
);
backdrop-filter: blur(16px) saturate(190%) contrast(104%) brightness(1.04);
-webkit-backdrop-filter: blur(16px) saturate(190%) contrast(104%) brightness(1.04);
border: 1px solid rgba(255, 255, 255, 0.65);
background: rgba(255, 255, 255, 0.96);
border: 1px solid rgba(15, 23, 42, 0.08);
box-shadow:
/* Razor-sharp 1px top specular ridge */
inset 0 1px 0 0 rgba(255, 255, 255, 0.85),
@@ -99,12 +75,7 @@
}
.liquid-glass-nav.nav-scrolled {
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.58) 0%,
rgba(250, 248, 245, 0.42) 50%,
rgba(255, 255, 255, 0.52) 100%
);
background: rgba(255, 255, 255, 0.99);
box-shadow:
inset 0 1px 0 0 rgba(255, 255, 255, 0.95),
inset 0 -1px 0 0 rgba(255, 255, 255, 0.25),
@@ -162,14 +133,8 @@
/* Liquid Glass Mobile Dropdown */
.liquid-glass-dropdown {
position: relative;
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.72) 0%,
rgba(250, 248, 245, 0.85) 100%
);
backdrop-filter: blur(16px) saturate(200%) brightness(1.06);
-webkit-backdrop-filter: blur(16px) saturate(200%) brightness(1.06);
border: 1px solid rgba(255, 255, 255, 0.85);
background: #fff;
border: 1px solid rgba(15, 23, 42, 0.1);
box-shadow:
inset 0 2px 1px rgba(255, 255, 255, 1),
inset 0 0 20px rgba(255, 255, 255, 0.35),
@@ -376,7 +341,7 @@ body, h1, h2, h3, h4, p, span, button {
h1, h2, h3, h4, h5, h6, .text-3d-chiseled {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
text-shadow: 0 1px 1px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
text-shadow: none;
}
/* Crisp Stat Numbers */
@@ -427,6 +392,99 @@ h1, h2, h3, h4, h5, h6, .text-3d-chiseled {
backface-visibility: hidden;
}
.section-shell[data-revealed="true"] {
animation: section-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes section-enter {
from { opacity: 0.7; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes neural-sweep {
0% { transform: translateX(-120%); opacity: 0; }
25% { opacity: 0.75; }
75% { opacity: 0.75; }
100% { transform: translateX(650%); opacity: 0; }
}
.animate-neural-sweep {
animation: neural-sweep 3.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@supports (content-visibility: auto) {
.section-shell:not(.section-shell--hero) {
content-visibility: auto;
contain-intrinsic-size: auto 760px;
}
}
.skip-link {
position: fixed;
top: 0.75rem;
left: 50%;
z-index: 100;
transform: translate(-50%, -180%);
border-radius: 9999px;
background: #0f172a;
padding: 0.7rem 1rem;
color: #fff;
font-size: 0.875rem;
font-weight: 700;
transition: transform 180ms ease;
}
.skip-link:focus { transform: translate(-50%, 0); }
.eyebrow {
color: #1d4ed8;
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.14em;
line-height: 1.2;
}
.button-primary,
.button-secondary {
display: inline-flex;
min-height: 2.75rem;
align-items: center;
justify-content: center;
gap: 0.5rem;
border-radius: 9999px;
padding: 0.65rem 1rem;
font-size: 0.875rem;
font-weight: 700;
text-decoration: none;
transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
}
.button-primary { background: #0f172a; color: #fff; box-shadow: 0 8px 18px -10px rgba(15, 23, 42, 0.45); }
.button-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
.button-secondary { border: 1px solid rgba(15, 23, 42, 0.14); background: #fff; color: #334155; }
.button-secondary:hover { border-color: rgba(15, 23, 42, 0.3); background: #f8fafc; transform: translateY(-1px); }
.media-label {
position: absolute;
bottom: 0.5rem;
border-radius: 0.35rem;
background: rgba(15, 23, 42, 0.82);
padding: 0.2rem 0.4rem;
color: #fff;
font-size: 0.625rem;
font-weight: 700;
text-transform: uppercase;
}
.cinematic-rail {
scrollbar-width: thin;
scrollbar-color: #cbd5e1 transparent;
overscroll-behavior-inline: contain;
}
.tool-filter-rail { scrollbar-width: none; }
.tool-filter-rail::-webkit-scrollbar { display: none; }
::selection {
color: #fff;
background: #315fcb;
@@ -443,4 +501,15 @@ h1, h2, h3, h4, h5, h6, .text-3d-chiseled {
}
}
@media (max-width: 767px) {
body { background-image: none; }
.liquid-glass-nav { box-shadow: 0 10px 24px -14px rgba(15, 23, 42, 0.22); }
.section-shell[data-revealed="true"] { animation: none; }
.perspective-800, .perspective-1000, .perspective-1400 { perspective: none; }
}
@media (hover: none) {
.glass-card:hover, .button-primary:hover, .button-secondary:hover { transform: none; }
}
+8 -8
View File
@@ -4,8 +4,6 @@ import './globals.css';
import { getSiteConfig } from '@/lib/config/loader';
import { Navbar } from '@/components/ui/Navbar';
import { Footer } from '@/components/ui/Footer';
import { CursorAura } from '@/components/ui/CursorAura';
import { SmoothScroll } from '@/components/ui/SmoothScroll';
const sansFont = Plus_Jakarta_Sans({
subsets: ['latin'],
@@ -27,13 +25,14 @@ const monoFont = JetBrains_Mono({
export async function generateMetadata(): Promise<Metadata> {
const config = getSiteConfig();
const siteUrl = process.env.SITE_URL || config.seo.siteUrl || 'http://localhost:3000';
return {
title: {
default: `${config.brand.name} | Advanced AI Vision & Creative Tools Studio`,
template: config.seo.titleTemplate || `%s | ${config.brand.name}`,
},
description: 'Advanced neural vision models for sub-pore portrait retouching, hair-strand matting background cutouts, and 4K photo restoration.',
metadataBase: new URL(config.seo.siteUrl || 'http://localhost:3000'),
metadataBase: new URL(siteUrl),
keywords: [
'CRE Innovations',
'AI photo editor',
@@ -58,6 +57,7 @@ export async function generateMetadata(): Promise<Metadata> {
description: 'Free online AI photo tools with zero storage and native mobile app handoff.',
images: ['/brand/og-default.png'],
},
robots: { index: true, follow: true },
};
}
@@ -67,14 +67,15 @@ export default function RootLayout({
children: React.ReactNode;
}) {
const config = getSiteConfig();
const siteUrl = process.env.SITE_URL || config.seo.siteUrl || 'http://localhost:3000';
// Root Schema.org JSON-LD for Organization & WebSite
const organizationJsonLd = {
'@context': 'https://schema.org',
'@type': 'Organization',
name: config.brand.name,
url: config.seo.siteUrl || 'http://localhost:3000',
logo: `${config.seo.siteUrl || 'http://localhost:3000'}/brand/logo.svg`,
url: siteUrl,
logo: `${siteUrl}/brand/logo.svg`,
sameAs: [
'https://play.google.com/store/apps/dev?id=creinnovations',
'https://apps.apple.com/developer/creinnovations',
@@ -90,10 +91,9 @@ export default function RootLayout({
/>
</head>
<body className="min-h-screen flex flex-col antialiased selection:bg-blue-600 selection:text-white bg-[#FAF8F5] text-slate-900 relative">
<SmoothScroll />
<CursorAura />
<a href="#main-content" className="skip-link">Skip to main content</a>
<Navbar config={config} currentLocale="en" />
<main className="flex-1">{children}</main>
<main id="main-content" className="flex-1">{children}</main>
<Footer config={config} currentLocale="en" />
</body>
</html>
+4 -3
View File
@@ -1,4 +1,4 @@
import { getPageConfig, getAllTools, getAllApps, getAllCategories, getToolById, getAppById } from '@/lib/config/loader';
import { getPageConfig, getAllTools, getAllApps, getAllCategories, getToolById, getAppById, getSiteConfig } from '@/lib/config/loader';
import { getEndpointById } from '@/lib/catalog/loader';
import { SectionRenderer } from '@/components/sections/SectionRenderer';
import { notFound } from 'next/navigation';
@@ -12,6 +12,7 @@ export default function HomePage() {
const tools = getAllTools();
const apps = getAllApps();
const categories = getAllCategories();
const siteUrl = (process.env.SITE_URL || getSiteConfig().seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
// Find hero tool and variants
const heroTool = getToolById('face.blemish.remove') || tools[0];
@@ -39,10 +40,10 @@ export default function HomePage() {
'@context': 'https://schema.org',
'@type': 'WebSite',
name: 'CRE Innovations',
url: 'http://localhost:3000',
url: siteUrl,
potentialAction: {
'@type': 'SearchAction',
target: 'http://localhost:3000/tools?q={search_term_string}',
target: `${siteUrl}/tools?q={search_term_string}`,
'query-input': 'required name=search_term_string',
},
},
+6 -5
View File
@@ -1,6 +1,6 @@
import { Metadata } from 'next';
import { notFound } from 'next/navigation';
import { getAllTools, getToolBySlug, getAppById, getTemplate } from '@/lib/config/loader';
import { getAllTools, getToolBySlug, getAppById, getTemplate, getSiteConfig } from '@/lib/config/loader';
import { getEndpointById } from '@/lib/catalog/loader';
import { SectionRenderer } from '@/components/sections/SectionRenderer';
import { resolveLocalised } from '@/types';
@@ -70,7 +70,8 @@ export default function ToolDetailPage({ params }: ToolPageProps) {
const toolName = resolveLocalised(tool.name, 'en');
const toolSummary = resolveLocalised(tool.summary, 'en');
const exampleImg = tool.content?.examples?.[0]?.after || 'http://localhost:3000/brand/og-default.png';
const siteUrl = (process.env.SITE_URL || getSiteConfig().seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
const exampleImg = tool.content?.examples?.[0]?.after || `${siteUrl}/brand/og-default.png`;
// Structured Data (JSON-LD) for WebApplication and Breadcrumbs per PRD §10 SEO-07
const structuredData = [
@@ -96,19 +97,19 @@ export default function ToolDetailPage({ params }: ToolPageProps) {
'@type': 'ListItem',
position: 1,
name: 'Home',
item: 'http://localhost:3000',
item: siteUrl,
},
{
'@type': 'ListItem',
position: 2,
name: 'Tools',
item: 'http://localhost:3000/tools',
item: `${siteUrl}/tools`,
},
{
'@type': 'ListItem',
position: 3,
name: toolName,
item: `http://localhost:3000/tools/${tool.slug}`,
item: `${siteUrl}/tools/${tool.slug}`,
},
],
},
+31
View File
@@ -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" />;
}
+89 -70
View File
@@ -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" /> &lt; 0.8s Inference
</span>
<span className="inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full bg-white/90 border border-slate-200/80 shadow-2xs">
<ShieldCheck className="w-3.5 h-3.5 text-emerald-600" /> 100% Private (Never Stored)
</span>
<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 &amp; 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 &amp; 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>
+53 -235
View File
@@ -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>
);
}
+4 -10
View File
@@ -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}
+9 -9
View File
@@ -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>
+34 -31
View File
@@ -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 &amp; 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>
);
+47
View File
@@ -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 -31
View File
@@ -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">
+50
View File
@@ -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>
);
}
+25 -9
View File
@@ -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>
);
}
+53 -8
View File
@@ -4,6 +4,7 @@ import { SiteConfig, PageConfig, ToolItem, AppItem, CategoryItem } from '@/types
import { getEndpointById } from '../catalog/loader';
const CONTENT_DIR = path.join(process.cwd(), 'content');
const MANAGEMENT_DIR = path.join(process.cwd(), 'management');
// In-memory cache for speed and resilience
let siteConfigCache: SiteConfig | null = null;
@@ -35,19 +36,46 @@ export function getSiteConfig(): SiteConfig {
export function getPageConfig(slug: string): PageConfig | null {
const normSlug = slug === '' || slug === '/' ? 'home' : slug.replace(/^\/+|\/+$/g, '');
if (pagesCache.has(normSlug)) return pagesCache.get(normSlug)!;
const filePath = path.join(CONTENT_DIR, 'pages', `${normSlug}.json`);
const page = readJsonFile<PageConfig>(filePath);
if (page) {
pagesCache.set(normSlug, page);
// 1. Prioritize management/pages/[name]/page.config.json
const mgmtPageFile = path.join(MANAGEMENT_DIR, 'pages', normSlug, 'page.config.json');
if (fs.existsSync(mgmtPageFile)) {
const page = readJsonFile<PageConfig>(mgmtPageFile);
if (page) return page;
}
return page;
// 2. Fallback to content/pages/[name].json
const filePath = path.join(CONTENT_DIR, 'pages', `${normSlug}.json`);
return readJsonFile<PageConfig>(filePath);
}
export function getAllTools(): ToolItem[] {
if (toolsCache.size > 0) return Array.from(toolsCache.values());
// 1. Prioritize management/pages/tools/[slug]/tool.config.json
const mgmtToolsDir = path.join(MANAGEMENT_DIR, 'pages', 'tools');
if (fs.existsSync(mgmtToolsDir)) {
const slugs = fs.readdirSync(mgmtToolsDir);
const tools: ToolItem[] = [];
for (const slug of slugs) {
const configPath = path.join(mgmtToolsDir, slug, 'tool.config.json');
if (fs.existsSync(configPath)) {
const tool = readJsonFile<any>(configPath);
if (tool && tool.status === 'published') {
// Normalize media paths so before/after point to live management media
if (tool.media?.before && tool.content?.examples?.[0]) {
tool.content.examples[0].before = tool.media.before;
}
if (tool.media?.after && tool.content?.examples?.[0]) {
tool.content.examples[0].after = tool.media.after;
}
tools.push(tool);
toolsCache.set(tool.slug, tool);
}
}
}
if (tools.length > 0) return tools;
}
// 2. Fallback to content/collections/tools
const toolsDir = path.join(CONTENT_DIR, 'collections', 'tools');
if (fs.existsSync(toolsDir)) {
const files = fs.readdirSync(toolsDir).filter((f) => f.endsWith('.json'));
@@ -75,8 +103,25 @@ export function getToolById(id: string): ToolItem | null {
}
export function getAllApps(): AppItem[] {
if (appsCache.size > 0) return Array.from(appsCache.values());
// 1. Prioritize management/apps/[slug]/app.config.json
const mgmtAppsDir = path.join(MANAGEMENT_DIR, 'apps');
if (fs.existsSync(mgmtAppsDir)) {
const slugs = fs.readdirSync(mgmtAppsDir);
const apps: AppItem[] = [];
for (const slug of slugs) {
const configPath = path.join(mgmtAppsDir, slug, 'app.config.json');
if (fs.existsSync(configPath)) {
const app = readJsonFile<AppItem>(configPath);
if (app && app.status === 'published') {
apps.push(app);
appsCache.set(app.slug, app);
}
}
}
if (apps.length > 0) return apps;
}
// 2. Fallback to content/collections/apps
const appsDir = path.join(CONTENT_DIR, 'collections', 'apps');
if (fs.existsSync(appsDir)) {
const files = fs.readdirSync(appsDir).filter((f) => f.endsWith('.json'));