From 34daaf57af07128a5bd4494893a5ab907a82a0df Mon Sep 17 00:00:00 2001 From: vshnosngh Date: Tue, 3 Nov 2026 18:34:29 +0530 Subject: [PATCH] fix(ui): restore tool links and reduce animation overhead --- src/app/globals.css | 2 +- src/components/3d/Hero3DCanvas.tsx | 6 ++- src/components/sections/HeroSection.tsx | 3 +- src/components/sections/SectionRenderer.tsx | 1 + src/components/sections/TryItWidget.tsx | 1 - .../sections/VerticalToolStackSection.tsx | 8 +-- src/components/ui/Kinetic3DText.tsx | 26 ++++----- src/components/ui/SectionEntrance.tsx | 8 +-- src/components/ui/SmoothScroll.tsx | 54 +------------------ 9 files changed, 28 insertions(+), 81 deletions(-) diff --git a/src/app/globals.css b/src/app/globals.css index 1036ea1..fcef12d 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -33,7 +33,7 @@ } html { - scroll-behavior: auto; + scroll-behavior: smooth; } body { diff --git a/src/components/3d/Hero3DCanvas.tsx b/src/components/3d/Hero3DCanvas.tsx index 38ac153..3b37e55 100644 --- a/src/components/3d/Hero3DCanvas.tsx +++ b/src/components/3d/Hero3DCanvas.tsx @@ -202,14 +202,18 @@ export function Hero3DCanvas({ className = '' }: Hero3DCanvasProps) { observer.observe(container); const clock = new THREE.Clock(); + let lastFrameTime = 0; + const frameInterval = prefersReducedMotion ? 1000 : 1000 / 30; - const animate = () => { + const animate = (time = 0) => { if (!isVisible || !renderer) { animFrameId = 0; return; } animFrameId = requestAnimationFrame(animate); + if (time - lastFrameTime < frameInterval) return; + lastFrameTime = time; const elapsedTime = clock.getElapsedTime(); diff --git a/src/components/sections/HeroSection.tsx b/src/components/sections/HeroSection.tsx index f50b6ea..a074056 100644 --- a/src/components/sections/HeroSection.tsx +++ b/src/components/sections/HeroSection.tsx @@ -55,8 +55,7 @@ export function HeroSection({ diff --git a/src/components/sections/SectionRenderer.tsx b/src/components/sections/SectionRenderer.tsx index 9c05c59..d87dd15 100644 --- a/src/components/sections/SectionRenderer.tsx +++ b/src/components/sections/SectionRenderer.tsx @@ -99,6 +99,7 @@ function SectionContent({ section, context }: SectionRendererProps) { context={{ tools: context.tools || [], categories: context.categories || [], + apps: context.apps || [], locale, }} /> diff --git a/src/components/sections/TryItWidget.tsx b/src/components/sections/TryItWidget.tsx index a625c0f..b4cba97 100644 --- a/src/components/sections/TryItWidget.tsx +++ b/src/components/sections/TryItWidget.tsx @@ -235,7 +235,6 @@ export function TryItWidget({ ref={fileInputRef} type="file" accept="image/jpeg,image/png,image/webp" - accept="image/jpeg,image/png,image/webp" className="hidden" onChange={(e) => e.target.files?.[0] && handleFileChange(e.target.files[0])} /> diff --git a/src/components/sections/VerticalToolStackSection.tsx b/src/components/sections/VerticalToolStackSection.tsx index 520d008..11fefdd 100644 --- a/src/components/sections/VerticalToolStackSection.tsx +++ b/src/components/sections/VerticalToolStackSection.tsx @@ -15,7 +15,7 @@ import { Cpu, Smartphone, } from 'lucide-react'; -import { resolveLocalised, ToolItem, CategoryItem } from '@/types'; +import { resolveLocalised, ToolItem, CategoryItem, AppItem } from '@/types'; import { BeforeAfterSlider } from '@/components/ui/BeforeAfterSlider'; import { SpotlightCard } from '@/components/animate-ui/SpotlightCard'; import { ShimmerBadge } from '@/components/animate-ui/ShimmerBadge'; @@ -26,6 +26,7 @@ export interface VerticalToolStackProps { context: { tools: ToolItem[]; categories: CategoryItem[]; + apps: AppItem[]; locale: string; }; } @@ -70,7 +71,7 @@ const ACCENT_STYLES: Record = { }; export function VerticalToolStackSection({ context }: VerticalToolStackProps) { - const { tools, categories, locale } = context; + const { tools, categories, apps, locale } = context; const [selectedCategory, setSelectedCategory] = useState('all'); const filteredCategories = selectedCategory === 'all' @@ -185,6 +186,7 @@ export function VerticalToolStackSection({ context }: VerticalToolStackProps) { {/* Dynamic Multi-Format Tool Cards with Alternating Layouts */}
{catTools.map((tool, toolIdx) => { + const homeApp = apps.find((app) => app.id === tool.homeApp); const badgeInfo = MODEL_BADGES[tool.id] || { model: 'Neural Vision v2.0', latency: '< 450ms', @@ -339,7 +341,7 @@ export function VerticalToolStackSection({ context }: VerticalToolStackProps) { diff --git a/src/components/ui/Kinetic3DText.tsx b/src/components/ui/Kinetic3DText.tsx index 160ce76..5445927 100644 --- a/src/components/ui/Kinetic3DText.tsx +++ b/src/components/ui/Kinetic3DText.tsx @@ -1,6 +1,6 @@ 'use client'; -import React, { useRef, useState, useCallback } from 'react'; +import React, { useRef, useCallback } from 'react'; interface Kinetic3DTextProps { primaryText: string; @@ -15,23 +15,22 @@ export function Kinetic3DText({ subtitle, className = '', }: Kinetic3DTextProps) { - const [tilt, setTilt] = useState({ rx: 0, ry: 0, active: false }); const containerRef = useRef(null); + const textRef = useRef(null); const handleMouseMove = useCallback((e: React.MouseEvent) => { if (!containerRef.current) return; const rect = containerRef.current.getBoundingClientRect(); const nx = (e.clientX - rect.left) / rect.width - 0.5; const ny = (e.clientY - rect.top) / rect.height - 0.5; - setTilt({ - rx: Math.max(Math.min(-ny * 10, 8), -8), - ry: Math.max(Math.min(nx * 12, 10), -10), - active: true, - }); + if (!textRef.current || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; + const rx = Math.max(Math.min(-ny * 3, 2.5), -2.5); + const ry = Math.max(Math.min(nx * 4, 3), -3); + textRef.current.style.transform = `perspective(1000px) rotateX(${rx}deg) rotateY(${ry}deg)`; }, []); const handleMouseLeave = useCallback(() => { - setTilt({ rx: 0, ry: 0, active: false }); + if (textRef.current) textRef.current.style.transform = 'perspective(1000px) rotateX(0deg) rotateY(0deg)'; }, []); return ( @@ -40,16 +39,11 @@ export function Kinetic3DText({ onMouseMove={handleMouseMove} onMouseLeave={handleMouseLeave} className={`relative select-none ${className}`} - style={{ perspective: 1000 }} >
{/* Main Floating Headline (100% Visible, Crisp, Zero Disappearance) */}

diff --git a/src/components/ui/SectionEntrance.tsx b/src/components/ui/SectionEntrance.tsx index d270b47..487244a 100644 --- a/src/components/ui/SectionEntrance.tsx +++ b/src/components/ui/SectionEntrance.tsx @@ -9,10 +9,10 @@ export function SectionEntrance({ children, id }: { children: React.ReactNode; i return ( {children} diff --git a/src/components/ui/SmoothScroll.tsx b/src/components/ui/SmoothScroll.tsx index cb33f77..b1b476b 100644 --- a/src/components/ui/SmoothScroll.tsx +++ b/src/components/ui/SmoothScroll.tsx @@ -1,58 +1,6 @@ 'use client'; -import { useEffect } from 'react'; -import Lenis from 'lenis'; - +/** Keep native browser scrolling: it is interruptible, accessible, and avoids a permanent RAF loop. */ export function SmoothScroll() { - useEffect(() => { - // Check prefers-reduced-motion - if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; - - const lenis = new Lenis({ - duration: 0.75, // Extra smooth, luxurious gliding friction - easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), - orientation: 'vertical', - gestureOrientation: 'vertical', - smoothWheel: true, - syncTouch: false, - wheelMultiplier: 1.05, - touchMultiplier: 1.0, - }); - - let rafId: number; - function raf(time: number) { - lenis.raf(time); - rafId = requestAnimationFrame(raf); - } - - rafId = requestAnimationFrame(raf); - - // Smooth scroll for anchor clicks (e.g. #studio-suite, #flagship-models) - const handleAnchorClick = (e: MouseEvent) => { - const target = e.target as HTMLElement; - const anchor = target.closest('a'); - if (!anchor) return; - const href = anchor.getAttribute('href'); - if (href && href.startsWith('#') && href.length > 1) { - const targetEl = document.querySelector(href); - if (targetEl) { - e.preventDefault(); - lenis.scrollTo(targetEl as HTMLElement, { offset: -90, duration: 0.75 }); - } - } - }; - document.addEventListener('click', handleAnchorClick); - - // Expose lenis to window for external triggers - (window as any).lenis = lenis; - - return () => { - cancelAnimationFrame(rafId); - document.removeEventListener('click', handleAnchorClick); - lenis.destroy(); - delete (window as any).lenis; - }; - }, []); - return null; }