// Plex Source screen — a single media-source connection page: breadcrumb-style header, a
// Connection card driving the OAuth pin-flow sign-in/out affordance, and a Servers list with
// per-server refresh + edit-libraries/edit-path-replacements actions. Static mockup shows the
// populated "signed in, servers discovered" state plus a toggled sign-out confirm overlay.
(function () {
const NS = window.ChicoryTVDesignSystem_eb3b61;
const { Button, IconButton, StatusDot, Card, Spinner, Tooltip } = NS;
const Ico = window.Ico;
const mono = { fontFamily: "var(--font-mono)", fontVariantNumeric: "tabular-nums" };
const SERVERS = [
{ id: 1, name: "Attic Media Server", address: "192.168.1.42:32400", status: "ok" },
{ id: 2, name: "plex.tblindustries.be", address: "203.0.113.7:32400", status: "ok" },
{ id: 3, name: "Backup NAS", address: "192.168.1.88:32400", status: "live" },
];
function ConnectionRow({ label, value }) {
return (
{label}
{value}
);
}
function ServerRow({ s }) {
const [hover, setHover] = React.useState(false);
const busy = s.status === "live";
return (
setHover(true)} onMouseLeave={() => setHover(false)}
style={{ display: "flex", alignItems: "center", gap: 14, padding: "14px 18px", borderTop: "1px solid var(--border-hairline)", background: hover ? "var(--ctv-surface-2)" : "transparent", transition: "background var(--dur-fast)" }}>
{busy ? "Busy" : "Ready"}
);
}
function SignOutOverlay({ onCancel }) {
return (
Sign out of Plex
Signing out removes all synced Plex servers, libraries, and content from ErsatzTV. This cannot be undone. Continue?
}>Sign out
);
}
function PlexSource() {
const [confirmOpen, setConfirmOpen] = React.useState(false);
return (
{/* breadcrumb-style header (screen content, not app chrome) */}
Media source
Plex
Sign in to Plex to discover servers and choose which libraries to sync.
}>Back to libraries
{/* Connection card */}
Connection}
subtitle="Signed in to Plex."
actions={
}
>
Servers discovered
{SERVERS.length}
{/* Servers card */}
Servers}
subtitle={SERVERS.length + " servers discovered."}
padded={false}
>
{SERVERS.map((s) => )}
{/* transient sign-in state, for reference (kept visually collapsed/muted below the fold) */}
Example in-flight state: Waiting for you to approve access on plex.tv…
{confirmOpen &&
setConfirmOpen(false)} />}
);
}
window.CTVPlexSource = PlexSource;
})();