Files
pitchfast/lib/audits/progress.ts

76 lines
1.5 KiB
TypeScript

export const AUDIT_PROGRESS_TOTAL_STEPS = 6;
export type AuditProgress = {
step: number;
total: number;
label: string;
percent: number;
};
const fallbackProgress: AuditProgress = {
step: 1,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Audit vorbereitet",
percent: 17,
};
const progressByStep: Record<string, AuditProgress> = {
audit_prepared: fallbackProgress,
pagespeed_insights: {
step: 2,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Messe PageSpeed",
percent: 33,
},
website_signals: {
step: 3,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Sammle Website-Signale",
percent: 50,
},
classification: {
step: 4,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Bewerte Befunde",
percent: 67,
},
evidenceVerifier: {
step: 4,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Bewerte Befunde",
percent: 67,
},
multimodalAudit: {
step: 4,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Bewerte Befunde",
percent: 67,
},
germanCopy: {
step: 5,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Erstelle Texte",
percent: 83,
},
qualityReview: {
step: 6,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Speichere Audit",
percent: 100,
},
persist_audit: {
step: 6,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Speichere Audit",
percent: 100,
},
};
export function getAuditProgressForStep(step: string | null | undefined) {
if (!step) {
return fallbackProgress;
}
return progressByStep[step] ?? fallbackProgress;
}