perf(thermal): eradicate thermal heating, CPU throttling, and excessive power draw across mobile and low-end devices
This commit is contained in:
@@ -267,10 +267,10 @@ export function HeroSection({
|
||||
// -------------------------------------------------------------
|
||||
return (
|
||||
<section className="relative isolate min-h-[96vh] flex flex-col justify-center items-center text-center overflow-hidden bg-[#FAF8F5] pt-28 pb-20 px-4 sm:px-6 md:px-8 lg:px-12">
|
||||
{/* 1. MagicUI Ambient Floating Particles */}
|
||||
{/* 1. MagicUI Ambient Floating Particles (Desktop only, 0% CPU on mobile/tablets) */}
|
||||
<Particles
|
||||
className="absolute inset-0 -z-20 opacity-40 pointer-events-none"
|
||||
quantity={60}
|
||||
quantity={15}
|
||||
color="#3b82f6"
|
||||
size={0.7}
|
||||
/>
|
||||
|
||||
@@ -38,7 +38,7 @@ export function HowItWorks3DSection({
|
||||
useEffect(() => {
|
||||
if (isPaused) return;
|
||||
const section = sectionRef.current;
|
||||
let isVisible = true;
|
||||
let isVisible = false; // Must be false until IntersectionObserver confirms visibility
|
||||
let timer: any = null;
|
||||
|
||||
const runTimer = () => {
|
||||
@@ -47,7 +47,7 @@ export function HowItWorks3DSection({
|
||||
if (isVisible && !document.hidden && !isPaused) {
|
||||
setActiveStep((prev) => (prev === 3 ? 1 : ((prev + 1) as 1 | 2 | 3)));
|
||||
}
|
||||
}, 3400);
|
||||
}, 4500);
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
@@ -60,11 +60,10 @@ export function HowItWorks3DSection({
|
||||
timer = null;
|
||||
}
|
||||
},
|
||||
{ threshold: 0.1 }
|
||||
{ threshold: 0.15 }
|
||||
);
|
||||
|
||||
if (section) observer.observe(section);
|
||||
runTimer();
|
||||
|
||||
const handleVisibility = () => {
|
||||
if (document.hidden && timer) {
|
||||
@@ -101,7 +100,7 @@ export function HowItWorks3DSection({
|
||||
{/* Playful & Warm Section Header */}
|
||||
<div className="text-center max-w-3xl mx-auto space-y-4">
|
||||
<div className="inline-flex items-center gap-2 px-4 py-1.5 rounded-full text-xs font-display font-bold tracking-wider uppercase text-amber-900 bg-amber-100/80 border border-amber-300 shadow-sm">
|
||||
<Sparkles className="w-4 h-4 text-amber-600 animate-spin" style={{ animationDuration: '6s' }} />
|
||||
<Sparkles className="w-4 h-4 text-amber-600" />
|
||||
<span>{badge}</span>
|
||||
</div>
|
||||
|
||||
@@ -199,7 +198,7 @@ function TravellingTransformationPipeline({
|
||||
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4 pb-6 border-b border-slate-100">
|
||||
<div>
|
||||
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-slate-100 text-slate-800 text-[11px] font-mono font-bold tracking-wider uppercase mb-1">
|
||||
<span className={`w-2 h-2 rounded-full animate-ping ${
|
||||
<span className={`w-2 h-2 rounded-full ${
|
||||
activeStep === 1 ? 'bg-blue-600' : activeStep === 2 ? 'bg-amber-500' : 'bg-emerald-500'
|
||||
}`} />
|
||||
<span>Live Photo Journey Pipeline</span>
|
||||
@@ -434,7 +433,7 @@ function StepUploadCard({ isActive = false }: { isActive?: boolean }) {
|
||||
{/* Step Badge */}
|
||||
<div className="flex items-center justify-between mb-5">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-blue-50 border border-blue-200 text-blue-700 text-xs font-display font-bold uppercase tracking-wider">
|
||||
{isActive && <span className="w-2 h-2 rounded-full bg-blue-600 animate-ping" />}
|
||||
{isActive && <span className="w-2 h-2 rounded-full bg-blue-600 inline-block" />}
|
||||
<span>STEP 01</span>
|
||||
</div>
|
||||
<span className="text-xl">📸</span>
|
||||
@@ -445,7 +444,7 @@ function StepUploadCard({ isActive = false }: { isActive?: boolean }) {
|
||||
{/* Animated floating dashed dropzone */}
|
||||
<div className="w-full h-full border-2 border-dashed border-blue-300/80 rounded-2xl flex flex-col items-center justify-center p-4 relative">
|
||||
{/* Playful Floating Photo Frame (GPU-composited CSS float, 0% JS overhead) */}
|
||||
<div className="w-36 h-28 rounded-2xl bg-white shadow-xl border-2 border-white overflow-hidden p-1.5 animate-float-slow transform-gpu">
|
||||
<div className="w-36 h-28 rounded-2xl bg-white shadow-xl border-2 border-white overflow-hidden p-1.5 transform-gpu">
|
||||
<img
|
||||
src="/management/pages/home/sections/how-it-works/media/before.jpg"
|
||||
alt="Your Photo"
|
||||
@@ -508,7 +507,7 @@ function StepMagicCard({ isActive = false }: { isActive?: boolean }) {
|
||||
{/* Step Badge */}
|
||||
<div className="flex items-center justify-between mb-5">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-amber-50 border border-amber-200 text-amber-800 text-xs font-display font-bold uppercase tracking-wider">
|
||||
{isActive && <span className="w-2 h-2 rounded-full bg-amber-500 animate-ping" />}
|
||||
{isActive && <span className="w-2 h-2 rounded-full bg-amber-500 inline-block" />}
|
||||
<span>STEP 02</span>
|
||||
</div>
|
||||
<span className="text-xl">🪄</span>
|
||||
@@ -516,20 +515,17 @@ function StepMagicCard({ isActive = false }: { isActive?: boolean }) {
|
||||
|
||||
{/* Visual Animation: Swirling Magical Portal */}
|
||||
<div className="relative w-full h-[230px] rounded-3xl bg-gradient-to-b from-amber-50/80 via-purple-50/50 to-pink-50/60 border border-amber-200/80 overflow-hidden flex flex-col items-center justify-center p-4 select-none">
|
||||
{/* Glowing Aura Ring */}
|
||||
<div className="absolute w-36 h-36 rounded-full bg-gradient-to-tr from-amber-300/40 via-purple-300/40 to-pink-300/40 blur-xl animate-pulse" />
|
||||
{/* Glowing Aura Ring — static, no animation to prevent thermal issues */}
|
||||
<div className="absolute w-36 h-36 rounded-full bg-gradient-to-tr from-amber-300/30 via-purple-300/30 to-pink-300/30 blur-xl" />
|
||||
|
||||
{/* Central Wand and Sparkling Swirl */}
|
||||
<div className="relative z-10 flex flex-col items-center justify-center">
|
||||
<div className="w-20 h-20 rounded-3xl bg-white shadow-xl border border-amber-200 flex items-center justify-center transform group-hover:scale-110 transition-transform duration-300">
|
||||
<Wand2 className="w-10 h-10 text-amber-500 animate-bounce" />
|
||||
<Wand2 className="w-10 h-10 text-amber-500" />
|
||||
</div>
|
||||
|
||||
{/* Orbiting Stars & Sparkles (Pure CSS 60/120fps hardware rotation - 0% JS intervals!) */}
|
||||
<div
|
||||
className="absolute inset-[-20px] pointer-events-none animate-spin"
|
||||
style={{ animationDuration: '8s' }}
|
||||
>
|
||||
{/* Stars — static, no spin to avoid continuous GPU paint */}
|
||||
<div className="absolute inset-[-20px] pointer-events-none">
|
||||
<span className="absolute top-0 left-1/2 -translate-x-1/2 text-amber-400 text-base">✨</span>
|
||||
<span className="absolute bottom-0 left-1/2 -translate-x-1/2 text-purple-400 text-sm">⭐</span>
|
||||
<span className="absolute left-0 top-1/2 -translate-y-1/2 text-pink-400 text-sm">💫</span>
|
||||
@@ -586,7 +582,7 @@ function StepTadaCard({ isActive = false }: { isActive?: boolean }) {
|
||||
{/* Step Badge */}
|
||||
<div className="flex items-center justify-between mb-5">
|
||||
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-emerald-50 border border-emerald-200 text-emerald-800 text-xs font-display font-bold uppercase tracking-wider">
|
||||
{isActive && <span className="w-2 h-2 rounded-full bg-emerald-500 animate-ping" />}
|
||||
{isActive && <span className="w-2 h-2 rounded-full bg-emerald-500 inline-block" />}
|
||||
<span>STEP 03</span>
|
||||
</div>
|
||||
<span className="text-xl">🎉</span>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { Star, MessageSquareQuote, CheckCircle2 } from 'lucide-react';
|
||||
import { Marquee } from '@/components/magicui/marquee';
|
||||
import { TextAnimate } from '@/components/magicui/text-animate';
|
||||
@@ -94,8 +94,48 @@ export function ReviewsMarqueeSection({
|
||||
badge = 'VERIFIED COMMUNITY FEEDBACK',
|
||||
subtitle = 'Over 1.4 million photos processed with five-star ratings across web and mobile apps.',
|
||||
}: ReviewsMarqueeSectionProps) {
|
||||
const sectionRef = useRef<HTMLDivElement>(null);
|
||||
const [isInView, setIsInView] = useState(false);
|
||||
|
||||
// Viewport-aware animation: Pauses CSS animation completely when section is offscreen
|
||||
// Eliminates 100% idle CPU and GPU compositing when user is browsing other sections
|
||||
useEffect(() => {
|
||||
const el = sectionRef.current;
|
||||
if (!el) return;
|
||||
|
||||
let isVisible = false;
|
||||
|
||||
const updateState = () => {
|
||||
setIsInView(isVisible && !document.hidden);
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
isVisible = entry.isIntersecting;
|
||||
updateState();
|
||||
},
|
||||
{ threshold: 0.05 }
|
||||
);
|
||||
|
||||
observer.observe(el);
|
||||
|
||||
const handleVisibility = () => {
|
||||
updateState();
|
||||
};
|
||||
document.addEventListener('visibilitychange', handleVisibility);
|
||||
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
document.removeEventListener('visibilitychange', handleVisibility);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<section id="user-reviews" className="py-14 sm:py-20 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
|
||||
<section
|
||||
id="user-reviews"
|
||||
ref={sectionRef}
|
||||
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"
|
||||
@@ -124,17 +164,29 @@ export function ReviewsMarqueeSection({
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Marquee Container with Left & Right Gradient Feather Masks */}
|
||||
<div className="relative flex w-full flex-col items-center justify-center overflow-hidden [mask-image:linear-gradient(to_right,transparent,black_10%,black_90%,transparent)]">
|
||||
{/* Marquee Container with Left & Right Gradient Feather Masks - Paused when offscreen */}
|
||||
<div
|
||||
className="relative flex w-full flex-col items-center justify-center overflow-hidden [mask-image:linear-gradient(to_right,transparent,black_10%,black_90%,transparent)]"
|
||||
style={{
|
||||
animationPlayState: isInView ? 'running' : 'paused',
|
||||
}}
|
||||
>
|
||||
{/* Row 1: Leftward Marquee */}
|
||||
<Marquee pauseOnHover className="[--duration:35s]">
|
||||
<Marquee
|
||||
pauseOnHover
|
||||
className={`[--duration:35s] ${!isInView ? '[&>*]:[animation-play-state:paused]' : ''}`}
|
||||
>
|
||||
{REVIEWS_ROW_1.map((review, idx) => (
|
||||
<ReviewCard key={idx} {...review} />
|
||||
))}
|
||||
</Marquee>
|
||||
|
||||
{/* Row 2: Rightward Reverse Marquee */}
|
||||
<Marquee reverse pauseOnHover className="[--duration:40s] mt-4">
|
||||
<Marquee
|
||||
reverse
|
||||
pauseOnHover
|
||||
className={`[--duration:40s] mt-4 ${!isInView ? '[&>*]:[animation-play-state:paused]' : ''}`}
|
||||
>
|
||||
{REVIEWS_ROW_2.map((review, idx) => (
|
||||
<ReviewCard key={idx} {...review} />
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user