diff --git a/src/pages/Encounters/tabs/EncounterNotesTab.tsx b/src/pages/Encounters/tabs/EncounterNotesTab.tsx index 9a898de5ba6..89b535134df 100644 --- a/src/pages/Encounters/tabs/EncounterNotesTab.tsx +++ b/src/pages/Encounters/tabs/EncounterNotesTab.tsx @@ -4,6 +4,7 @@ import { useQuery, useQueryClient, } from "@tanstack/react-query"; +import { formatRelative } from "date-fns"; import { Info, Loader2, @@ -52,6 +53,7 @@ import routes from "@/Utils/request/api"; import mutate from "@/Utils/request/mutate"; import query from "@/Utils/request/query"; import { PaginatedResponse } from "@/Utils/request/types"; +import { formatDateTime } from "@/Utils/utils"; import { EncounterTabProps } from "@/pages/Encounters/EncounterShow"; import { Message } from "@/types/notes/messages"; import { Thread } from "@/types/notes/threads"; @@ -105,8 +107,6 @@ const ThreadItem = ({

{thread.title}

- {/* Todo: Replace with thread.created */} -

12/12/2024

{isSelected && (
@@ -156,21 +156,28 @@ const MessageItem = ({ message }: { message: Message }) => { isCurrentUser ? "items-end" : "items-start", )} > - - {message.created_by.username} - +

+ + {message.created_by.username} + + +

{message.message && ( -
- -
+ )}
@@ -379,9 +386,6 @@ export const EncounterNotesTab = ({ encounter }: EncounterTabProps) => { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); }, 100); }, - onError: () => { - toast.error(t("Failed to send message")); - }, }); // Handle infinite scroll diff --git a/src/types/notes/messages.ts b/src/types/notes/messages.ts index bca88676392..1178a6c0c4f 100644 --- a/src/types/notes/messages.ts +++ b/src/types/notes/messages.ts @@ -2,8 +2,10 @@ import { UserBase } from "@/types/user/user"; export interface Message { id: string; - message: string; + message: string; // Markdown message_history: Record; created_by: UserBase; updated_by: UserBase; + created_date: string; + modified_date: string; }