fix(app): harden account and workflow state

This commit is contained in:
cesnimda
2026-08-24 20:21:09 +02:00
parent e7cacad7d6
commit dca5daa1a2
32 changed files with 811 additions and 86 deletions
@@ -12,6 +12,7 @@ import { getApiErrorMessage } from "../api";
import {
ApplicationCv, CoverLetter, TailoringPlan, applicationAssetsApi,
} from "../applicationWorkspace";
import { cvBuilderApi } from "../cvBuilder";
// Phase 5.4 — Application Assets sections for the workspace.
//
@@ -100,6 +101,20 @@ export function ApplicationCvSection({ jobId }: { jobId: number }) {
const attached = data?.attachedVariantId ?? "";
const duplicateForJob = async () => {
if (!data?.attachedVariantId) return;
setBusy(true);
try {
const copy = await cvBuilderApi.duplicate(data.attachedVariantId, `${data.attachedVariantName || "CV"} — tailored copy`);
setData(await applicationAssetsApi.attachVariant(jobId, copy.id));
window.location.assign(`/career/builder/${copy.id}`);
} catch (err) {
setError(getApiErrorMessage(err, "Could not create a tailored CV copy."));
} finally {
setBusy(false);
}
};
return (
<Stack spacing={2}>
<Shell
@@ -155,6 +170,9 @@ export function ApplicationCvSection({ jobId }: { jobId: number }) {
>
Edit, preview and export
</Button>
<Button size="small" variant="contained" disabled={busy} onClick={() => void duplicateForJob()}>
Duplicate for this job
</Button>
</Stack>
</Stack>
</Paper>