2026-11-11 10:47:00 +05:30
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import React, { useState, useEffect } from 'react';
|
2026-11-11 14:59:21 +05:30
|
|
|
import { Sparkles } from 'lucide-react';
|
2026-11-11 10:47:00 +05:30
|
|
|
|
|
|
|
|
interface ProcessingOverlayProps {
|
|
|
|
|
toolName?: string;
|
|
|
|
|
stageMessages?: string[];
|
|
|
|
|
aspectRatio?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ProcessingOverlay({
|
2026-11-11 14:59:21 +05:30
|
|
|
toolName = 'Photo',
|
2026-11-11 10:47:00 +05:30
|
|
|
stageMessages,
|
|
|
|
|
}: ProcessingOverlayProps) {
|
|
|
|
|
const defaultStages = [
|
2026-11-11 14:59:21 +05:30
|
|
|
'Analyzing lighting & textures...',
|
|
|
|
|
'Applying neural enhancements...',
|
|
|
|
|
'Refining high-definition details...',
|
|
|
|
|
'Finalizing studio quality export...',
|
2026-11-11 10:47:00 +05:30
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const stages = stageMessages && stageMessages.length > 0 ? stageMessages : defaultStages;
|
|
|
|
|
|
|
|
|
|
const [currentStageIdx, setCurrentStageIdx] = useState(0);
|
2026-11-11 14:59:21 +05:30
|
|
|
const [progress, setProgress] = useState(15);
|
2026-11-11 10:47:00 +05:30
|
|
|
|
2026-11-11 14:59:21 +05:30
|
|
|
// Cycle through natural photo editing stages & smooth progress curve
|
2026-11-11 10:47:00 +05:30
|
|
|
useEffect(() => {
|
|
|
|
|
const stageInterval = setInterval(() => {
|
|
|
|
|
setCurrentStageIdx((prev) => (prev < stages.length - 1 ? prev + 1 : prev));
|
2026-11-11 14:59:21 +05:30
|
|
|
}, 1100);
|
2026-11-11 10:47:00 +05:30
|
|
|
|
|
|
|
|
const progressInterval = setInterval(() => {
|
|
|
|
|
setProgress((prev) => {
|
2026-11-11 14:59:21 +05:30
|
|
|
if (prev >= 94) return 94; // Wait for backend resolution
|
|
|
|
|
const delta = Math.max(1, Math.floor((95 - prev) * 0.16));
|
2026-11-11 10:47:00 +05:30
|
|
|
return Math.min(94, prev + delta);
|
|
|
|
|
});
|
2026-11-11 14:59:21 +05:30
|
|
|
}, 140);
|
2026-11-11 10:47:00 +05:30
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
clearInterval(stageInterval);
|
|
|
|
|
clearInterval(progressInterval);
|
|
|
|
|
};
|
|
|
|
|
}, [stages.length]);
|
|
|
|
|
|
|
|
|
|
return (
|
2026-11-11 14:59:21 +05:30
|
|
|
<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">
|
2026-11-11 10:47:00 +05:30
|
|
|
|
2026-11-11 14:59:21 +05:30
|
|
|
{/* 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 */}
|
2026-11-11 10:47:00 +05:30
|
|
|
<div
|
2026-11-11 14:59:21 +05:30
|
|
|
className="absolute inset-0 rounded-full border-2 border-transparent border-t-accent border-r-accent/60 animate-spin"
|
|
|
|
|
style={{ animationDuration: '1s' }}
|
2026-11-11 10:47:00 +05:30
|
|
|
/>
|
2026-11-11 14:59:21 +05:30
|
|
|
|
|
|
|
|
{/* 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" />
|
2026-11-11 10:47:00 +05:30
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-11-11 14:59:21 +05:30
|
|
|
{/* 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">
|
2026-11-11 10:47:00 +05:30
|
|
|
{stages[currentStageIdx]}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-11-11 14:59:21 +05:30
|
|
|
{/* 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>
|
2026-11-11 10:47:00 +05:30
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|