import type { CompletionTemplate } from "@/domain/completion-templates/types/completion-template"; import { formatTemplateDate } from "@/domain/completion-templates/utils/format-template-date"; import type { CompletionTemplateDialogMode } from "./use-completion-template-dialog"; export function dialogHeading( template: CompletionTemplate | null, mode: CompletionTemplateDialogMode, ): { title: string; subtitle: string } { if (template === null) { return { title: "New Completion Document Template", subtitle: "Completion Document Template", }; } if (mode === "edit") return { title: template.name, subtitle: "Editing template" }; const createdBy = template.createdByName ?? "—"; return { title: template.name, subtitle: `Created by ${createdBy} · Updated ${formatTemplateDate(template.lastUpdatedAt)}`, }; }