From 6d19abef2ccfe41a060361010b4a7681dfc1e005 Mon Sep 17 00:00:00 2001 From: Maximilian Kaske Date: Tue, 29 Sep 2026 20:34:22 +0200 Subject: [PATCH] dashboard: incidents list review fixes Slack channel column, reject future start times, note the list order and the prefetched commander default. Co-Authored-By: Claude Fable 5.1 --- .../src/app/(dashboard)/incidents/client.tsx | 1 + .../data-table/managed-incidents/columns.tsx | 15 +++++++++++++++ .../src/components/forms/incident/form.tsx | 10 +++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/src/app/(dashboard)/incidents/client.tsx b/apps/dashboard/src/app/(dashboard)/incidents/client.tsx index be78aa5d..b67b5609 100644 --- a/apps/dashboard/src/app/(dashboard)/incidents/client.tsx +++ b/apps/dashboard/src/app/(dashboard)/incidents/client.tsx @@ -70,6 +70,7 @@ export function Client() { ) : ( + // incident.list already sorts open first, then newest declared. )} diff --git a/apps/dashboard/src/components/data-table/managed-incidents/columns.tsx b/apps/dashboard/src/components/data-table/managed-incidents/columns.tsx index bff0a6bd..138712dc 100644 --- a/apps/dashboard/src/components/data-table/managed-incidents/columns.tsx +++ b/apps/dashboard/src/components/data-table/managed-incidents/columns.tsx @@ -7,6 +7,7 @@ import { formatDistanceStrict } from "date-fns"; import { Link } from "@/components/common/link"; import { TableCellDate } from "@/components/data-table/table-cell-date"; +import { TableCellLink } from "@/components/data-table/table-cell-link"; import { TableCellNumber } from "@/components/data-table/table-cell-number"; import { TableCellText } from "@/components/data-table/table-cell-text"; import { @@ -97,4 +98,18 @@ export const columns: ColumnDef[] = [ ), meta: { cellClassName: "max-w-[200px] truncate" }, }, + { + id: "slack", + header: "Slack", + cell: ({ row }) => { + const { slackTeamId, slackChannelId } = row.original; + const bound = slackTeamId && slackChannelId; + return ( + + ); + }, + }, ]; diff --git a/apps/dashboard/src/components/forms/incident/form.tsx b/apps/dashboard/src/components/forms/incident/form.tsx index 16f625ec..f8640933 100644 --- a/apps/dashboard/src/components/forms/incident/form.tsx +++ b/apps/dashboard/src/components/forms/incident/form.tsx @@ -44,7 +44,13 @@ const schema = z.object({ severity: z.enum(incidentSeverity), summary: z.string().max(4000), commanderId: z.string(), - startedAt: z.string().min(1, "Start time is required."), + startedAt: z + .string() + .min(1, "Start time is required.") + .refine( + (value) => new Date(value) <= new Date(), + "Start time cannot be in the future.", + ), statusReportId: z.string(), }); @@ -84,6 +90,8 @@ export function FormDeclareIncident({ title: "", severity: "major", summary: "", + // user.get is prefetched in the dashboard layout, so it is hydrated + // before the sheet can mount and the default is never NONE for members. commanderId: user ? String(user.id) : NONE, startedAt: toLocalInput(new Date()), statusReportId: NONE, -- 2.51.2