Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions apps/web/app/dashboard/notes/note-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ type NoteTask = {
status: string
note: string
summaryUpdatedAt: string | null
taskUpdatedAt: string
taskUpdatedByName: string | null
taskUpdatedByType: string
assigned: {
id: string
name: string
Expand Down Expand Up @@ -89,13 +92,19 @@ export function NoteList({ companyId, reviewReader, initialNotes }: NoteListProp
</div>
<div className="flex flex-wrap items-center gap-2">
<Badge variant="outline">{formatStatus(task.status)}</Badge>
{task.summaryUpdatedAt ? (
<Badge variant="secondary">{formatDate(task.summaryUpdatedAt)}</Badge>
) : null}
<Badge variant="secondary">
Summary {formatNullableDate(task.summaryUpdatedAt)}
</Badge>
</div>
</div>
</CardHeader>
<CardContent className="space-y-3">
<SummaryAuditContext
summaryUpdatedAt={task.summaryUpdatedAt}
taskUpdatedAt={task.taskUpdatedAt}
taskUpdatedByName={task.taskUpdatedByName}
taskUpdatedByType={task.taskUpdatedByType}
/>
<ExpandableNote text={task.note} />
<div className="flex flex-wrap gap-2">
<Button asChild type="button" variant="outline" size="sm">
Expand Down Expand Up @@ -148,6 +157,39 @@ export function NoteList({ companyId, reviewReader, initialNotes }: NoteListProp
)
}

function SummaryAuditContext({
summaryUpdatedAt,
taskUpdatedAt,
taskUpdatedByName,
taskUpdatedByType,
}: {
summaryUpdatedAt: string | null
taskUpdatedAt: string
taskUpdatedByName: string | null
taskUpdatedByType: string
}) {
const actorLabel = taskUpdatedByName ?? fallbackActorLabel(taskUpdatedByType)

return (
<div className="rounded-2xl border bg-muted/40 px-3 py-2 text-xs text-muted-foreground">
<p>
Summary updated: {formatNullableDate(summaryUpdatedAt)} · Last task update by {actorLabel} ({taskUpdatedByType || "unknown"}) at {formatDate(taskUpdatedAt)}
</p>
</div>
)
}

function formatNullableDate(value: string | null) {
return value ? formatDate(value) : "unknown"
}

function fallbackActorLabel(actorType: string) {
if (actorType === "agent") return "Unknown agent"
if (actorType === "user") return "Unknown user"
if (actorType === "system") return "System"
return "Unknown actor"
}

function ExpandableNote({ text }: { text: string }) {
const [expanded, setExpanded] = useState(false)
const compact = text.length > 320 || text.includes("\n")
Expand Down
6 changes: 6 additions & 0 deletions apps/web/app/dashboard/notes/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export default async function NotesPage({ searchParams }: NotesPageProps) {
status: true,
note: true,
summaryUpdatedAt: true,
taskUpdatedAt: true,
taskUpdatedByName: true,
taskUpdatedByType: true,
assigned: {
select: {
id: true,
Expand Down Expand Up @@ -98,6 +101,9 @@ export default async function NotesPage({ searchParams }: NotesPageProps) {
status: task.status,
note: task.note ?? "",
summaryUpdatedAt: task.summaryUpdatedAt?.toISOString() ?? null,
taskUpdatedAt: task.taskUpdatedAt.toISOString(),
taskUpdatedByName: task.taskUpdatedByName,
taskUpdatedByType: task.taskUpdatedByType,
assigned: task.assigned,
project: task.project,
}))}
Expand Down
15 changes: 12 additions & 3 deletions apps/web/lib/api/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,20 @@ export function createOpenApiDocument() {
summaryUpdatedAt: {
type: ["string", "null"],
format: "date-time",
description: "When note/summary was last explicitly changed.",
description:
"Stored freshness timestamp for note/summary content. It is set when a non-empty note changes, cleared when the note is cleared, and remains null/unchanged otherwise; it does not fall back to taskUpdatedAt.",
},
taskUpdatedAt: {
type: "string",
format: "date-time",
description:
"Latest task mutation timestamp, including note/summary changes. Use with taskUpdatedBy* to audit who changed the task while summaryUpdatedAt tracks summary freshness.",
},
taskUpdatedAt: { type: "string", format: "date-time" },
taskUpdatedById: { type: ["string", "null"], format: "uuid" },
taskUpdatedByName: { type: ["string", "null"] },
taskUpdatedByName: {
type: ["string", "null"],
description: "Display name for the latest task updater when available.",
},
taskUpdatedByType: { type: "string" },
blockingReason: { type: ["string", "null"] },
archivedAt: { type: ["string", "null"], format: "date-time" },
Expand Down
Loading