Harsha1845 commited on
Commit
1b7ad81
·
verified ·
1 Parent(s): a98a749

Update src/components/ResultView.tsx

Browse files
Files changed (1) hide show
  1. src/components/ResultView.tsx +33 -16
src/components/ResultView.tsx CHANGED
@@ -1,6 +1,6 @@
1
  import React, { useEffect, useState } from 'react';
2
  import { Product } from '../types';
3
- import { RefreshCw, AlertCircle, Sparkles, ScanFace, Timer, Play } from 'lucide-react';
4
 
5
  interface ResultViewProps {
6
  originalImage: string;
@@ -25,6 +25,7 @@ const ResultView: React.FC<ResultViewProps> = ({
25
  }) => {
26
  const [progressStep, setProgressStep] = useState(0);
27
  const [timeLeft, setTimeLeft] = useState<number | null>(null);
 
28
 
29
  useEffect(() => {
30
  if (loading) {
@@ -49,10 +50,10 @@ const ResultView: React.FC<ResultViewProps> = ({
49
  }, [retryAfter]);
50
 
51
  const loadingTexts = [
52
- "Analyzing pose...",
53
- "Fitting garment...",
54
- "Adjusting shadows...",
55
- "Finalizing..."
56
  ];
57
 
58
  return (
@@ -95,15 +96,15 @@ const ResultView: React.FC<ResultViewProps> = ({
95
  <div className="bg-brand-500/20 p-5 rounded-full mb-6">
96
  <Timer className="w-12 h-12 text-brand-400 animate-pulse" />
97
  </div>
98
- <h4 className="text-2xl font-bold mb-3">AI is busy</h4>
99
  <p className="text-slate-400 text-sm mb-8 max-w-xs">
100
- The free AI tier is at capacity. We can try again automatically in:
101
  </p>
102
- <div className="text-5xl font-mono font-bold text-brand-400 mb-10">
103
  {timeLeft}s
104
  </div>
105
  <div className="flex gap-4">
106
- <button onClick={onRetake} className="px-6 py-3 bg-white/10 hover:bg-white/20 rounded-xl font-bold transition-all">Cancel</button>
107
  <button
108
  onClick={onRetry}
109
  disabled={timeLeft > 0}
@@ -117,11 +118,27 @@ const ResultView: React.FC<ResultViewProps> = ({
117
  )}
118
 
119
  {error && timeLeft === null && (
120
- <div className="absolute inset-0 flex flex-col items-center justify-center p-8 text-center bg-slate-800">
121
- <AlertCircle className="w-12 h-12 text-red-500 mb-4" />
122
- <h4 className="text-white font-bold text-lg mb-2">Generation Error</h4>
123
- <p className="text-gray-400 text-sm mb-8">{error}</p>
124
- <button onClick={onRetake} className="px-8 py-3 bg-white text-black rounded-xl font-bold hover:bg-gray-100 transition-colors">Try Again</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  </div>
126
  )}
127
 
@@ -134,10 +151,10 @@ const ResultView: React.FC<ResultViewProps> = ({
134
  <div className="grid grid-cols-2 gap-3 mt-2">
135
  <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">
136
  <RefreshCw className="w-4 h-4" />
137
- Retake Photo
138
  </button>
139
  <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">
140
- Add to Wardrobe
141
  </button>
142
  </div>
143
  )}
 
1
  import React, { useEffect, useState } from 'react';
2
  import { Product } from '../types';
3
+ import { RefreshCw, AlertCircle, Sparkles, ScanFace, Timer, Play, ChevronDown, ChevronUp, Bug } from 'lucide-react';
4
 
5
  interface ResultViewProps {
6
  originalImage: string;
 
25
  }) => {
26
  const [progressStep, setProgressStep] = useState(0);
27
  const [timeLeft, setTimeLeft] = useState<number | null>(null);
28
+ const [showDetails, setShowDetails] = useState(false);
29
 
30
  useEffect(() => {
31
  if (loading) {
 
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 (
 
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">
107
+ <button onClick={onRetake} className="px-6 py-3 bg-white/10 hover:bg-white/20 rounded-xl font-bold transition-all">Back</button>
108
  <button
109
  onClick={onRetry}
110
  disabled={timeLeft > 0}
 
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
+
135
+ {showDetails && (
136
+ <div className="bg-black/50 p-3 rounded-lg border border-white/10 text-left mb-6 max-h-32 overflow-y-auto w-full">
137
+ <code className="text-[10px] text-red-400 break-all">{error}</code>
138
+ </div>
139
+ )}
140
+
141
+ <button onClick={onRetake} className="px-8 py-3 bg-white text-black rounded-xl font-bold hover:bg-gray-100 transition-colors">Go Back</button>
142
  </div>
143
  )}
144
 
 
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
  )}