fix(studio): replace geeky processing animation with porcelain studio theme and fix zoomed-in result comparison
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Sparkles, Cpu, Layers, Zap, ShieldCheck } from 'lucide-react';
|
||||
import { Sparkles } from 'lucide-react';
|
||||
|
||||
interface ProcessingOverlayProps {
|
||||
toolName?: string;
|
||||
@@ -10,45 +10,34 @@ interface ProcessingOverlayProps {
|
||||
}
|
||||
|
||||
export function ProcessingOverlay({
|
||||
toolName = 'Neural Vision Model',
|
||||
toolName = 'Photo',
|
||||
stageMessages,
|
||||
aspectRatio = 'aspect-[4/3] sm:aspect-[16/10]',
|
||||
}: ProcessingOverlayProps) {
|
||||
const defaultStages = [
|
||||
'Initializing volatile GPU tensor core...',
|
||||
'Analyzing photographic topology & lighting coordinates...',
|
||||
'Synthesizing generative neural model...',
|
||||
'Reconstructing sub-pixel micro-details & HD polish...',
|
||||
'Finalizing crystal-clear preview...',
|
||||
'Analyzing lighting & textures...',
|
||||
'Applying neural enhancements...',
|
||||
'Refining high-definition details...',
|
||||
'Finalizing studio quality export...',
|
||||
];
|
||||
|
||||
const stages = stageMessages && stageMessages.length > 0 ? stageMessages : defaultStages;
|
||||
|
||||
const [currentStageIdx, setCurrentStageIdx] = useState(0);
|
||||
const [progress, setProgress] = useState(12);
|
||||
const [elapsedSec, setElapsedSec] = useState(0);
|
||||
const [progress, setProgress] = useState(15);
|
||||
|
||||
// Smooth elapsed timer
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => {
|
||||
setElapsedSec((prev) => +(prev + 0.1).toFixed(1));
|
||||
}, 100);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
// Cycle through inference stages & smooth progress curve
|
||||
// Cycle through natural photo editing stages & smooth progress curve
|
||||
useEffect(() => {
|
||||
const stageInterval = setInterval(() => {
|
||||
setCurrentStageIdx((prev) => (prev < stages.length - 1 ? prev + 1 : prev));
|
||||
}, 900);
|
||||
}, 1100);
|
||||
|
||||
const progressInterval = setInterval(() => {
|
||||
setProgress((prev) => {
|
||||
if (prev >= 94) return 94; // Wait for server resolution
|
||||
const delta = Math.max(1, Math.floor((95 - prev) * 0.15));
|
||||
if (prev >= 94) return 94; // Wait for backend resolution
|
||||
const delta = Math.max(1, Math.floor((95 - prev) * 0.16));
|
||||
return Math.min(94, prev + delta);
|
||||
});
|
||||
}, 150);
|
||||
}, 140);
|
||||
|
||||
return () => {
|
||||
clearInterval(stageInterval);
|
||||
@@ -57,81 +46,51 @@ export function ProcessingOverlay({
|
||||
}, [stages.length]);
|
||||
|
||||
return (
|
||||
<div className="absolute inset-0 z-30 flex items-center justify-center overflow-hidden rounded-2xl bg-black/60 backdrop-blur-md transition-all duration-300">
|
||||
{/* 1. Moving Laser Scanning Beam */}
|
||||
<div className="laser-scanner">
|
||||
<div className="laser-scanner-line" />
|
||||
</div>
|
||||
|
||||
{/* 2. Cybernetic Vision Grid Overlay */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none opacity-20 bg-[linear-gradient(to_right,#38bdf8_1px,transparent_1px),linear-gradient(to_bottom,#38bdf8_1px,transparent_1px)] bg-[size:32px_32px]"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
{/* 3. Corner Targeting Reticles */}
|
||||
<div className="absolute top-4 left-4 w-7 h-7 border-t-2 border-l-2 border-cyan-400/80 rounded-tl-sm pointer-events-none animate-pulse" />
|
||||
<div className="absolute top-4 right-4 w-7 h-7 border-t-2 border-r-2 border-cyan-400/80 rounded-tr-sm pointer-events-none animate-pulse" />
|
||||
<div className="absolute bottom-4 left-4 w-7 h-7 border-b-2 border-l-2 border-cyan-400/80 rounded-bl-sm pointer-events-none animate-pulse" />
|
||||
<div className="absolute bottom-4 right-4 w-7 h-7 border-b-2 border-r-2 border-cyan-400/80 rounded-br-sm pointer-events-none animate-pulse" />
|
||||
|
||||
{/* 4. Central Holographic HUD Card */}
|
||||
<div className="relative z-30 max-w-sm sm:max-w-md w-11/12 p-6 sm:p-7 rounded-3xl bg-slate-950/85 border border-cyan-500/30 shadow-[0_0_50px_rgba(56,189,248,0.25)] text-center text-white space-y-5 backdrop-blur-xl">
|
||||
<div className="absolute inset-0 z-30 flex items-center justify-center p-4 bg-white/75 backdrop-blur-md transition-all duration-300 select-none">
|
||||
|
||||
{/* Elegant Porcelain Studio Card */}
|
||||
<div className="relative z-10 max-w-xs sm:max-w-sm w-full p-6 sm:p-8 rounded-3xl bg-white border border-slate-200/90 shadow-2xl text-center space-y-5">
|
||||
|
||||
{/* Top Badges */}
|
||||
<div className="flex items-center justify-between text-[11px] font-mono font-semibold text-cyan-300 border-b border-cyan-500/20 pb-3">
|
||||
<span className="flex items-center gap-1.5 uppercase tracking-wider">
|
||||
<Cpu className="w-3.5 h-3.5 text-cyan-400 animate-spin" style={{ animationDuration: '6s' }} />
|
||||
<span>GPU Tensor Model</span>
|
||||
</span>
|
||||
<span className="px-2 py-0.5 rounded-full bg-cyan-950/80 border border-cyan-400/30 text-cyan-300 font-mono">
|
||||
{elapsedSec.toFixed(1)}s
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Radar Spinner & Icon */}
|
||||
<div className="relative w-16 h-16 sm:w-20 sm:h-20 mx-auto flex items-center justify-center">
|
||||
{/* Outer glowing pulsed ring */}
|
||||
<div className="absolute inset-0 rounded-full border-2 border-cyan-400/20 animate-ping opacity-30" />
|
||||
{/* Rotating gradient track */}
|
||||
{/* Minimalist Dual-Ring Spinner with Warm Accent */}
|
||||
<div className="relative w-16 h-16 mx-auto flex items-center justify-center">
|
||||
{/* Subtle Outer Track */}
|
||||
<div className="absolute inset-0 rounded-full border-2 border-slate-100" />
|
||||
|
||||
{/* Rotating Accent Ring */}
|
||||
<div
|
||||
className="absolute inset-0 rounded-full border-2 border-t-cyan-400 border-r-indigo-500 border-b-purple-500 border-l-transparent animate-spin"
|
||||
style={{ animationDuration: '1.2s' }}
|
||||
className="absolute inset-0 rounded-full border-2 border-transparent border-t-accent border-r-accent/60 animate-spin"
|
||||
style={{ animationDuration: '1s' }}
|
||||
/>
|
||||
{/* Inner pulsating core */}
|
||||
<div className="w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-gradient-to-tr from-cyan-500 to-indigo-600 flex items-center justify-center shadow-lg shadow-cyan-500/50">
|
||||
<Sparkles className="w-5 h-5 sm:w-6 sm:h-6 text-white animate-pulse" />
|
||||
|
||||
{/* Inner Soft Glowing Center */}
|
||||
<div className="w-10 h-10 rounded-full bg-accent/10 flex items-center justify-center">
|
||||
<Sparkles className="w-5 h-5 text-accent animate-pulse" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Dynamic Stage Title & Progress */}
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between text-xs font-body font-medium">
|
||||
<span className="text-white font-semibold flex items-center gap-1.5">
|
||||
<Zap className="w-3.5 h-3.5 text-amber-400 animate-pulse" />
|
||||
<span>Processing {toolName}</span>
|
||||
</span>
|
||||
<span className="font-mono text-cyan-400 font-bold">{progress}%</span>
|
||||
</div>
|
||||
|
||||
{/* Glowing Animated Progress Bar */}
|
||||
<div className="w-full h-2 rounded-full bg-slate-900 border border-cyan-500/30 overflow-hidden p-0.5">
|
||||
<div
|
||||
className="h-full rounded-full bg-gradient-to-r from-cyan-400 via-indigo-400 to-purple-400 transition-all duration-200 shadow-[0_0_12px_#38bdf8]"
|
||||
style={{ width: `${progress}%` }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Current Step Description */}
|
||||
<p className="text-xs text-slate-300 font-body min-h-[36px] flex items-center justify-center leading-relaxed animate-fade-in">
|
||||
{/* Studio Status Header */}
|
||||
<div className="space-y-1">
|
||||
<h3 className="text-base sm:text-lg font-display font-bold text-slate-900 tracking-tight">
|
||||
Enhancing Photo
|
||||
</h3>
|
||||
<p className="text-xs text-slate-500 font-sans min-h-[20px] transition-opacity duration-200">
|
||||
{stages[currentStageIdx]}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Reassurance Footer */}
|
||||
<div className="pt-2 border-t border-cyan-500/20 flex items-center justify-center gap-1.5 text-[10px] text-slate-400 font-body">
|
||||
<ShieldCheck className="w-3.5 h-3.5 text-emerald-400" />
|
||||
<span>Neural Engine Processing · Direct Stream</span>
|
||||
{/* Minimalist Studio Progress Bar */}
|
||||
<div className="space-y-1.5 pt-1">
|
||||
<div className="w-full h-1.5 rounded-full bg-slate-100 overflow-hidden">
|
||||
<div
|
||||
className="h-full rounded-full bg-slate-900 transition-all duration-200"
|
||||
style={{ width: `${progress}%` }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between text-[11px] font-sans text-slate-400">
|
||||
<span>Studio Processing</span>
|
||||
<span className="font-mono font-medium text-slate-600">{progress}%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user