refactor(workspace): unify application workflow

This commit is contained in:
cesnimda
2026-08-28 12:28:12 +02:00
parent 4da673ff00
commit e3f938cb42
8 changed files with 264 additions and 102 deletions
+17 -11
View File
@@ -79,26 +79,30 @@ export const CHECKLIST_CATEGORIES: { key: string; label: string }[] = [
// Workspace navigation. Sections map to the Phase 5 milestones; each is added as its milestone lands
// so the workspace is always usable rather than a shell of placeholders.
export type WorkspaceSectionKey =
| "overview" | "job-details" | "analysis" | "match" | "checklist" | "cv" | "cover-letter"
| "documents" | "interview" | "timeline" | "communication";
export type WorkspaceSectionKey = "overview" | "analysis" | "cv" | "cover-letter" | "interview";
export const WORKSPACE_SECTIONS: { key: WorkspaceSectionKey; label: string }[] = [
{ key: "overview", label: "Overview" },
{ key: "job-details", label: "Job Details" },
{ key: "analysis", label: "Analysis" },
{ key: "match", label: "Match" },
{ key: "checklist", label: "Checklist" },
{ key: "cv", label: "CV" },
{ key: "cover-letter", label: "Cover Letter" },
{ key: "documents", label: "Documents" },
{ key: "interview", label: "Interview Prep" },
{ key: "timeline", label: "Timeline" },
{ key: "communication", label: "Communication" },
];
export const workspaceSection = (value: string | null): WorkspaceSectionKey =>
WORKSPACE_SECTIONS.some((section) => section.key === value) ? value as WorkspaceSectionKey : "overview";
const LEGACY_WORKSPACE_SECTIONS: Record<string, WorkspaceSectionKey> = {
match: "analysis",
"job-details": "overview",
checklist: "overview",
documents: "overview",
timeline: "overview",
communication: "overview",
};
/** Preserve old shared/bookmarked workspace links while keeping one clear primary navigation. */
export const workspaceSection = (value: string | null): WorkspaceSectionKey => {
if (value && value in LEGACY_WORKSPACE_SECTIONS) return LEGACY_WORKSPACE_SECTIONS[value];
return WORKSPACE_SECTIONS.some((section) => section.key === value) ? value as WorkspaceSectionKey : "overview";
};
export const applicationWorkspaceApi = {
overview: (jobId: number) =>
@@ -158,6 +162,8 @@ export type CareerMatch = {
relevantProjects: MatchEvidence[];
suggestions: string[];
aiSuggestionCount: number;
hasSelectedCv: boolean;
selectedCvName: string | null;
};
export const TIMELINE_CATEGORY_LABELS: Record<string, string> = {