diff --git a/apps/web/project.inlang/settings.json b/apps/web/project.inlang/settings.json index 25950d6..4564565 100644 --- a/apps/web/project.inlang/settings.json +++ b/apps/web/project.inlang/settings.json @@ -1,7 +1,7 @@ { "$schema": "https://inlang.com/schema/project-settings", "baseLocale": "en", - "locales": ["en", "de", "es", "fr"], + "locales": ["en", "de", "es", "fr", "it", "pt-BR"], "modules": [ "../../node_modules/@inlang/plugin-message-format/dist/index.js" ], diff --git a/apps/web/src/_e2e.ts b/apps/web/src/_e2e.ts index 44fff5f..c233221 100644 --- a/apps/web/src/_e2e.ts +++ b/apps/web/src/_e2e.ts @@ -119,7 +119,7 @@ try { const info = await l.host.info(); log("ok ready; host " + info.hostname); try { - const lib = await l.host.library(); + const lib = (await l.host.library()).entries; log(`ok library: ${lib.length} entries`); // Covers as the grid asks for them: an object URL, a CDN URL, nothing, or a throw. const tally = { shown: 0, none: 0, missing: 0, failed: 0 }; diff --git a/apps/web/src/app.ts b/apps/web/src/app.ts index cd35882..324abe0 100644 --- a/apps/web/src/app.ts +++ b/apps/web/src/app.ts @@ -17,6 +17,8 @@ import { type EngineState, gameEndNotice, gameGone, + hideNotice, + hideOffer, type HostTarget, hosts, initials, @@ -34,6 +36,7 @@ import { pickerDecision, pickOf, profileNote, + type ProfilePick, type Reach, reach, reachTarget, @@ -46,6 +49,9 @@ import { settings, type Shortcuts, statusOf, + type UnlockForm, + unlockForm, + unlockNeed, VersionSkew, wakeFailed, wakingLine, @@ -86,7 +92,7 @@ const STANDBY_GAP_MS = 5_000; /** The engine's states on the way to a host. Leaving the tab they sit under cancels them. */ const FLOWS = new Set([ "bad-address", "reaching", "blocked", "unreachable", "untrusted", "connecting", "needs-pairing", - "awaiting-approval", "pairing", "paired", "pair-refused", "forgotten", "starting", "error", + "awaiting-approval", "pairing", "paired", "pair-refused", "forgotten", "starting", "profile-locked", "error", ]); type Ready = Extract; @@ -115,6 +121,15 @@ class App { * it answers at once with an empty list, which must not read as still loading. */ private libraryAt = 0; private libraryError: string | undefined; + /** The profile id the titles were last asked as; unset is the box's. A pick that moved since + * is read again. */ + private libraryAsked: string | undefined; + /** The profile the shelf was read as, when this device may hide titles for it. */ + private hideFor: { id: string; name: string } | null = null; + /** What that profile hides, while its sheet is open. Read on opening, never kept. */ + private hidden: { name: string; entries?: LibraryEntry[]; failed?: boolean } | null = null; + /** Where each title hidden this visit sat on the shelf, so Undo puts it back there. */ + private readonly hidAt = new Map(); private tools: HostTools | null = null; private running: string | undefined; /** The running title's library id, which is what `Resume` launches. */ @@ -216,6 +231,9 @@ class App { back: () => (this.gate ? this.cancelGate() : engine.disconnect()), play: (entry, profile) => this.play(entry, undefined, profile), pickProfile: (id) => this.pickProfile(id), + unlock: (secret, stay) => this.unlock(secret, stay), + setHidden: (entry, hidden, as) => this.setHidden(entry, hidden, as), + openHidden: (on) => void this.openHidden(on), switchProfile: (origin) => this.switchProfile(origin), forget: (origin) => this.forget(origin), followLink: (yes) => this.followLink(yes), @@ -424,14 +442,26 @@ class App { // The console has no tabs: a host it reaches is a library it shows. if (this.web && this.tab === "hosts") return this.home(); this.setShelf(s.origin); - if (this.libraryFor !== s.origin || (!this.libraryLoading && Date.now() - this.libraryAt > LIBRARY_TTL_MS)) { + const moved = this.libraryAsked !== this.pickFor(s.origin)?.id; + if (this.libraryFor !== s.origin || (!this.libraryLoading && (moved || Date.now() - this.libraryAt > LIBRARY_TTL_MS))) { void this.openLibrary(s); } this.watchRunning(s); return this.showLibrary(); } case "starting": + if (s.opening) return this.show({ kind: "connecting", origin: s.origin, phase: "opening", host: this.nameOf(s.origin) }); return this.show({ kind: "connecting", origin: s.origin, phase: "starting" }); + case "profile-locked": { + const dial = this.lastPlay; + // The console prompts by itself: it hears the host's sentence as its session's end. + if (!this.web) { + return this.show({ kind: "unlock", origin: s.origin, host: this.nameOf(s.origin), name: "", form: "password", ...(s.said ? { error: s.said } : {}) }); + } + // Not from inside this listener: the prompt puts the engine back on `ready`. + queueMicrotask(() => void this.reprompt(s.origin, s.host, dial, s.said)); + return; + } case "streaming": { const live = pageShortcuts(this.prefs.shortcuts); const menuHint = this.menuOpen ? menuHintText(live) : undefined; @@ -802,11 +832,21 @@ class App { if (this.libraryFor !== s.origin) this.clearLibrary(); this.libraryFor = s.origin; this.libraryLoading = true; + const pick = this.pickFor(s.origin); + this.libraryAsked = pick?.id; this.redrawLibrary(); try { - const entries = [...(await s.host.library())]; + // The box's list says whether this device may hide titles for the pick. No pick, no ask. + const [catalog, listed] = await Promise.all([ + s.host.library(pick?.id), + pick ? s.host.profiles().catch(() => null) : null, + ]); if (this.libraryFor !== s.origin) return; - this.entries = entries; + this.entries = [...catalog.entries]; + const person = hideOffer(listed, catalog.as); + this.hideFor = person ? { id: person.id, name: person.display_name } : null; + if (!this.hideFor) this.hidden = null; + this.hidAt.clear(); this.libraryError = undefined; this.libraryAt = Date.now(); } catch (e) { @@ -828,19 +868,91 @@ class App { } this.redrawLibrary(); // Art after the grid, per entry: the grid should appear before its covers do. - for (const entry of this.entries) { - const art = entry.art.portrait ?? entry.art.header; - if (!art || this.art.has(entry.id)) continue; - void s.host - .art(art) - .then((url) => { - if (!url || this.libraryFor !== s.origin) return; - this.art.set(entry.id, url); - this.redrawLibrary(); - }) - // A cover that cannot load leaves its tile's placeholder. - .catch(() => {}); + for (const entry of this.entries) this.readArt(s.host, s.origin, entry); + } + + /** Read `entry`'s cover for the shelf of `origin`, unless it is there already. */ + private readArt(host: Host, origin: string, entry: LibraryEntry): void { + const art = entry.art?.portrait ?? entry.art?.header; + if (!art || this.art.has(entry.id)) return; + void host + .art(art) + .then((url) => { + if (!url || this.libraryFor !== origin) return; + this.art.set(entry.id, url); + this.redrawLibrary(); + }) + // A cover that cannot load leaves its tile's placeholder. + .catch(() => {}); + } + + /** The pick the shelf of `origin` is read as: the one this browser keeps. The console applies + * only a pick it was told to remember, as it does for a dial. */ + private pickFor(origin: string): ProfilePick | undefined { + const pick = hosts.all()[origin]?.profile; + return pick && (this.web || pick.remember) ? pick : undefined; + } + + // --- hide for me ------------------------------------------------------------------------- + /** Hide (`hidden`) or show `entry` for the shelf's profile, or for `as`. The shelf follows a + * yes at once, with no new fetch; a no changes nothing. The web shell says the line here. */ + private async setHidden(entry: LibraryEntry, hidden: boolean, as = this.hideFor ?? undefined): Promise<{ done: boolean; notice: string }> { + const host = this.shelfHost(); + const shelf = this.libraryFor; + const outcome = host && as + ? await host.setHidden(as.id, entry.id, hidden) + : ({ kind: "failed", why: m.browser_lib_not_connected_this_host() } as const); + const done = outcome.kind === "done"; + const notice = hideNotice(outcome, hidden, entry.title, as?.name ?? ""); + if (done && this.libraryFor === shelf) this.noteHidden(entry, hidden); + if (this.web) { + const undo = { label: m.common_undo(), run: () => void this.setHidden(entry, !hidden, as) }; + this.ui.notify(notice, done ? undefined : "error", done ? undo : undefined); + } + return { done, notice }; + } + + /** The shelf after `entry` left it (`hidden`) or came back. A title that comes back takes + * the place this visit saw it leave, else the end until the shelf is read again. */ + private noteHidden(entry: LibraryEntry, hidden: boolean): void { + const at = this.entries.findIndex((e) => e.id === entry.id); + const listed = this.hidden?.entries; + if (hidden) { + const [gone] = at >= 0 ? this.entries.splice(at, 1) : []; + if (gone) this.hidAt.set(entry.id, at); + if (listed && !listed.some((e) => e.id === entry.id)) listed.push(gone ?? entry); + } else { + // Only a whole row goes back on the shelf; the console names a title by its id alone. + if (at < 0 && entry.store !== undefined) { + this.entries.splice(Math.min(this.hidAt.get(entry.id) ?? this.entries.length, this.entries.length), 0, entry); + const host = this.shelfHost(); + if (host && this.libraryFor) this.readArt(host, this.libraryFor, entry); + } else if (at < 0) { + this.libraryAt = 0; + } + this.hidAt.delete(entry.id); + if (listed) this.hidden = { ...this.hidden!, entries: listed.filter((e) => e.id !== entry.id) }; } + this.redrawLibrary(); + } + + /** Open what the shelf's profile hides, read now and never kept, or close it. */ + private async openHidden(on: boolean): Promise { + const who = this.hideFor; + const host = this.shelfHost(); + if (!on || !who || !host) { + this.hidden = null; + return this.redrawLibrary(); + } + const sheet = (this.hidden = { name: who.name }); + this.redrawLibrary(); + try { + const entries = await host.hidden(who.id); + if (this.hidden === sheet) this.hidden = { name: who.name, entries }; + } catch { + if (this.hidden === sheet) this.hidden = { name: who.name, failed: true }; + } + this.redrawLibrary(); } /** What the host is running, polled while its library is connected: the event stream is not @@ -900,6 +1012,8 @@ class App { ...(mine && connected && this.running && this.runningEndable ? { endable: true } : {}), ...(mine && this.endNotice ? { notice: this.endNotice } : {}), ...(mine && this.libraryError ? { error: m.browser_lib_load_failed_desktop({ why: sentence(this.libraryError) }) } : {}), + ...(mine && connected && this.hideFor ? { hide: { name: this.hideFor.name } } : {}), + ...(mine && connected && this.hidden ? { hidden: this.hidden } : {}), }); void this.probe(shelves.map((h) => h.origin)); } @@ -1036,6 +1150,10 @@ class App { this.libraryLoading = false; this.libraryAt = 0; this.libraryError = undefined; + this.libraryAsked = undefined; + this.hideFor = null; + this.hidden = null; + this.hidAt.clear(); this.running = undefined; this.runningId = undefined; this.runningEndable = false; @@ -1106,7 +1224,8 @@ class App { this.engine.fullscreen(true); } const s = this.engine.current; - if (s.kind === "ready" && s.origin === origin) return this.start(entry, profile); + // `profile-locked`: the console's own prompt dials again from where the host left it. + if ((s.kind === "ready" || s.kind === "profile-locked") && s.origin === origin) return this.start(entry, profile); this.quiet = false; this.resumeOnReady = { ...(entry ? { entry } : {}), ...(profile !== undefined ? { profile } : {}) }; void this.engine.connect(this.targetOf(origin)); @@ -1150,11 +1269,17 @@ class App { void this.askProfile(s.origin, s.host, entry ? { entry } : {}); } - private dial(entry?: LibraryEntry, profile?: string): void { + /** `unlock` is what the prompt took, for this dial alone: `lastPlay` never holds it. */ + private dial(entry?: LibraryEntry, profile?: string, unlock?: { secret: string; stay: boolean }): void { this.gate = null; this.endNotice = undefined; this.lastPlay = { ...(entry ? { entry } : {}), ...(profile ? { profile } : {}) }; - this.engine.startStream({ ...this.streamOptions(), ...(entry ? { launch: entry } : {}), ...(profile ? { profile } : {}) }); + this.engine.startStream({ + ...this.streamOptions(), + ...(entry ? { launch: entry } : {}), + ...(profile ? { profile } : {}), + ...(unlock ? { unlock } : {}), + }); } // --- the profile gate ---------------------------------------------------------------- @@ -1223,7 +1348,7 @@ class App { private async settleSeat(gate: Gate, id: string | undefined): Promise { const row = id ? gate.rows.find((p) => p.id === id) : undefined; let next = row ? seatGate(row) : ({ kind: "dial" } as const); - if (!row || next.kind === "dial") return this.dial(gate.play?.entry, id); + if (!row || next.kind === "dial") return this.dialOrPrompt(gate, row, id); const name = row.display_name; if (next.kind === "wake") { this.gateShow(gate, { kind: "seat", origin: gate.origin, title: wakingLine(name) }); @@ -1256,10 +1381,63 @@ class App { const now = rows?.find((p) => p.id === row.id); // A profile the list dropped is the host's to refuse. next = now ? seatGate(now) : { kind: "dial" }; - if (next.kind === "dial") return this.dial(gate.play?.entry, row.id); + if (next.kind === "dial") return this.dialOrPrompt(gate, now, row.id); } } + // --- a profile's unlock -------------------------------------------------------------------- + // This page holds no unlock key, so a profile that opens with a PIN or an account password + // is asked for it before its dial, and again when the host refuses what was typed + // (`unlock.ts`). + + /** Dial as `row`, behind the prompt when it needs an unlock. A profile the list dropped + * dials as it stands, and the host answers for it. */ + private dialOrPrompt(gate: Gate, row: ListedProfile | undefined, id: string | undefined): void { + const form = row ? unlockForm(unlockNeed(row["unlock"])) : null; + if (!row || !form) return this.dial(gate.play?.entry, id); + gate.unlock = row.id; + this.gateShow(gate, { kind: "unlock", origin: gate.origin, host: this.nameOf(gate.origin), name: row.display_name, form }); + } + + /** The prompt's answer: the dial it stood in front of, with what was typed. */ + private unlock(secret: string, stay: boolean): void { + const gate = this.gate; + if (gate?.unlock) this.dial(gate.play?.entry, gate.unlock, { secret, stay }); + } + + /** + * The host closed `dial` as `profile-locked`: the prompt, with its sentence when it refused + * what was typed. The form is the profile's fresh row's, the password when the list names + * none. A dial that named no profile has nothing to prompt for, and says so. + */ + private async reprompt(origin: string, host: Host, dial: Play | null, said?: string): Promise { + let rows: ReadonlyArray | null = null; + try { + rows = await host.profiles(); + } catch { + // The prompt still opens, for the password. + } + const now = this.engine.current; + if (now.kind !== "profile-locked" || now.origin !== origin) return; + const id = dial?.profile; + const row = rows?.find((p) => p.id === id); + const gate: Gate = { + origin, + host, + play: dial?.entry ? { entry: dial.entry } : {}, + rows: rows ?? [], + screen: { kind: "error", head: m.browser_gate_failed_title(), text: sentence(said ?? m.reject_profile_locked()) }, + }; + if (id) { + const form = (row ? unlockForm(unlockNeed(row["unlock"])) : null) ?? "password"; + gate.unlock = id; + gate.screen = { kind: "unlock", origin, host: this.nameOf(origin), name: row?.display_name ?? id, form, ...(said ? { error: sentence(said) } : {}) }; + } + this.gate = gate; + // `ready` again, with the gate's screen in front of it. + this.engine.leave(); + } + private gateShow(gate: Gate, screen: Screen): void { if (this.gate !== gate) return; gate.screen = screen; @@ -1315,6 +1493,8 @@ interface Gate { play: { entry?: LibraryEntry } | null; rows: ReadonlyArray; screen: Screen; + /** The profile the unlock prompt on `screen` opens. */ + unlock?: string; } /** `p`, or a rejection once `ms` have passed. */ @@ -1446,6 +1626,8 @@ try { const engine = await Engine.create({ videoCanvas, uiCanvas, + // Both interfaces draw the unlock prompt: the web shell's sheet, the console's own screen. + promptsUnlock: true, ...(__PF_TRANSPORT_HOST__ ? { transportHost: __PF_TRANSPORT_HOST__ } : {}), }); const server = (await readConfig(serverFetch(), location.href)) ?? { listed: new Map(), viaServer: false }; diff --git a/apps/web/src/ui/console.ts b/apps/web/src/ui/console.ts index 571bbfd..4514e8a 100644 --- a/apps/web/src/ui/console.ts +++ b/apps/web/src/ui/console.ts @@ -159,6 +159,9 @@ export class ConsoleUi implements Ui { private pairReq: ConsoleReq = NO_REQ; private libraryReq: ConsoleReq = NO_REQ; private pendingPlay: { origin: string; id: string | null; title: string; profile: string } | null = null; + /** The rows of the hidden list the console last asked for: a title it shows again goes back + * on the shelf whole. */ + private hiddenRows = new Map(); /** A `FetchProfiles` for a host the engine is not on: it is reached quietly and answered once * ready, without re-rooting the console on its shelf mid-ask. */ private profilesAsk: { origin: string; fp: string; at: number } | null = null; @@ -262,8 +265,8 @@ export class ConsoleUi implements Ui { /** The web shell's toaster shows over the canvas too; the console has no line of its own * for something that is not a screen. */ - notify(text: string, tone?: "error"): void { - this.fallback.notify(text, tone); + notify(text: string, tone?: "error", action?: { label: string; run: () => void }): void { + this.fallback.notify(text, tone, action); } mount(actions: Actions): void { @@ -352,6 +355,10 @@ export class ConsoleUi implements Ui { tizen: tizen(), // Answers `FetchProfiles`, so a connect picks the profile and readies its seat first. profiles: true, + // A profile's PIN or password is typed on the console's own screen; the engine sends it. + prompts_unlock: true, + // Answers `SetHidden` and `FetchHidden`: Hide for me. + hides: true, settings: this.startSettings(), // The browser's own list, most preferred first: the console words itself in the first it ships. languages: [...navigator.languages], @@ -648,7 +655,15 @@ export class ConsoleUi implements Ui { } return; case "connecting": - if (this.dialled) c.phase(0); + // `opening`: the host took the unlock and starts the profile's desktop. + if (this.dialled) c.phase(s.phase === "opening" ? 6 : 0); + return; + case "unlock": + // The host wants the profile's unlock: the console's prompt opens with its sentence. + // Once per refusal: a redraw of the same screen is not another one. + if (was?.kind === "unlock") return; + this.dialled = false; + c.phase(7, s.error ?? ""); return; case "pair": { const pin = this.pendingPin; @@ -924,7 +939,8 @@ export class ConsoleUi implements Ui { } const now = this.engine.current; const profile = l.profile ?? ""; - if (now.kind === "ready" && now.origin === origin) { + // `profile-locked`: this launch is the prompt's, and dials from where the host left it. + if ((now.kind === "ready" || now.kind === "profile-locked") && now.origin === origin) { this.actions?.play(l.launch ? ({ id: l.launch, title: l.title } as LibraryEntry) : undefined, profile); return; } @@ -942,9 +958,10 @@ export class ConsoleUi implements Ui { this.libraryReq = reqOf(body); const now = this.engine.current; if (now.kind === "ready" && now.origin === origin) { - // Already there: hand the shelf what the app has. + // Already there: hand the shelf what the app has, read again when the pick moved. this.gamesSent = ""; this.artSent.clear(); + this.actions?.browse(origin); if (this.screen?.kind === "library") this.library(this.screen); return; } @@ -1028,6 +1045,22 @@ export class ConsoleUi implements Ui { case "EndGame": if (origin) void this.endGame(origin, str("app_id"), str("title")); return; + case "FetchHidden": { + const [fp, profile] = [str("fp_hex"), str("profile")]; + const host = origin ? this.apiFor(origin) : undefined; + if (!origin || !host) return this.pushHidden(fp, profile, { Failed: m.browser_lib_not_connected_this_host() }); + void this.answerHidden(origin, fp, profile, host); + return; + } + case "SetHidden": { + const [fp, profile, id] = [str("fp_hex"), str("profile"), str("app_id")]; + const hidden = body["hidden"] === true; + const entry = this.hiddenRows.get(id) ?? ({ id, title: str("title") } as LibraryEntry); + void this.actions?.setHidden(entry, hidden, { id: profile, name: str("name") }).then(({ done, notice }) => + this.engine.console.push(CONSOLE_PUSH.HIDE, { fp_hex: fp, profile, app_id: id, hidden, done, notice }), + ); + return; + } case "SetScreen": if (origin && body["screen"]) void this.setScreen(origin, body["screen"] as DisplayTarget, str("topology")); return; @@ -1073,6 +1106,40 @@ export class ConsoleUi implements Ui { this.engine.console.push(CONSOLE_PUSH.PROFILES, { fp_hex: fp, answer }); } + /** What `profile` hides, for the console's `FetchHidden`: its rows, then their covers. */ + private async answerHidden(origin: string, fp: string, profile: string, host: Host): Promise { + let rows: LibraryEntry[]; + try { + rows = await host.hidden(profile); + } catch (e) { + return this.pushHidden(fp, profile, { Failed: e instanceof Error ? e.message : String(e) }); + } + this.hiddenRows = new Map(rows.map((e) => [e.id, e])); + this.pushHidden(fp, profile, { Listed: rows.map((e) => game(e, undefined)) }); + for (const e of rows) { + const art = e.art?.portrait ?? e.art?.header; + if (!art || this.artSent.has(e.id)) continue; + this.artSent.add(e.id); + this.toDecode.push(async () => { + try { + const url = await host.art(art); + if (!url) return; + const blob = await (await fetch(url)).blob(); + if (url.startsWith("blob:")) URL.revokeObjectURL(url); + const bytes = (await coverBytes(blob)) ?? new Uint8Array(await blob.arrayBuffer()); + if (this.shelf === origin) this.covers.push([origin, e.id, bytes]); + } catch { + this.artSent.delete(e.id); + } + }); + } + this.decodeNext(); + } + + private pushHidden(fp: string, profile: string, answer: unknown): void { + this.engine.console.push(CONSOLE_PUSH.HIDDEN, { fp_hex: fp, profile, answer }); + } + /** What the host runs, as the console's launch hold and Resume badge read it. Unanswered, * the hold gives up after 15 s and covers the stream with a failure. */ private refreshRunning(origin: string): void { diff --git a/apps/web/src/ui/fixtures.ts b/apps/web/src/ui/fixtures.ts index 54c1fde..6cec1a3 100644 --- a/apps/web/src/ui/fixtures.ts +++ b/apps/web/src/ui/fixtures.ts @@ -54,6 +54,10 @@ const hosts: HostCard[] = [ ]; const shelves = hosts.filter((h) => h.fingerprint); const origin = "https://192.168.1.25:47990"; +/** Kid's shelf: the box's, less what Kid hides. */ +const kids = entries.filter((_, i) => ![1, 3, 9].includes(i)); +const kidsHidden = [entries[1]!, entries[3]!, entries[9]!]; +const kidsShelf = { kind: "library", origin, shelves, host: "living-room-pc", entries: kids, art, hide: { name: "Kid" } } as const; /** The statistics where a fresh browser puts them. */ const overlay = { corner: "topTrailing", scale: 1 } as const; @@ -82,6 +86,11 @@ export const SCREENS = { }, "profiles-gone": { kind: "profiles", origin: "https://192.168.1.25:47990", host: "Living room", gone: "Old desk", cards: [{ id: "a1", name: "Mia", initials: "M", accent: "#e0457b" }] }, "seat": { kind: "seat", origin: "https://192.168.1.25:47990", title: "Getting Kid's desk ready…", detail: "Signing in…" }, + "unlock": { kind: "unlock", origin, host: "Living room", name: "Kid", form: "pin" }, + "unlock-refused": { kind: "unlock", origin, host: "Living room", name: "Kid", form: "pin", error: "That isn't this profile's PIN." }, + "unlock-wait": { kind: "unlock", origin, host: "Living room", name: "Kid", form: "pin", error: "Too many wrong PINs. Try again in 3 minutes." }, + "unlock-password": { kind: "unlock", origin, host: "Living room", name: "Mia", form: "password" }, + "opening": { kind: "connecting", origin, phase: "opening", host: "Living room" }, "link": { kind: "link", name: "Desk", address: "192.168.1.21", launch: "steam:570" }, "trust": { kind: "trust", @@ -89,6 +98,10 @@ export const SCREENS = { reason: "this is not the host that was paired with", }, "library": { kind: "library", origin, shelves, host: "living-room-pc", entries, art, running: "Hades", resume: entries[1]! }, + "library-profile": kidsShelf, + "library-hidden": { ...kidsShelf, hidden: { name: "Kid", entries: kidsHidden } }, + "library-hidden-none": { ...kidsShelf, hidden: { name: "Kid", entries: [] } }, + "library-hidden-failed": { ...kidsShelf, hidden: { name: "Kid", failed: true } }, "library-empty": { kind: "library", origin, shelves, host: "living-room-pc", entries: [], art: new Map() }, "library-loading": { kind: "library", origin, shelves, host: "living-room-pc", entries: [], art: new Map(), busy: true }, "library-offline": { kind: "library", origin, shelves, host: "living-room-pc", entries: [], art: new Map(), offline: true }, diff --git a/apps/web/src/ui/library.tsx b/apps/web/src/ui/library.tsx index c4f1515..0cf85df 100644 --- a/apps/web/src/ui/library.tsx +++ b/apps/web/src/ui/library.tsx @@ -5,7 +5,7 @@ import type { LibraryEntry } from "@punktfunk/stream"; import { cn } from "@unom/ui/lib/utils"; -import { CircleX, Monitor, Play, Search, Server } from "lucide-react"; +import { CircleX, EyeOff, Monitor, Play, Search, Server } from "lucide-react"; import { motion } from "motion/react"; import { type JSX, type KeyboardEvent, useRef, useState } from "react"; import { ROW, ROW_GAP, Stagger, staggerProps } from "@/components/stagger"; @@ -52,6 +52,7 @@ export function Library({ screen, actions }: { screen: LibraryScreen; actions: A return ( {screen.tools && } + {screen.hidden &&