feat(S05/T01): Unified workflow trust signals across the API, table, da…

- JobTrackerApi/Controllers/JobApplicationsController.cs
- JobTrackerApi.Tests/JobApplicationsWorkflowSignalsTests.cs
- job-tracker-ui/src/jobWorkflowSignals.ts
- job-tracker-ui/src/components/JobTable.tsx
- job-tracker-ui/src/components/DashboardView.tsx
- job-tracker-ui/src/components/RemindersView.tsx
- job-tracker-ui/src/workflow-trust-signals.test.tsx
This commit is contained in:
2026-03-24 14:28:01 +01:00
parent d166f9854d
commit 9adbde3f5e
12 changed files with 974 additions and 314 deletions
+16 -16
View File
@@ -5,9 +5,9 @@ import { Box, Button, Chip, Divider, Paper, Typography } from "@mui/material";
import { api } from "../api";
import { JobApplication } from "../types";
import { buildWorkflowPath, getReminderGroup, getWorkflowAction } from "../jobWorkflowSignals";
import { useToast } from "../toast";
import { useI18n } from "../i18n/I18nProvider";
import { buildJobWorkspacePath, JOB_DETAILS_TABS } from "../jobWorkspaceRoute";
type ReminderGroups = {
missingCv: JobApplication[];
@@ -19,11 +19,8 @@ type ReminderGroups = {
function groupItems(items: JobApplication[]): ReminderGroups {
const groups: ReminderGroups = { missingCv: [], missingInterviewNotes: [], overdueFollowUp: [], other: [] };
items.forEach((item) => {
const reason = (item.followUpReason ?? "").toLowerCase();
if (reason.includes("tailored cv")) groups.missingCv.push(item);
else if (reason.includes("interview prep") || reason.includes("prep notes")) groups.missingInterviewNotes.push(item);
else if (reason.includes("follow-up") || reason.includes("follow up")) groups.overdueFollowUp.push(item);
else groups.other.push(item);
const group = getReminderGroup(item);
groups[group].push(item);
});
return groups;
}
@@ -35,7 +32,15 @@ function ReminderSection({ title, items, onOpen, onSetFollowUp }: { title: strin
return (
<Box sx={{ display: "flex", flexDirection: "column", gap: 1.25 }}>
<Typography variant="h6">{title}</Typography>
{items.map((j) => (
{items.map((j) => {
const action = getWorkflowAction(j, {
packageWork: t("jobTablePackageWork"),
followUp: t("jobTableFollowUp"),
interviewPrep: t("jobTableInterviewStage"),
readiness: t("jobTableReadiness"),
});
return (
<Paper key={j.id} sx={{ p: 1.5, display: "grid", gridTemplateColumns: "1fr auto", gap: 1, alignItems: "center" }}>
<Box>
<Typography sx={{ fontWeight: 900, lineHeight: 1.25 }}>
@@ -43,19 +48,19 @@ function ReminderSection({ title, items, onOpen, onSetFollowUp }: { title: strin
</Typography>
<Box sx={{ display: "flex", gap: 1, mt: 0.5, flexWrap: "wrap" }}>
{j.needsFollowUp ? <Chip size="small" color="warning" label={t("remindersFollowUpLabel")} /> : null}
{j.followUpReason ? <Chip size="small" label={j.followUpReason} variant="outlined" /> : null}
{(j.workflowSignal?.reason ?? j.followUpReason) ? <Chip size="small" label={j.workflowSignal?.reason ?? j.followUpReason} variant="outlined" /> : null}
{j.followUpAt ? <Chip size="small" label={t("remindersFollowUpDate", { date: new Date(j.followUpAt).toLocaleDateString() })} variant="outlined" /> : null}
<Chip size="small" label={j.status} variant="outlined" />
</Box>
</Box>
<Box sx={{ display: "flex", gap: 1, flexWrap: "wrap", justifyContent: "flex-end" }}>
<Button size="small" variant="outlined" onClick={() => onOpen(j)}>{t("remindersOpen")}</Button>
<Button size="small" variant="outlined" onClick={() => onOpen(j)}>{action?.label ?? t("remindersOpen")}</Button>
<Button size="small" variant="outlined" onClick={() => onSetFollowUp(j.id, 3)}>+3d</Button>
<Button size="small" variant="outlined" onClick={() => onSetFollowUp(j.id, 7)}>+7d</Button>
<Button size="small" onClick={() => onSetFollowUp(j.id, null)}>{t("remindersClear")}</Button>
</Box>
</Paper>
))}
)})}
</Box>
);
}
@@ -78,12 +83,7 @@ export default function RemindersView() {
const grouped = useMemo(() => groupItems(items), [items]);
const openJob = (job: JobApplication) => {
const reason = (job.followUpReason ?? '').toLowerCase();
if (reason.includes('tailored cv')) {
navigate(buildJobWorkspacePath(job.id, { tab: JOB_DETAILS_TABS.tailoredCv }));
return;
}
navigate(buildJobWorkspacePath(job.id, { tab: JOB_DETAILS_TABS.followUp, followMode: 'waiting-update' }));
navigate(buildWorkflowPath(job));
};
const setFollowUp = async (id: number, daysFromNow: number | null) => {