Harsha1845 commited on
Commit
809dc87
·
verified ·
1 Parent(s): 8dad39c

Update src/components/ResultView.tsx

Browse files
Files changed (1) hide show
  1. src/components/ResultView.tsx +19 -19
src/components/ResultView.tsx CHANGED
@@ -32,7 +32,7 @@ const ResultView: React.FC<ResultViewProps> = ({
32
  setProgressStep(0);
33
  const interval = setInterval(() => {
34
  setProgressStep(prev => (prev < 3 ? prev + 1 : prev));
35
- }, 1500);
36
  return () => clearInterval(interval);
37
  }
38
  }, [loading]);
@@ -50,10 +50,10 @@ const ResultView: React.FC<ResultViewProps> = ({
50
  }, [retryAfter]);
51
 
52
  const loadingTexts = [
53
- "Resizing to atomic scale...",
54
- "Injecting garments...",
55
- "Re-lighting scene...",
56
- "Finalizing pixels..."
57
  ];
58
 
59
  return (
@@ -62,7 +62,7 @@ const ResultView: React.FC<ResultViewProps> = ({
62
 
63
  {/* Sidebar Preview */}
64
  <div className="w-full md:w-1/3 bg-white p-3 rounded-2xl shadow-sm border border-gray-100 flex flex-col gap-2">
65
- <h3 className="text-xs font-bold text-gray-400 uppercase tracking-widest px-1">Source Photo</h3>
66
  <div className="aspect-[3/4] rounded-xl overflow-hidden bg-gray-100 relative">
67
  <img src={originalImage} alt="Original" className="w-full h-full object-cover" />
68
  <div className="absolute bottom-2 right-2 bg-white/90 backdrop-blur rounded-lg p-1 shadow-sm w-12 h-12 border border-gray-200">
@@ -75,7 +75,7 @@ const ResultView: React.FC<ResultViewProps> = ({
75
  <div className="w-full md:w-2/3 bg-white p-3 rounded-2xl shadow-lg border border-gray-100 flex flex-col gap-2 relative min-h-[400px]">
76
  <h3 className="text-sm font-semibold text-brand-600 uppercase tracking-wide px-1 flex items-center gap-2">
77
  <Sparkles className="w-4 h-4 text-brand-500" />
78
- AI Generation
79
  </h3>
80
 
81
  <div className="aspect-[3/4] md:aspect-square rounded-xl overflow-hidden bg-slate-900 relative flex items-center justify-center">
@@ -86,21 +86,21 @@ const ResultView: React.FC<ResultViewProps> = ({
86
  <div className="absolute inset-0 w-16 h-16 border-4 border-brand-500 border-t-transparent rounded-full animate-spin"></div>
87
  <ScanFace className="absolute inset-0 w-8 h-8 m-auto text-brand-500 animate-pulse" />
88
  </div>
89
- <h4 className="text-xl font-bold mb-2">Creating Your Look</h4>
90
  <p className="text-brand-300 font-medium animate-pulse">{loadingTexts[progressStep]}</p>
91
  </div>
92
  )}
93
 
94
  {timeLeft !== null && (
95
  <div className="absolute inset-0 flex flex-col items-center justify-center p-8 text-center bg-slate-900 text-white z-20">
96
- <div className="bg-brand-500/20 p-5 rounded-full mb-6">
97
- <Timer className="w-12 h-12 text-brand-400 animate-pulse" />
98
  </div>
99
- <h4 className="text-2xl font-bold mb-3">Rate Limit</h4>
100
  <p className="text-slate-400 text-sm mb-8 max-w-xs">
101
- Google's free tier allows 1 try-on every 60 seconds.
102
  </p>
103
- <div className="text-6xl font-mono font-bold text-brand-400 mb-10">
104
  {timeLeft}s
105
  </div>
106
  <div className="flex gap-4">
@@ -118,17 +118,17 @@ const ResultView: React.FC<ResultViewProps> = ({
118
  )}
119
 
120
  {error && timeLeft === null && (
121
- <div className="absolute inset-0 flex flex-col items-center justify-center p-8 text-center bg-slate-800 overflow-y-auto">
122
  <AlertCircle className="w-10 h-10 text-red-500 mb-4" />
123
- <h4 className="text-white font-bold text-lg mb-2">Service Limit Reached</h4>
124
- <p className="text-gray-400 text-sm mb-6 px-4">The free quota for this API key is currently exhausted. This usually resets in a few minutes.</p>
125
 
126
  <button
127
  onClick={() => setShowDetails(!showDetails)}
128
  className="flex items-center gap-2 text-[10px] text-gray-500 uppercase tracking-widest mb-4 hover:text-gray-300 transition-colors"
129
  >
130
  <Bug className="w-3 h-3" />
131
- Technical Diagnostics
132
  {showDetails ? <ChevronUp className="w-3 h-3" /> : <ChevronDown className="w-3 h-3" />}
133
  </button>
134
 
@@ -151,10 +151,10 @@ const ResultView: React.FC<ResultViewProps> = ({
151
  <div className="grid grid-cols-2 gap-3 mt-2">
152
  <button onClick={onRetake} className="flex items-center justify-center gap-2 py-4 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl font-bold transition-all">
153
  <RefreshCw className="w-4 h-4" />
154
- New Photo
155
  </button>
156
  <button className="flex items-center justify-center gap-2 py-4 bg-brand-600 hover:bg-brand-700 text-white rounded-xl font-bold transition-all shadow-lg shadow-brand-200">
157
- Save Look
158
  </button>
159
  </div>
160
  )}
 
32
  setProgressStep(0);
33
  const interval = setInterval(() => {
34
  setProgressStep(prev => (prev < 3 ? prev + 1 : prev));
35
+ }, 2000);
36
  return () => clearInterval(interval);
37
  }
38
  }, [loading]);
 
50
  }, [retryAfter]);
51
 
52
  const loadingTexts = [
53
+ "Encoding micro-pixels...",
54
+ "Analyzing garment...",
55
+ "Synthesizing fit...",
56
+ "Almost there..."
57
  ];
58
 
59
  return (
 
62
 
63
  {/* Sidebar Preview */}
64
  <div className="w-full md:w-1/3 bg-white p-3 rounded-2xl shadow-sm border border-gray-100 flex flex-col gap-2">
65
+ <h3 className="text-xs font-bold text-gray-400 uppercase tracking-widest px-1">Source</h3>
66
  <div className="aspect-[3/4] rounded-xl overflow-hidden bg-gray-100 relative">
67
  <img src={originalImage} alt="Original" className="w-full h-full object-cover" />
68
  <div className="absolute bottom-2 right-2 bg-white/90 backdrop-blur rounded-lg p-1 shadow-sm w-12 h-12 border border-gray-200">
 
75
  <div className="w-full md:w-2/3 bg-white p-3 rounded-2xl shadow-lg border border-gray-100 flex flex-col gap-2 relative min-h-[400px]">
76
  <h3 className="text-sm font-semibold text-brand-600 uppercase tracking-wide px-1 flex items-center gap-2">
77
  <Sparkles className="w-4 h-4 text-brand-500" />
78
+ AI Studio
79
  </h3>
80
 
81
  <div className="aspect-[3/4] md:aspect-square rounded-xl overflow-hidden bg-slate-900 relative flex items-center justify-center">
 
86
  <div className="absolute inset-0 w-16 h-16 border-4 border-brand-500 border-t-transparent rounded-full animate-spin"></div>
87
  <ScanFace className="absolute inset-0 w-8 h-8 m-auto text-brand-500 animate-pulse" />
88
  </div>
89
+ <h4 className="text-xl font-bold mb-2">Generating...</h4>
90
  <p className="text-brand-300 font-medium animate-pulse">{loadingTexts[progressStep]}</p>
91
  </div>
92
  )}
93
 
94
  {timeLeft !== null && (
95
  <div className="absolute inset-0 flex flex-col items-center justify-center p-8 text-center bg-slate-900 text-white z-20">
96
+ <div className="bg-amber-500/20 p-5 rounded-full mb-6">
97
+ <Timer className="w-12 h-12 text-amber-400 animate-pulse" />
98
  </div>
99
+ <h4 className="text-2xl font-bold mb-3 text-amber-400">AI Cooling Down</h4>
100
  <p className="text-slate-400 text-sm mb-8 max-w-xs">
101
+ To prevent errors, please wait 2 minutes between attempts on the free tier.
102
  </p>
103
+ <div className="text-6xl font-mono font-bold text-white mb-10">
104
  {timeLeft}s
105
  </div>
106
  <div className="flex gap-4">
 
118
  )}
119
 
120
  {error && timeLeft === null && (
121
+ <div className="absolute inset-0 flex flex-col items-center justify-center p-8 text-center bg-slate-800">
122
  <AlertCircle className="w-10 h-10 text-red-500 mb-4" />
123
+ <h4 className="text-white font-bold text-lg mb-2">Service Delay</h4>
124
+ <p className="text-gray-400 text-sm mb-6 px-4">The AI encountered a limit. Wait a moment then retry.</p>
125
 
126
  <button
127
  onClick={() => setShowDetails(!showDetails)}
128
  className="flex items-center gap-2 text-[10px] text-gray-500 uppercase tracking-widest mb-4 hover:text-gray-300 transition-colors"
129
  >
130
  <Bug className="w-3 h-3" />
131
+ Diagnostics
132
  {showDetails ? <ChevronUp className="w-3 h-3" /> : <ChevronDown className="w-3 h-3" />}
133
  </button>
134
 
 
151
  <div className="grid grid-cols-2 gap-3 mt-2">
152
  <button onClick={onRetake} className="flex items-center justify-center gap-2 py-4 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl font-bold transition-all">
153
  <RefreshCw className="w-4 h-4" />
154
+ Retake
155
  </button>
156
  <button className="flex items-center justify-center gap-2 py-4 bg-brand-600 hover:bg-brand-700 text-white rounded-xl font-bold transition-all shadow-lg shadow-brand-200">
157
+ Save
158
  </button>
159
  </div>
160
  )}