mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-05 16:32:06 +00:00
22 lines
859 B
TypeScript
22 lines
859 B
TypeScript
|
|
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)}`,
|
||
|
|
};
|
||
|
|
}
|