- api.ts: download types + methods (profiles, enqueue, list/manage, file url, share, usage, index, admin storage/quota) - format.ts: formatBytes / formatSpeed - i18n: en/hu/de downloads.json (trilingual) - Downloads nav module (Download icon, active-count badge, hidden for demo) placed after Messages; urlState page + App render + Header title - DownloadButton: self-contained per-card/player affordance (demo-hidden, reflects the per-user download index: downloaded / in-queue), opens the preset dialog - DownloadDialog: preset picker + optional display name -> enqueue + 'View' toast - ProfileEditor: manage built-in + custom formats (full spec form incl. SponsorBlock) - DownloadCenter: Queue / Library / Shared / (admin) System tabs, live progress via useLiveQuery, usage bar, pause/resume/cancel/delete, save-to-device, rename, share, admin storage dashboard + per-user quota editor - wired DownloadButton into VideoCard + PlayerModal - lib/nav.ts: decoupled navigator so the download toast can jump to the page tsc + vite build clean. Verified in a headless authed browser: page + tabs render, Library shows a real download with usage bar + actions, no console errors.
14 lines
479 B
TypeScript
14 lines
479 B
TypeScript
import type { Page } from "./urlState";
|
|
|
|
// Tiny decoupled navigator so deep components (a feed card's download toast, the Download
|
|
// Center) can switch pages without threading setPage through the whole tree. App registers
|
|
// its setPage on mount; navigateTo is a no-op until then.
|
|
let _navigate: ((p: Page) => void) | null = null;
|
|
|
|
export function setNavigator(fn: (p: Page) => void): void {
|
|
_navigate = fn;
|
|
}
|
|
|
|
export function navigateTo(p: Page): void {
|
|
_navigate?.(p);
|
|
}
|