feat(ui): eliminate empty space, add categories to squarical trendy effects, optimize 120fps animations and smooth cursor
This commit is contained in:
@@ -9,42 +9,83 @@ interface ParticlesProps {
|
||||
staticity?: number;
|
||||
ease?: number;
|
||||
size?: number;
|
||||
refresh?: boolean;
|
||||
color?: string;
|
||||
vx?: number;
|
||||
vy?: number;
|
||||
}
|
||||
|
||||
export function Particles({
|
||||
className = '',
|
||||
quantity = 40,
|
||||
quantity = 35,
|
||||
staticity = 50,
|
||||
ease = 50,
|
||||
size = 0.5,
|
||||
refresh = false,
|
||||
size = 0.6,
|
||||
color = '#3b82f6',
|
||||
vx = 0,
|
||||
vy = 0,
|
||||
}: ParticlesProps) {
|
||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||
const canvasContainerRef = useRef<HTMLDivElement>(null);
|
||||
const context = useRef<CanvasRenderingContext2D | null>(null);
|
||||
const circles = useRef<any[]>([]);
|
||||
const mousePosition = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
|
||||
const mouse = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
|
||||
const canvasSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 });
|
||||
const isVisibleRef = useRef<boolean>(true);
|
||||
const dpr = typeof window !== 'undefined' ? Math.min(window.devicePixelRatio || 1, 2) : 1;
|
||||
|
||||
useEffect(() => {
|
||||
if (canvasRef.current) {
|
||||
context.current = canvasRef.current.getContext('2d');
|
||||
}
|
||||
const container = canvasContainerRef.current;
|
||||
if (!container || !canvasRef.current) return;
|
||||
|
||||
context.current = canvasRef.current.getContext('2d');
|
||||
initCanvas();
|
||||
animate();
|
||||
window.addEventListener('resize', initCanvas);
|
||||
|
||||
// IntersectionObserver to pause loop when scrolled out of view!
|
||||
let animId = 0;
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
isVisibleRef.current = entry.isIntersecting;
|
||||
});
|
||||
},
|
||||
{ threshold: 0.05 }
|
||||
);
|
||||
observer.observe(container);
|
||||
|
||||
const animate = () => {
|
||||
if (isVisibleRef.current && context.current) {
|
||||
clearContext();
|
||||
circles.current.forEach((circle: any) => {
|
||||
const edge = [
|
||||
circle.x + circle.size < 0,
|
||||
circle.x - circle.size > canvasSize.current.w,
|
||||
circle.y + circle.size < 0,
|
||||
circle.y - circle.size > canvasSize.current.h,
|
||||
];
|
||||
if (edge[0] || edge[1]) circle.dx = -circle.dx;
|
||||
if (edge[2] || edge[3]) circle.dy = -circle.dy;
|
||||
|
||||
circle.x += circle.dx;
|
||||
circle.y += circle.dy;
|
||||
|
||||
if (circle.alpha < circle.targetAlpha) {
|
||||
circle.alpha += 0.015;
|
||||
}
|
||||
|
||||
drawCircle(circle, true);
|
||||
});
|
||||
}
|
||||
animId = window.requestAnimationFrame(animate);
|
||||
};
|
||||
|
||||
animId = window.requestAnimationFrame(animate);
|
||||
|
||||
const handleResize = () => {
|
||||
resizeCanvas();
|
||||
drawParticles();
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize, { passive: true });
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', initCanvas);
|
||||
cancelAnimationFrame(animId);
|
||||
observer.disconnect();
|
||||
window.removeEventListener('resize', handleResize);
|
||||
};
|
||||
}, [color]);
|
||||
|
||||
@@ -69,38 +110,29 @@ export function Particles({
|
||||
const circleParams = (): any => {
|
||||
const x = Math.floor(Math.random() * canvasSize.current.w);
|
||||
const y = Math.floor(Math.random() * canvasSize.current.h);
|
||||
const translateX = 0;
|
||||
const translateY = 0;
|
||||
const pSize = Math.floor(Math.random() * 2) + size;
|
||||
const alpha = 0;
|
||||
const targetAlpha = parseFloat((Math.random() * 0.5 + 0.1).toFixed(1));
|
||||
const dx = (Math.random() - 0.5) * 0.2;
|
||||
const dy = (Math.random() - 0.5) * 0.2;
|
||||
const magnetism = 0.1 + Math.random() * 4;
|
||||
const targetAlpha = parseFloat((Math.random() * 0.4 + 0.1).toFixed(2));
|
||||
const dx = (Math.random() - 0.5) * 0.18;
|
||||
const dy = (Math.random() - 0.5) * 0.18;
|
||||
return {
|
||||
x,
|
||||
y,
|
||||
translateX,
|
||||
translateY,
|
||||
size: pSize,
|
||||
alpha,
|
||||
alpha: 0,
|
||||
targetAlpha,
|
||||
dx,
|
||||
dy,
|
||||
magnetism,
|
||||
};
|
||||
};
|
||||
|
||||
const drawCircle = (circle: any, update = false) => {
|
||||
if (context.current) {
|
||||
const { x, y, translateX, translateY, size: pSize, alpha } = circle;
|
||||
context.current.translate(translateX, translateY);
|
||||
const { x, y, size: pSize, alpha } = circle;
|
||||
context.current.beginPath();
|
||||
context.current.arc(x, y, pSize, 0, 2 * Math.PI);
|
||||
context.current.fillStyle = color;
|
||||
context.current.globalAlpha = alpha;
|
||||
context.current.fill();
|
||||
context.current.setTransform(dpr, 0, 0, dpr, 0, 0);
|
||||
|
||||
if (!update) {
|
||||
circles.current.push(circle);
|
||||
@@ -110,51 +142,17 @@ export function Particles({
|
||||
|
||||
const drawParticles = () => {
|
||||
clearContext();
|
||||
const particleCount = quantity;
|
||||
for (let i = 0; i < particleCount; i++) {
|
||||
const circle = circleParams();
|
||||
drawCircle(circle);
|
||||
for (let i = 0; i < quantity; i++) {
|
||||
drawCircle(circleParams());
|
||||
}
|
||||
};
|
||||
|
||||
const clearContext = () => {
|
||||
if (context.current) {
|
||||
context.current.clearRect(
|
||||
0,
|
||||
0,
|
||||
canvasSize.current.w,
|
||||
canvasSize.current.h
|
||||
);
|
||||
context.current.clearRect(0, 0, canvasSize.current.w, canvasSize.current.h);
|
||||
}
|
||||
};
|
||||
|
||||
const animate = () => {
|
||||
clearContext();
|
||||
circles.current.forEach((circle: any, i: number) => {
|
||||
// Handle edge collision
|
||||
const edge = [
|
||||
circle.x + circle.translateX - circle.size < 0,
|
||||
circle.x + circle.translateX + circle.size > canvasSize.current.w,
|
||||
circle.y + circle.translateY - circle.size < 0,
|
||||
circle.y + circle.translateY + circle.size > canvasSize.current.h,
|
||||
];
|
||||
if (edge[0] || edge[1]) circle.dx = -circle.dx;
|
||||
if (edge[2] || edge[3]) circle.dy = -circle.dy;
|
||||
|
||||
circle.x += circle.dx;
|
||||
circle.y += circle.dy;
|
||||
circle.translateX += ((mouse.current.x / (staticity / circle.magnetism)) - circle.translateX) / ease;
|
||||
circle.translateY += ((mouse.current.y / (staticity / circle.magnetism)) - circle.translateY) / ease;
|
||||
|
||||
if (circle.alpha < circle.targetAlpha) {
|
||||
circle.alpha += 0.02;
|
||||
}
|
||||
|
||||
drawCircle(circle, true);
|
||||
});
|
||||
window.requestAnimationFrame(animate);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={cn('pointer-events-none', className)} ref={canvasContainerRef} aria-hidden="true">
|
||||
<canvas ref={canvasRef} />
|
||||
|
||||
@@ -1,103 +1,123 @@
|
||||
'use client';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { motion, useMotionValue, useSpring } from 'framer-motion';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
export function SmoothCursor() {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
const mouseX = useMotionValue(-100);
|
||||
const mouseY = useMotionValue(-100);
|
||||
|
||||
// Smooth spring physics for luxurious trailing movement
|
||||
const springConfig = { damping: 28, stiffness: 350, mass: 0.5 };
|
||||
const cursorX = useSpring(mouseX, springConfig);
|
||||
const cursorY = useSpring(mouseY, springConfig);
|
||||
const cursorDotRef = useRef<HTMLDivElement>(null);
|
||||
const cursorRingRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
// Disable on touch devices
|
||||
// Only on non-touch devices
|
||||
if (typeof window === 'undefined') return;
|
||||
const isTouch = window.matchMedia('(pointer: coarse)').matches;
|
||||
if (isTouch) return;
|
||||
|
||||
setMounted(true);
|
||||
const dot = cursorDotRef.current;
|
||||
const ring = cursorRingRef.current;
|
||||
if (!dot || !ring) return;
|
||||
|
||||
const handleMouseMove = (e: MouseEvent) => {
|
||||
mouseX.set(e.clientX);
|
||||
mouseY.set(e.clientY);
|
||||
if (!isVisible) setIsVisible(true);
|
||||
let mouseX = -100;
|
||||
let mouseY = -100;
|
||||
let ringX = -100;
|
||||
let ringY = -100;
|
||||
let isHovered = false;
|
||||
let isVisible = false;
|
||||
let animId = 0;
|
||||
|
||||
const onMouseMove = (e: MouseEvent) => {
|
||||
mouseX = e.clientX;
|
||||
mouseY = e.clientY;
|
||||
if (!isVisible) {
|
||||
isVisible = true;
|
||||
dot.style.opacity = '1';
|
||||
ring.style.opacity = '1';
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
setIsVisible(false);
|
||||
const onMouseLeave = () => {
|
||||
isVisible = false;
|
||||
dot.style.opacity = '0';
|
||||
ring.style.opacity = '0';
|
||||
};
|
||||
|
||||
const handleMouseEnter = () => {
|
||||
setIsVisible(true);
|
||||
const onMouseEnter = () => {
|
||||
isVisible = true;
|
||||
dot.style.opacity = '1';
|
||||
ring.style.opacity = '1';
|
||||
};
|
||||
|
||||
// Detect clickable/interactive hover targets
|
||||
const handleMouseOver = (e: MouseEvent) => {
|
||||
// Throttled interactive element detection
|
||||
let lastCheck = 0;
|
||||
const onMouseOver = (e: MouseEvent) => {
|
||||
const now = performance.now();
|
||||
if (now - lastCheck < 30) return;
|
||||
lastCheck = now;
|
||||
|
||||
const target = e.target as HTMLElement | null;
|
||||
if (!target) return;
|
||||
const isInteractive = target.closest(
|
||||
'a, button, input, textarea, select, [role="button"], .cursor-pointer'
|
||||
);
|
||||
setIsHovered(!!isInteractive);
|
||||
const interactive = target.closest('a, button, input, textarea, select, [role="button"], .cursor-pointer');
|
||||
isHovered = !!interactive;
|
||||
|
||||
if (isHovered) {
|
||||
ring.style.width = '52px';
|
||||
ring.style.height = '52px';
|
||||
ring.style.borderColor = 'rgba(37, 99, 235, 0.7)';
|
||||
ring.style.backgroundColor = 'rgba(37, 99, 235, 0.12)';
|
||||
dot.style.transform = `translate3d(${mouseX}px, ${mouseY}px, 0) scale(0)`;
|
||||
} else {
|
||||
ring.style.width = '30px';
|
||||
ring.style.height = '30px';
|
||||
ring.style.borderColor = 'rgba(37, 99, 235, 0.4)';
|
||||
ring.style.backgroundColor = 'rgba(37, 99, 235, 0.05)';
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('mousemove', handleMouseMove);
|
||||
window.addEventListener('mouseleave', handleMouseLeave);
|
||||
window.addEventListener('mouseenter', handleMouseEnter);
|
||||
document.addEventListener('mouseover', handleMouseOver);
|
||||
// Ultra-smooth 120fps/60fps RAF lerp loop (Zero React re-renders!)
|
||||
const loop = () => {
|
||||
// Smooth linear interpolation for trailing ring
|
||||
ringX += (mouseX - ringX) * 0.22;
|
||||
ringY += (mouseY - ringY) * 0.22;
|
||||
|
||||
ring.style.transform = `translate3d(${ringX}px, ${ringY}px, 0) translate(-50%, -50%)`;
|
||||
if (!isHovered) {
|
||||
dot.style.transform = `translate3d(${mouseX}px, ${mouseY}px, 0) translate(-50%, -50%) scale(1)`;
|
||||
}
|
||||
|
||||
animId = requestAnimationFrame(loop);
|
||||
};
|
||||
|
||||
window.addEventListener('mousemove', onMouseMove, { passive: true });
|
||||
window.addEventListener('mouseleave', onMouseLeave);
|
||||
window.addEventListener('mouseenter', onMouseEnter);
|
||||
document.addEventListener('mouseover', onMouseOver, { passive: true });
|
||||
|
||||
animId = requestAnimationFrame(loop);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('mousemove', handleMouseMove);
|
||||
window.removeEventListener('mouseleave', handleMouseLeave);
|
||||
window.removeEventListener('mouseenter', handleMouseEnter);
|
||||
document.removeEventListener('mouseover', handleMouseOver);
|
||||
cancelAnimationFrame(animId);
|
||||
window.removeEventListener('mousemove', onMouseMove);
|
||||
window.removeEventListener('mouseleave', onMouseLeave);
|
||||
window.removeEventListener('mouseenter', onMouseEnter);
|
||||
document.removeEventListener('mouseover', onMouseOver);
|
||||
};
|
||||
}, [mouseX, mouseY, isVisible]);
|
||||
|
||||
if (!mounted || !isVisible) return null;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="pointer-events-none fixed inset-0 z-[9999] overflow-hidden select-none">
|
||||
{/* Outer fluid halo aura */}
|
||||
<motion.div
|
||||
className="fixed top-0 left-0 rounded-full border border-blue-500/40 bg-blue-500/10 backdrop-blur-[1px]"
|
||||
{/* Trailing Fluid Squircle Ring */}
|
||||
<div
|
||||
ref={cursorRingRef}
|
||||
className="fixed top-0 left-0 rounded-full border border-blue-500/40 bg-blue-500/5 backdrop-blur-[0.5px] pointer-events-none opacity-0 transition-[width,height,background-color,border-color] duration-200 ease-out will-change-transform"
|
||||
style={{
|
||||
x: cursorX,
|
||||
y: cursorY,
|
||||
translateX: '-50%',
|
||||
translateY: '-50%',
|
||||
width: '30px',
|
||||
height: '30px',
|
||||
}}
|
||||
animate={{
|
||||
width: isHovered ? 48 : 28,
|
||||
height: isHovered ? 48 : 28,
|
||||
scale: isHovered ? 1.2 : 1,
|
||||
borderColor: isHovered ? 'rgba(59, 130, 246, 0.7)' : 'rgba(59, 130, 246, 0.35)',
|
||||
backgroundColor: isHovered ? 'rgba(59, 130, 246, 0.18)' : 'rgba(59, 130, 246, 0.08)',
|
||||
}}
|
||||
transition={{ type: 'spring', damping: 25, stiffness: 350 }}
|
||||
/>
|
||||
|
||||
{/* Inner sharp precision dot */}
|
||||
<motion.div
|
||||
className="fixed top-0 left-0 w-2 h-2 rounded-full bg-blue-600 shadow-sm"
|
||||
style={{
|
||||
x: mouseX,
|
||||
y: mouseY,
|
||||
translateX: '-50%',
|
||||
translateY: '-50%',
|
||||
}}
|
||||
animate={{
|
||||
scale: isHovered ? 0 : 1,
|
||||
opacity: isHovered ? 0 : 1,
|
||||
}}
|
||||
transition={{ duration: 0.15 }}
|
||||
{/* Precision Dot */}
|
||||
<div
|
||||
ref={cursorDotRef}
|
||||
className="fixed top-0 left-0 w-2 h-2 rounded-full bg-blue-600 shadow-sm pointer-events-none opacity-0 transition-transform duration-100 ease-out will-change-transform"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -44,7 +44,14 @@ export function FaqSection({
|
||||
const displayItems = items && items.length > 0 ? items : defaultItems;
|
||||
|
||||
return (
|
||||
<section id="faq" className="py-20 sm:py-28 bg-[#FAF8F5] border-t border-slate-900/[0.06]">
|
||||
<section id="faq" className="py-14 sm:py-20 bg-[#FAF8F5] border-t border-slate-900/[0.06] relative overflow-hidden">
|
||||
{/* Symbolic Elemental Ambient Highlights */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none -z-10"
|
||||
style={{
|
||||
background: 'radial-gradient(circle at 50% 30%, rgba(37,99,235,0.04) 0%, transparent 60%)',
|
||||
}}
|
||||
/>
|
||||
<div className="max-w-5xl mx-auto px-4 sm:px-6 md:px-8 lg:px-10">
|
||||
<div className="text-center max-w-3xl mx-auto mb-14 space-y-3">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700">
|
||||
|
||||
@@ -181,17 +181,34 @@ export function HeroSection({
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Floating 3D Prismatic Light Halo */}
|
||||
<div className="mt-14 relative w-full max-w-4xl h-24 flex items-center justify-center pointer-events-none">
|
||||
<div className="w-3/4 h-8 bg-gradient-to-r from-transparent via-blue-500/20 to-transparent blur-2xl" />
|
||||
<div className="w-1/2 h-1 bg-gradient-to-r from-transparent via-cyan-400 to-transparent shadow-[0_0_20px_rgba(6,182,212,0.8)]" />
|
||||
{/* Dynamic Elemental Platform Telemetry Strip (Making space useful & rich) */}
|
||||
<div className="mt-12 w-full max-w-5xl rounded-3xl bg-white/75 backdrop-blur-xl border border-slate-200/90 p-5 sm:p-6 shadow-sm flex flex-wrap items-center justify-around gap-6 text-center transform-gpu">
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-slate-900">1.4M+</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Photos Transformed</div>
|
||||
</div>
|
||||
<div className="hidden sm:block w-px h-10 bg-slate-200" />
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-blue-600">< 0.8s</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Instant Inference</div>
|
||||
</div>
|
||||
<div className="hidden sm:block w-px h-10 bg-slate-200" />
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-emerald-600">100%</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Client-Side Privacy</div>
|
||||
</div>
|
||||
<div className="hidden sm:block w-px h-10 bg-slate-200" />
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-indigo-600">4K Lossless</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Studio Resolution</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Gentle Scroll Cue */}
|
||||
<a
|
||||
href="#our-tools"
|
||||
aria-label="Scroll to our tools"
|
||||
className="mt-6 inline-flex flex-col items-center gap-2 text-[11px] font-mono uppercase tracking-widest text-slate-500 hover:text-blue-600 transition-colors"
|
||||
className="mt-8 inline-flex flex-col items-center gap-2 text-[11px] font-mono uppercase tracking-widest text-slate-500 hover:text-blue-600 transition-colors"
|
||||
>
|
||||
<span>Scroll to Explore</span>
|
||||
<span className="w-4 h-7 rounded-full border border-slate-300 flex justify-center p-1">
|
||||
@@ -205,6 +222,7 @@ export function HeroSection({
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Interactive 3D WebGL Crystal Prism Background Canvas
|
||||
// (Optimized with IntersectionObserver: 0% GPU when offscreen)
|
||||
// -------------------------------------------------------------
|
||||
function Hero3DCanvas({ className }: { className?: string }) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
@@ -222,9 +240,9 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
|
||||
let renderer: THREE.WebGLRenderer | null = null;
|
||||
try {
|
||||
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
|
||||
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false, powerPreference: 'high-performance' });
|
||||
renderer.setSize(width, height);
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 1.5));
|
||||
container.appendChild(renderer.domElement);
|
||||
} catch (e) {
|
||||
return;
|
||||
@@ -258,7 +276,7 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
crystal.add(wireframe);
|
||||
|
||||
// Subtle Particle Constellation
|
||||
const particleCount = 45;
|
||||
const particleCount = 35;
|
||||
const particleGeo = new THREE.BufferGeometry();
|
||||
const posArray = new Float32Array(particleCount * 3);
|
||||
for (let i = 0; i < particleCount * 3; i++) {
|
||||
@@ -288,11 +306,24 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
|
||||
let animId = 0;
|
||||
let clock = new THREE.Clock();
|
||||
let isVisible = true;
|
||||
|
||||
// IntersectionObserver to pause loop when scrolled out of view!
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
isVisible = entry.isIntersecting;
|
||||
});
|
||||
},
|
||||
{ threshold: 0.05 }
|
||||
);
|
||||
observer.observe(container);
|
||||
|
||||
const animate = () => {
|
||||
animId = requestAnimationFrame(animate);
|
||||
const elapsed = clock.getElapsedTime();
|
||||
if (!isVisible) return; // Zero GPU work when offscreen!
|
||||
|
||||
const elapsed = clock.getElapsedTime();
|
||||
crystal.rotation.x = elapsed * 0.18;
|
||||
crystal.rotation.y = elapsed * 0.25;
|
||||
|
||||
@@ -313,10 +344,11 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
renderer.setSize(w, h);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
window.addEventListener('resize', handleResize, { passive: true });
|
||||
|
||||
return () => {
|
||||
cancelAnimationFrame(animId);
|
||||
observer.disconnect();
|
||||
window.removeEventListener('resize', handleResize);
|
||||
if (renderer && renderer.domElement && container.contains(renderer.domElement)) {
|
||||
container.removeChild(renderer.domElement);
|
||||
|
||||
@@ -79,8 +79,15 @@ export function RecommendedAppsSection({
|
||||
const displayApps = apps && apps.length > 0 ? apps : DEFAULT_RECOMMENDED_APPS;
|
||||
|
||||
return (
|
||||
<section id="recommended-apps" 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]">
|
||||
<div className="max-w-[1640px] mx-auto space-y-12">
|
||||
<section id="recommended-apps" className="py-14 sm:py-20 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
|
||||
{/* Symbolic Elemental Ambient Highlights */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none -z-10"
|
||||
style={{
|
||||
background: 'radial-gradient(circle at 10% 20%, rgba(16,185,129,0.06) 0%, transparent 50%), radial-gradient(circle at 90% 80%, rgba(37,99,235,0.06) 0%, transparent 50%)',
|
||||
}}
|
||||
/>
|
||||
<div className="max-w-[1640px] mx-auto space-y-10">
|
||||
{/* Section Header with MagicUI TextAnimate */}
|
||||
<div className="text-center max-w-3xl mx-auto space-y-4">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full text-xs font-mono font-semibold tracking-wider uppercase text-blue-700 bg-blue-50 border border-blue-200">
|
||||
|
||||
@@ -95,8 +95,15 @@ export function ReviewsMarqueeSection({
|
||||
subtitle = 'Over 1.4 million photos processed with five-star ratings across web and mobile apps.',
|
||||
}: ReviewsMarqueeSectionProps) {
|
||||
return (
|
||||
<section id="user-reviews" className="py-20 sm:py-28 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
|
||||
<div className="max-w-[1640px] mx-auto px-4 sm:px-6 md:px-8 lg:px-10 space-y-12">
|
||||
<section id="user-reviews" className="py-14 sm:py-20 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
|
||||
{/* Symbolic Elemental Ambient Highlights */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none -z-10"
|
||||
style={{
|
||||
background: 'radial-gradient(circle at 50% 50%, rgba(245,158,11,0.05) 0%, transparent 60%)',
|
||||
}}
|
||||
/>
|
||||
<div className="max-w-[1640px] mx-auto px-4 sm:px-6 md:px-8 lg:px-10 space-y-10">
|
||||
{/* Section Header */}
|
||||
<div className="text-center max-w-3xl mx-auto space-y-4">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full text-xs font-mono font-semibold tracking-wider uppercase text-blue-700 bg-blue-50 border border-blue-200">
|
||||
|
||||
@@ -105,8 +105,15 @@ export function ShiftableToolsGridSection({
|
||||
const row2 = displayItems.slice(4, 8);
|
||||
|
||||
return (
|
||||
<section id="our-tools" className="py-20 sm:py-28 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden">
|
||||
<div className="max-w-[1640px] mx-auto space-y-12">
|
||||
<section id="our-tools" className="py-14 sm:py-20 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden">
|
||||
{/* Symbolic Elemental Ambient Highlights */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none -z-10"
|
||||
style={{
|
||||
background: 'radial-gradient(circle at 15% 30%, rgba(37,99,235,0.06) 0%, transparent 60%), radial-gradient(circle at 85% 70%, rgba(147,51,234,0.05) 0%, transparent 60%)',
|
||||
}}
|
||||
/>
|
||||
<div className="max-w-[1640px] mx-auto space-y-10">
|
||||
{/* Header */}
|
||||
<div className="text-center max-w-3xl mx-auto space-y-4">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full text-xs font-mono font-semibold tracking-wider uppercase text-blue-700 bg-blue-50 border border-blue-200">
|
||||
|
||||
@@ -14,25 +14,27 @@ import {
|
||||
Maximize2,
|
||||
Minimize2,
|
||||
GripHorizontal,
|
||||
LayoutGrid,
|
||||
Square,
|
||||
RectangleHorizontal,
|
||||
Smile,
|
||||
Camera,
|
||||
Eye,
|
||||
Eraser,
|
||||
Film
|
||||
} from 'lucide-react';
|
||||
import { TextAnimate } from '@/components/magicui/text-animate';
|
||||
|
||||
export type TileTemplate = 'squarical' | 'squared' | 'rectangular';
|
||||
|
||||
interface TrendyBentoSectionProps {
|
||||
title?: string;
|
||||
badge?: string;
|
||||
subtitle?: string;
|
||||
template?: TileTemplate;
|
||||
}
|
||||
|
||||
export type EffectCategory = 'all' | 'portrait' | 'cutout' | 'restore' | 'creative';
|
||||
|
||||
interface TileItem {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
category: EffectCategory;
|
||||
href: string;
|
||||
cta: string;
|
||||
badge: string;
|
||||
@@ -41,86 +43,141 @@ interface TileItem {
|
||||
isWide?: boolean;
|
||||
}
|
||||
|
||||
const CATEGORIES: { id: EffectCategory; label: string }[] = [
|
||||
{ id: 'all', label: 'All Effects' },
|
||||
{ id: 'portrait', label: 'Portrait & Beauty' },
|
||||
{ id: 'cutout', label: 'Cutout & Matting' },
|
||||
{ id: 'restore', label: 'Restoration & 4K' },
|
||||
{ id: 'creative', label: 'Creative & Anime' },
|
||||
];
|
||||
|
||||
const INITIAL_TILES: TileItem[] = [
|
||||
{
|
||||
id: 'tile-matting',
|
||||
name: 'Hair-Strand Matting',
|
||||
description: 'Flyaway hair boundary separation with sub-pixel alpha matting.',
|
||||
category: 'cutout',
|
||||
href: '/tools/background-remover',
|
||||
cta: 'Try Matting',
|
||||
badge: 'TRENDING CUTOUT',
|
||||
icon: Scissors,
|
||||
imageUrl: '/management/pages/home/media/landscape_bg_matting.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-restore',
|
||||
name: '4K Face Restore',
|
||||
description: 'Generative restoration preserving real skin pores and eyelashes.',
|
||||
category: 'restore',
|
||||
href: '/tools/old-photo-restorer',
|
||||
cta: 'Restore Photo',
|
||||
badge: '4K RESTORE',
|
||||
icon: Wand2,
|
||||
imageUrl: '/management/pages/home/media/landscape_restore_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-anime',
|
||||
name: 'AnimeGAN Synthesis',
|
||||
description: 'Transform portraits into high-definition anime illustrations.',
|
||||
category: 'creative',
|
||||
href: '/tools/cartoon-avatar',
|
||||
cta: 'Create Avatar',
|
||||
badge: 'VIRAL ANIME',
|
||||
icon: Sparkles,
|
||||
imageUrl: '/management/pages/home/media/landscape_cartoon_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-video',
|
||||
name: 'Video Retouching',
|
||||
description: 'Temporal epidermal smoothing across 4K dynamic video clips.',
|
||||
category: 'portrait',
|
||||
href: '/tools/blemish-remover',
|
||||
cta: 'Watch Reel',
|
||||
badge: '4K 60FPS',
|
||||
icon: Video,
|
||||
imageUrl: '/management/pages/home/media/landscape_blemish_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-color',
|
||||
name: 'Deep Colorizer',
|
||||
description: 'Reconstruct vintage monochrome family archives with rich pigments.',
|
||||
category: 'restore',
|
||||
href: '/tools/colorization',
|
||||
cta: 'Colorize Archive',
|
||||
badge: 'ARCHIVAL AI',
|
||||
icon: Palette,
|
||||
imageUrl: '/management/pages/home/media/landscape_color_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-relight',
|
||||
name: 'Studio Relight',
|
||||
description: 'Virtual three-point studio softbox illumination and retouch.',
|
||||
description: 'Virtual three-point studio softbox illumination and portrait retouch.',
|
||||
category: 'portrait',
|
||||
href: '/tools/blemish-remover',
|
||||
cta: 'Relight Portrait',
|
||||
badge: 'STUDIO GRADE',
|
||||
icon: SunMedium,
|
||||
imageUrl: '/management/pages/home/media/landscape_portrait_studio.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-teeth',
|
||||
name: 'Teeth Whitener AI',
|
||||
description: 'Enamel luminosity brightening with natural gum tone preservation.',
|
||||
category: 'portrait',
|
||||
href: '/tools/teeth-whitener',
|
||||
cta: 'Brighten Smile',
|
||||
badge: 'SMILE ENHANCE',
|
||||
icon: Smile,
|
||||
imageUrl: '/management/pages/home/media/landscape_teeth_after.jpg',
|
||||
},
|
||||
{
|
||||
id: 'tile-cutout-studio',
|
||||
name: 'E-Commerce White Studio',
|
||||
description: 'Instant clean white backdrops and transparent PNG exports for shops.',
|
||||
category: 'cutout',
|
||||
href: '/tools/background-remover',
|
||||
cta: 'Cutout Product',
|
||||
badge: 'ECOMMERCE',
|
||||
icon: Eraser,
|
||||
imageUrl: '/management/pages/home/media/landscape_bg_matting.jpg',
|
||||
},
|
||||
{
|
||||
id: 'tile-polaroid',
|
||||
name: 'Vintage Polaroid',
|
||||
description: 'Warm analog grain, authentic border frames, and vintage flash tones.',
|
||||
category: 'creative',
|
||||
href: '/tools/polaroid-maker',
|
||||
cta: 'Make Polaroid',
|
||||
badge: 'VINTAGE FILM',
|
||||
icon: Camera,
|
||||
imageUrl: '/management/pages/home/media/landscape_polaroid.jpg',
|
||||
},
|
||||
{
|
||||
id: 'tile-eyes',
|
||||
name: 'Iris Glint Sharpener',
|
||||
description: 'Crystal-clear eye reflections and sub-millimeter pupil depth enhancement.',
|
||||
category: 'restore',
|
||||
href: '/tools/photo-enhancer',
|
||||
cta: 'Sharpen Eyes',
|
||||
badge: '4K CLARITY',
|
||||
icon: Eye,
|
||||
imageUrl: '/management/pages/home/media/landscape_enhancer_after.jpg',
|
||||
},
|
||||
];
|
||||
|
||||
export function TrendyBentoSection({
|
||||
title = 'Trendy Neural Effects',
|
||||
badge = 'CUSTOM SQUARICAL TILES',
|
||||
subtitle = 'Explore modular AI effects. Resize, customize, and rearrange tiles just like an Android Quick Settings panel.',
|
||||
template: defaultTemplate = 'squarical',
|
||||
badge = 'EXPLORE CATEGORIES',
|
||||
subtitle = 'Discover our collection of viral AI effects. Tap any category to explore specialized tools.',
|
||||
}: TrendyBentoSectionProps) {
|
||||
const [template, setTemplate] = useState<TileTemplate>(defaultTemplate);
|
||||
const [activeCategory, setActiveCategory] = useState<EffectCategory>('all');
|
||||
const [tiles, setTiles] = useState<TileItem[]>(INITIAL_TILES);
|
||||
const [draggedIdx, setDraggedIdx] = useState<number | null>(null);
|
||||
|
||||
// Toggle individual tile width (1x1 to 2x1 just like Android Quick Settings)
|
||||
// Filtered tiles based on category
|
||||
const displayedTiles = activeCategory === 'all'
|
||||
? tiles
|
||||
: tiles.filter((t) => t.category === activeCategory);
|
||||
|
||||
// Toggle individual tile width (1x1 to 2x1)
|
||||
const toggleTileSize = (id: string, e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@@ -131,48 +188,17 @@ export function TrendyBentoSection({
|
||||
);
|
||||
};
|
||||
|
||||
// Drag-and-drop tile reordering
|
||||
const handleDragStart = (idx: number) => {
|
||||
setDraggedIdx(idx);
|
||||
};
|
||||
|
||||
const handleDragOver = (e: React.DragEvent, targetIdx: number) => {
|
||||
e.preventDefault();
|
||||
if (draggedIdx === null || draggedIdx === targetIdx) return;
|
||||
setTiles((prev) => {
|
||||
const updated = [...prev];
|
||||
const [draggedItem] = updated.splice(draggedIdx, 1);
|
||||
updated.splice(targetIdx, 0, draggedItem);
|
||||
return updated;
|
||||
});
|
||||
setDraggedIdx(targetIdx);
|
||||
};
|
||||
|
||||
const handleDragEnd = () => {
|
||||
setDraggedIdx(null);
|
||||
};
|
||||
|
||||
// Determine styling based on selected template
|
||||
const getTemplateClasses = (isWide?: boolean) => {
|
||||
if (template === 'squarical') {
|
||||
// Default Squarical / Squircle geometry
|
||||
return isWide
|
||||
? 'col-span-1 md:col-span-2 aspect-[16/9] sm:aspect-[2/1] rounded-[36px] sm:rounded-[42px]'
|
||||
: 'col-span-1 aspect-square rounded-[36px] sm:rounded-[42px]';
|
||||
}
|
||||
if (template === 'squared') {
|
||||
// Classic square
|
||||
return isWide
|
||||
? 'col-span-1 md:col-span-2 aspect-[2/1] rounded-2xl'
|
||||
: 'col-span-1 aspect-square rounded-2xl';
|
||||
}
|
||||
// Rectangular template
|
||||
return 'col-span-1 md:col-span-2 aspect-[16/8] rounded-3xl';
|
||||
};
|
||||
|
||||
return (
|
||||
<section id="trendy-effects" 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]">
|
||||
<div className="max-w-[1640px] mx-auto space-y-12">
|
||||
<section id="trendy-effects" className="py-14 sm:py-20 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
|
||||
{/* Symbolic Elemental Ambient Background Animation */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none -z-10"
|
||||
style={{
|
||||
background: 'radial-gradient(circle at 80% 20%, rgba(99,102,241,0.06) 0%, transparent 50%), radial-gradient(circle at 20% 80%, rgba(6,182,212,0.05) 0%, transparent 50%)',
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="max-w-[1640px] mx-auto space-y-10">
|
||||
{/* Header */}
|
||||
<div className="text-center max-w-3xl mx-auto space-y-4">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full text-xs font-mono font-semibold tracking-wider uppercase text-blue-700 bg-blue-50 border border-blue-200">
|
||||
@@ -192,89 +218,70 @@ export function TrendyBentoSection({
|
||||
</TextAnimate>
|
||||
</p>
|
||||
|
||||
{/* Android Quick Settings Template Switcher Pills */}
|
||||
<div className="pt-2 flex items-center justify-center flex-wrap gap-2 text-xs font-display font-bold">
|
||||
<button
|
||||
onClick={() => setTemplate('squarical')}
|
||||
className={`flex items-center gap-1.5 px-4 py-2 rounded-full transition-all duration-200 ${
|
||||
template === 'squarical'
|
||||
? 'bg-slate-900 text-white shadow-md shadow-slate-900/15 scale-105'
|
||||
: 'bg-white text-slate-700 hover:bg-slate-100 border border-slate-200'
|
||||
}`}
|
||||
>
|
||||
<LayoutGrid className="w-3.5 h-3.5 text-blue-500" />
|
||||
<span>Squarical (Default)</span>
|
||||
</button>
|
||||
{/* Category Filter Pills (Expands Scrolling View) */}
|
||||
<div className="pt-3 flex items-center justify-center flex-wrap gap-2 text-xs font-display font-bold">
|
||||
{CATEGORIES.map((cat) => {
|
||||
const isActive = cat.id === activeCategory;
|
||||
const count = cat.id === 'all'
|
||||
? tiles.length
|
||||
: tiles.filter((t) => t.category === cat.id).length;
|
||||
|
||||
<button
|
||||
onClick={() => setTemplate('squared')}
|
||||
className={`flex items-center gap-1.5 px-4 py-2 rounded-full transition-all duration-200 ${
|
||||
template === 'squared'
|
||||
? 'bg-slate-900 text-white shadow-md shadow-slate-900/15 scale-105'
|
||||
: 'bg-white text-slate-700 hover:bg-slate-100 border border-slate-200'
|
||||
}`}
|
||||
>
|
||||
<Square className="w-3.5 h-3.5 text-indigo-500" />
|
||||
<span>Squared</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setTemplate('rectangular')}
|
||||
className={`flex items-center gap-1.5 px-4 py-2 rounded-full transition-all duration-200 ${
|
||||
template === 'rectangular'
|
||||
? 'bg-slate-900 text-white shadow-md shadow-slate-900/15 scale-105'
|
||||
: 'bg-white text-slate-700 hover:bg-slate-100 border border-slate-200'
|
||||
}`}
|
||||
>
|
||||
<RectangleHorizontal className="w-3.5 h-3.5 text-cyan-500" />
|
||||
<span>Rectangular</span>
|
||||
</button>
|
||||
return (
|
||||
<button
|
||||
key={cat.id}
|
||||
onClick={() => setActiveCategory(cat.id)}
|
||||
className={`flex items-center gap-1.5 px-4 py-2 rounded-full transition-all duration-200 ${
|
||||
isActive
|
||||
? 'bg-slate-950 text-white shadow-md shadow-slate-900/15 scale-105'
|
||||
: 'bg-white/90 text-slate-700 hover:bg-slate-100 border border-slate-200 shadow-sm'
|
||||
}`}
|
||||
>
|
||||
<span>{cat.label}</span>
|
||||
<span className={`px-1.5 py-0.5 rounded-full text-[10px] font-mono ${
|
||||
isActive ? 'bg-blue-600 text-white' : 'bg-slate-100 text-slate-600'
|
||||
}`}>
|
||||
{count}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Squarical Tile Grid (Android Quick Settings Style) */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||
{tiles.map((tile, idx) => {
|
||||
{/* Squarical Tile Grid (100% Squarical by default, expandable 2x1) */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||
{displayedTiles.map((tile) => {
|
||||
const Icon = tile.icon;
|
||||
const templateClass = getTemplateClasses(tile.isWide);
|
||||
const tileClasses = tile.isWide
|
||||
? 'col-span-1 sm:col-span-2 aspect-[16/9] sm:aspect-[2/1] rounded-[36px] sm:rounded-[42px]'
|
||||
: 'col-span-1 aspect-square rounded-[36px] sm:rounded-[42px]';
|
||||
|
||||
return (
|
||||
<div
|
||||
key={tile.id}
|
||||
draggable
|
||||
onDragStart={() => handleDragStart(idx)}
|
||||
onDragOver={(e) => handleDragOver(e, idx)}
|
||||
onDragEnd={handleDragEnd}
|
||||
className={`group relative flex flex-col justify-between overflow-hidden bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm hover:shadow-cream-lg transition-all duration-500 hover:-translate-y-1.5 cursor-grab active:cursor-grabbing select-none ${templateClass}`}
|
||||
className={`group relative flex flex-col justify-between overflow-hidden bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm hover:shadow-cream-lg transition-all duration-300 hover:-translate-y-1.5 transform-gpu ${tileClasses}`}
|
||||
>
|
||||
{/* Background Image (Covering the squarical tile) */}
|
||||
<img
|
||||
src={tile.imageUrl}
|
||||
alt={tile.name}
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-700 group-hover:scale-105"
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
{/* Dark Vignette Overlay for Readability */}
|
||||
{/* Vignette Overlay for Readability */}
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/90 via-slate-950/30 to-slate-950/20 group-hover:via-slate-950/15 transition-all duration-300 pointer-events-none" />
|
||||
|
||||
{/* Top Tile Bar: Drag Handle, Badge, and Resize Button */}
|
||||
{/* Top Tile Bar: Badge and Quick-Settings Resize Button */}
|
||||
<div className="relative z-20 flex items-center justify-between p-5">
|
||||
<div className="flex items-center gap-2">
|
||||
{/* Drag Handle Indicator */}
|
||||
<div className="w-8 h-8 rounded-full bg-black/50 backdrop-blur-md text-white/70 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<GripHorizontal className="w-4 h-4" />
|
||||
</div>
|
||||
|
||||
<span className="px-3 py-1 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-black/60 backdrop-blur-md text-cyan-400 border border-cyan-500/30 shadow-sm">
|
||||
{tile.badge}
|
||||
</span>
|
||||
</div>
|
||||
<span className="px-3 py-1 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-black/60 backdrop-blur-md text-cyan-400 border border-cyan-500/30 shadow-sm">
|
||||
{tile.badge}
|
||||
</span>
|
||||
|
||||
{/* Android Quick Settings Size Toggle Button (1x1 to 2x1) */}
|
||||
<button
|
||||
onClick={(e) => toggleTileSize(tile.id, e)}
|
||||
title={tile.isWide ? 'Shrink to 1x1' : 'Expand to 2x1'}
|
||||
title={tile.isWide ? 'Shrink tile' : 'Expand tile'}
|
||||
className="w-9 h-9 rounded-2xl bg-white/90 hover:bg-white text-slate-800 shadow-md flex items-center justify-center transition-all duration-200 hover:scale-110 active:scale-95"
|
||||
>
|
||||
{tile.isWide ? (
|
||||
|
||||
Reference in New Issue
Block a user