diff --git a/src/components/documents/DocumentTitle.tsx b/src/components/documents/DocumentTitle.tsx new file mode 100644 index 0000000..4c65917 --- /dev/null +++ b/src/components/documents/DocumentTitle.tsx @@ -0,0 +1,25 @@ +import { type AnyDocument, type Session } from "@/lib/types"; +import { FormattedDate } from "../FormattedDate"; + +/** + * Renders the document title to go at the top a document page. + */ +export const DocumentTitle = ({ + document, + session, +}: { + document: AnyDocument; + session?: Session; +}) => { + switch (document.type) { + case "session": + return ( +

+ +

+ ); + + default: + return

document.type

; + } +}; diff --git a/src/components/documents/DocumentView.tsx b/src/components/documents/DocumentView.tsx index 4c60ee8..6752d1c 100644 --- a/src/components/documents/DocumentView.tsx +++ b/src/components/documents/DocumentView.tsx @@ -7,6 +7,7 @@ import { Link } from "@tanstack/react-router"; import * as _ from "lodash"; import { Loader } from "../Loader"; import { Route as RelationshipRoute } from "@/routes/_app/_authenticated/document.$documentId/$relationshipType"; +import { DocumentTitle } from "./DocumentTitle"; export function DocumentView({ documentId }: { documentId: DocumentId }) { const { docResult } = useDocument(documentId); @@ -27,6 +28,7 @@ export function DocumentView({ documentId }: { documentId: DocumentId }) { return (
+