"use client"; import { Mail, SendHorizonal } from "lucide-react"; import { useState } from "react"; import { Avatar, AvatarFallback } from "@/components/ui/avatar"; import { Button } from "@/components/ui/button"; import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, } from "@/components/ui/empty"; import { Textarea } from "@/components/ui/textarea"; import { notify } from "@/lib/toast"; import { cn } from "@/lib/utils"; // All messages here are mock/placeholder data — there is no messaging backend. // They illustrate the email-style inbox layout (left list, right reading pane). type Message = { id: string; sender: string; initials: string; subject: string; preview: string; body: string[]; time: string; read: boolean; }; const seed: Message[] = [ { id: "1", sender: "Dr. Stein", initials: "DS", subject: "Lab results ready", preview: "The lab results for Amina Yusuf are now available…", body: [ "Hi,", "The lab results for Amina Yusuf (file #10293) are now available for your review. The lipid panel and HbA1c both came back within the expected range.", "Let me know if you'd like to adjust her current plan before the follow-up.", "— Dr. Stein", ], time: "10:24", read: false, }, { id: "2", sender: "Dr. Okafor", initials: "DO", subject: "Re: Daniel Mensah intake", preview: "Thanks for sending the intake notes over. I've…", body: [ "Thanks for sending the intake notes over.", "I've added him to tomorrow's schedule at 10:00. Could you confirm whether his prior records were imported?", "— Dr. Okafor", ], time: "09:12", read: false, }, { id: "3", sender: "Care team", initials: "CT", subject: "Vaccination stock update", preview: "A reminder that the seasonal vaccine stock has…", body: [ "A reminder that the seasonal vaccine stock has been replenished.", "Slots are open across the week — please direct eligible patients to the front desk to book.", ], time: "Yesterday", read: true, }, { id: "4", sender: "Reception", initials: "RC", subject: "Schedule change for Friday", preview: "Two afternoon appointments were rescheduled…", body: [ "Two afternoon appointments on Friday were rescheduled to next Monday at the patients' request.", "The updated times are reflected in the schedule.", ], time: "Mon", read: true, }, ]; export function MessagesView() { const [messages, setMessages] = useState(seed); const [selectedId, setSelectedId] = useState(null); const [reply, setReply] = useState(""); const selected = messages.find((m) => m.id === selectedId) ?? null; const open = (id: string) => { setSelectedId(id); setReply(""); setMessages((prev) => prev.map((m) => (m.id === id ? { ...m, read: true } : m)), ); }; const send = () => { if (!(reply.trim() && selected)) return; notify.success("Reply sent", `To ${selected.sender}`); setReply(""); }; return (
{/* Left: inbox list */} {/* Right: reading pane or empty state */}
{selected ? (

{selected.subject}

{selected.initials}
{selected.sender} to me · {selected.time}
{selected.body.map((para) => (

{para}

))}