Spaces:
Running
Running
Update frontend/src/components/ocr/ProcessingStatus.jsx
Browse files
frontend/src/components/ocr/ProcessingStatus.jsx
CHANGED
|
@@ -10,10 +10,10 @@ import {
|
|
| 10 |
import { cn } from "@/lib/utils";
|
| 11 |
|
| 12 |
const steps = [
|
| 13 |
-
{ id: "upload", label: "
|
| 14 |
-
{ id: "analyze", label: "
|
| 15 |
-
{ id: "extract", label: "
|
| 16 |
-
{ id: "complete", label: "
|
| 17 |
];
|
| 18 |
|
| 19 |
export default function ProcessingStatus({ isProcessing, isComplete }) {
|
|
@@ -31,67 +31,56 @@ export default function ProcessingStatus({ isProcessing, isComplete }) {
|
|
| 31 |
<motion.div
|
| 32 |
initial={{ opacity: 0, y: -10 }}
|
| 33 |
animate={{ opacity: 1, y: 0 }}
|
| 34 |
-
className="bg-white rounded-
|
| 35 |
>
|
| 36 |
-
<div className="flex items-center justify-between">
|
| 37 |
{steps.map((step, index) => {
|
| 38 |
const isActive = index + 1 === currentStep;
|
| 39 |
-
const isCompleted = index + 1 < currentStep;
|
| 40 |
const Icon = step.icon;
|
| 41 |
|
| 42 |
return (
|
| 43 |
<React.Fragment key={step.id}>
|
| 44 |
-
<div className="flex
|
| 45 |
<motion.div
|
| 46 |
initial={false}
|
| 47 |
animate={{
|
| 48 |
-
scale: isActive ? 1.
|
| 49 |
backgroundColor: isCompleted
|
| 50 |
? "rgb(16 185 129)"
|
| 51 |
-
: isActive
|
| 52 |
? "rgb(99 102 241)"
|
| 53 |
: "rgb(241 245 249)",
|
| 54 |
}}
|
| 55 |
className={cn(
|
| 56 |
-
"h-
|
| 57 |
-
(isCompleted || isActive) && "shadow-
|
| 58 |
)}
|
| 59 |
style={{
|
| 60 |
-
boxShadow: isActive
|
| 61 |
-
? "0 8px
|
| 62 |
: isCompleted
|
| 63 |
-
? "0 8px
|
| 64 |
: "none",
|
| 65 |
}}
|
| 66 |
>
|
| 67 |
-
{isActive && !isComplete ? (
|
| 68 |
<motion.div
|
| 69 |
animate={{ rotate: 360 }}
|
| 70 |
-
transition={{
|
| 71 |
-
duration: 1.5,
|
| 72 |
-
repeat: Infinity,
|
| 73 |
-
ease: "linear",
|
| 74 |
-
}}
|
| 75 |
>
|
| 76 |
-
<Loader2 className="h-
|
| 77 |
</motion.div>
|
|
|
|
|
|
|
| 78 |
) : (
|
| 79 |
-
<Icon
|
| 80 |
-
className={cn(
|
| 81 |
-
"h-5 w-5",
|
| 82 |
-
isCompleted || (isActive && isComplete) ? "text-white" : "text-slate-400"
|
| 83 |
-
)}
|
| 84 |
-
/>
|
| 85 |
)}
|
| 86 |
</motion.div>
|
| 87 |
<span
|
| 88 |
className={cn(
|
| 89 |
-
"text-xs font-medium
|
| 90 |
-
isActive
|
| 91 |
-
? "text-indigo-600"
|
| 92 |
-
: isCompleted
|
| 93 |
-
? "text-emerald-600"
|
| 94 |
-
: "text-slate-400"
|
| 95 |
)}
|
| 96 |
>
|
| 97 |
{step.label}
|
|
@@ -99,7 +88,7 @@ export default function ProcessingStatus({ isProcessing, isComplete }) {
|
|
| 99 |
</div>
|
| 100 |
|
| 101 |
{index < steps.length - 1 && (
|
| 102 |
-
<div className="flex-1 h-0.5 mx-
|
| 103 |
<motion.div
|
| 104 |
initial={{ width: 0 }}
|
| 105 |
animate={{
|
|
|
|
| 10 |
import { cn } from "@/lib/utils";
|
| 11 |
|
| 12 |
const steps = [
|
| 13 |
+
{ id: "upload", label: "Received", icon: FileSearch },
|
| 14 |
+
{ id: "analyze", label: "Analysis", icon: Cpu },
|
| 15 |
+
{ id: "extract", label: "Extraction", icon: TableProperties },
|
| 16 |
+
{ id: "complete", label: "Done", icon: CheckCircle2 },
|
| 17 |
];
|
| 18 |
|
| 19 |
export default function ProcessingStatus({ isProcessing, isComplete }) {
|
|
|
|
| 31 |
<motion.div
|
| 32 |
initial={{ opacity: 0, y: -10 }}
|
| 33 |
animate={{ opacity: 1, y: 0 }}
|
| 34 |
+
className="bg-white rounded-xl border border-slate-200 px-4 py-3"
|
| 35 |
>
|
| 36 |
+
<div className="flex items-center justify-between gap-2">
|
| 37 |
{steps.map((step, index) => {
|
| 38 |
const isActive = index + 1 === currentStep;
|
| 39 |
+
const isCompleted = index + 1 < currentStep || isComplete;
|
| 40 |
const Icon = step.icon;
|
| 41 |
|
| 42 |
return (
|
| 43 |
<React.Fragment key={step.id}>
|
| 44 |
+
<div className="flex items-center gap-2">
|
| 45 |
<motion.div
|
| 46 |
initial={false}
|
| 47 |
animate={{
|
| 48 |
+
scale: (isActive && !isComplete) ? 1.05 : 1,
|
| 49 |
backgroundColor: isCompleted
|
| 50 |
? "rgb(16 185 129)"
|
| 51 |
+
: (isActive && !isComplete)
|
| 52 |
? "rgb(99 102 241)"
|
| 53 |
: "rgb(241 245 249)",
|
| 54 |
}}
|
| 55 |
className={cn(
|
| 56 |
+
"h-8 w-8 rounded-lg flex items-center justify-center transition-colors",
|
| 57 |
+
(isCompleted || isActive) && "shadow-md"
|
| 58 |
)}
|
| 59 |
style={{
|
| 60 |
+
boxShadow: (isActive && !isComplete)
|
| 61 |
+
? "0 4px 8px -2px rgba(99, 102, 241, 0.3)"
|
| 62 |
: isCompleted
|
| 63 |
+
? "0 4px 8px -2px rgba(16, 185, 129, 0.3)"
|
| 64 |
: "none",
|
| 65 |
}}
|
| 66 |
>
|
| 67 |
+
{(isActive && !isComplete) ? (
|
| 68 |
<motion.div
|
| 69 |
animate={{ rotate: 360 }}
|
| 70 |
+
transition={{ duration: 1.5, repeat: Infinity, ease: "linear" }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
>
|
| 72 |
+
<Loader2 className="h-4 w-4 text-white" />
|
| 73 |
</motion.div>
|
| 74 |
+
) : isCompleted ? (
|
| 75 |
+
<CheckCircle2 className="h-4 w-4 text-white" />
|
| 76 |
) : (
|
| 77 |
+
<Icon className={cn("h-4 w-4 text-slate-400")} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
)}
|
| 79 |
</motion.div>
|
| 80 |
<span
|
| 81 |
className={cn(
|
| 82 |
+
"text-xs font-medium hidden sm:inline",
|
| 83 |
+
isActive ? "text-indigo-600" : isCompleted ? "text-emerald-600" : "text-slate-400"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
)}
|
| 85 |
>
|
| 86 |
{step.label}
|
|
|
|
| 88 |
</div>
|
| 89 |
|
| 90 |
{index < steps.length - 1 && (
|
| 91 |
+
<div className="flex-1 h-0.5 mx-1 relative overflow-hidden rounded-full bg-slate-100">
|
| 92 |
<motion.div
|
| 93 |
initial={{ width: 0 }}
|
| 94 |
animate={{
|