Spaces:
Sleeping
Sleeping
Commit
·
9b88237
1
Parent(s):
89b8f9f
Update
Browse files
frontend/src/components/ResultsPanel.tsx
CHANGED
|
@@ -12,6 +12,12 @@ interface ResultsPanelProps {
|
|
| 12 |
|
| 13 |
export function ResultsPanel({ uploadedImage, result, loading }: ResultsPanelProps) {
|
| 14 |
const [showReportModal, setShowReportModal] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
const handleGenerateReport = async (formData: FormData) => {
|
| 17 |
try {
|
|
@@ -38,11 +44,11 @@ export function ResultsPanel({ uploadedImage, result, loading }: ResultsPanelPro
|
|
| 38 |
}
|
| 39 |
};
|
| 40 |
|
| 41 |
-
if (
|
| 42 |
return (
|
| 43 |
<div className="bg-white rounded-lg shadow-sm p-6 flex flex-col items-center justify-center">
|
| 44 |
<Loader2Icon className="w-10 h-10 text-blue-600 animate-spin mb-3" />
|
| 45 |
-
<p className="text-teal-700 font-medium">
|
| 46 |
</div>
|
| 47 |
);
|
| 48 |
}
|
|
|
|
| 12 |
|
| 13 |
export function ResultsPanel({ uploadedImage, result, loading }: ResultsPanelProps) {
|
| 14 |
const [showReportModal, setShowReportModal] = useState(false);
|
| 15 |
+
// Make loading detection robust: sometimes values arrive as the string "true" from deployed envs
|
| 16 |
+
const isLoading = loading === true || String(loading) === "true";
|
| 17 |
+
|
| 18 |
+
// Helpful debug information when checking issues on deployed spaces (open browser devtools)
|
| 19 |
+
// Keep as debug (console.debug) so it doesn't clutter normal logs.
|
| 20 |
+
console.debug("ResultsPanel: props", { loading, isLoading, result });
|
| 21 |
|
| 22 |
const handleGenerateReport = async (formData: FormData) => {
|
| 23 |
try {
|
|
|
|
| 44 |
}
|
| 45 |
};
|
| 46 |
|
| 47 |
+
if (isLoading) {
|
| 48 |
return (
|
| 49 |
<div className="bg-white rounded-lg shadow-sm p-6 flex flex-col items-center justify-center">
|
| 50 |
<Loader2Icon className="w-10 h-10 text-blue-600 animate-spin mb-3" />
|
| 51 |
+
<p className="text-teal-700 font-medium">Analysing Report..</p>
|
| 52 |
</div>
|
| 53 |
);
|
| 54 |
}
|