import { useEffect, useState, type ReactNode } from "react"; import clsx from "clsx"; import { ChevronRight, type LucideIcon } from "lucide-react"; import { InboxAvatar } from "../MessagesPage/InboxRow.tsx"; import PresenceDot from "../../../components/PresenceDot/PresenceDot"; // The deck lays the page out as a list beside the person it has open from a tablet up. const WIDE_QUERY = "(min-width: 768px)"; export const useWideFamilyLayout = (): boolean => { const read = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(WIDE_QUERY).matches; const [wide, setWide] = useState(read); useEffect(() => { if (typeof window === "undefined" || typeof window.matchMedia !== "function") return; const query = window.matchMedia(WIDE_QUERY); const update = () => setWide(query.matches); update(); query.addEventListener?.("change", update); return () => query.removeEventListener?.("change", update); }, []); return wide; }; export type PersonTone = "full" | "wait" | undefined; export const PersonAvatar = ({ name, photoUrl, tone, presenceRef }: { name: string; photoUrl?: string; tone?: PersonTone; presenceRef?: string; }) => ( {presenceRef && } ); export const PersonHead = ({ name, sub, avatar, aside }: { name: string; sub?: string; avatar: ReactNode; aside?: ReactNode; }) => (
{avatar} {name} {sub && {sub}} {aside}
); export const PersonAction = ({ icon: Icon, label, sub, onClick, danger = false, disabled = false, testId }: { icon: LucideIcon; label: string; sub?: string; onClick: () => void; danger?: boolean; disabled?: boolean; testId?: string; }) => ( ); export const AddRow = ({ label, onClick, testId }: { label: string; onClick: () => void; testId?: string }) => ( );