Spaces:
Sleeping

File size: 1,874 Bytes
4a9cd63
978c76c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a9cd63
 
 
978c76c
4a9cd63
 
 
 
978c76c
4a9cd63
 
 
 
978c76c
 
 
 
 
 
 
 
 
 
 
 
 
4a9cd63
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React, { useState, useEffect } from 'react';
import { CheckCircle2, Circle, Loader2 } from 'lucide-react';

const STEPS = {
    cv: [
        "Analyzing job requirements",
        "Identifying your best achievements",
        "Drafting professional summary",
        "Optimizing bullet points with the STAR method",
        "Applying ATS-friendly formatting",
        "Compiling your CV"
    ],
    cover_letter: [
        "Analyzing job requirements",
        "Matching your experience",
        "Crafting a compelling opening",
        "Highlighting key achievements",
        "Writing a professional closing",
        "Generating PDF"
    ],
    analysis: [
        "Reading your CV",
        "Extracting skills and experience",
        "Comparing against the job requirements",
        "Calculating your match score"
    ]
};

const GenerationProgress = ({ type = 'cv' }) => {
    const [step, setStep] = useState(0);
    const steps = STEPS[type] || STEPS.cv;

    useEffect(() => {
        const interval = setInterval(() => {
            setStep(s => (s < steps.length - 1 ? s + 1 : s));
        }, 2000);
        return () => clearInterval(interval);
    }, [steps.length]);

    return (
        <ul className="progress-steps" aria-live="polite">
            {steps.map((label, i) => {
                const state = i < step ? 'done' : i === step ? 'current' : 'pending';
                return (
                    <li key={label} className={`progress-step ${state}`}>
                        {state === 'done' && <CheckCircle2 size={18} />}
                        {state === 'current' && <Loader2 size={18} className="spinner" />}
                        {state === 'pending' && <Circle size={18} />}
                        {label}
                    </li>
                );
            })}
        </ul>
    );
};

export default GenerationProgress;