import Section from "@unom/ui/section"; import type { FC, ReactNode } from "react"; import type { AvailableCompositor } from "@/api/gen/model/availableCompositor"; import type { HostInfo } from "@/api/gen/model/hostInfo"; import { OsIcon } from "@/components/os-icon"; import { QueryState } from "@/components/query-state"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import type { Loadable } from "@/lib/query"; import { m } from "@/paraglide/messages"; export const HostView: FC<{ host: Loadable; compositors: Loadable; /** The GPU inventory/selection card (a self-contained container — see `GpuCard.tsx`). */ gpu?: ReactNode; /** The update-check card (a self-contained container — see `UpdateCard.tsx`). */ update?: ReactNode; /** Warning about other Moonlight-compatible servers on this machine — renders nothing when * there are none (see `ConflictsCard.tsx`). Sits at the top: it explains "nothing can connect". */ conflicts?: ReactNode; }> = ({ host, compositors, gpu, update, conflicts }) => { const h = host.data; return (

{m.nav_host()}

{conflicts} {h && (
{m.host_identity()}
{/* The OS mark resolves from the identity chain (h.os), which also serves as the tooltip for the curious; the text is the pretty name. */} } />
{m.host_codecs()} {h.codecs.map((c) => ( {c.toUpperCase()} ))} {m.host_ports()}
{Object.entries(h.ports).map(([k, v]) => (
{k}
{v as number}
))}
)}
{update} {gpu} {m.host_compositors()}

{m.host_compositors_help()}

{/* Empty is a real answer, not a load failure: a Windows host drives the pf-vdisplay driver and has no compositor backends at all. */} {compositors.data?.length === 0 ? (

{m.compositor_none()}

) : (
    {compositors.data?.map((c) => (
  • {c.label} {c.default && ( {m.compositor_default()} )}
    {c.id}
    {c.available ? m.compositor_available() : m.compositor_unavailable()}
  • ))}
)}
); }; const Row: FC<{ label: string; value: string; mono?: boolean; /** Optional leading glyph inside the value cell (the OS mark). */ icon?: ReactNode; /** Tooltip override — defaults to the value itself (which may be truncated). */ title?: string; }> = ({ label, value, mono, icon, title }) => (
{label}
{icon} {value}
);