feat(files): the Downloads page goes — the tray, a Storage tab and a Downloads settings tab take its place
- The Downloads module, its rail icon and badge are gone. A bookmark, the remembered page and an old
history entry that name it land on Files (urlState.resolvePage); `g d` goes to Files too.
- Users page: a Storage tab — the disk in numbers, every user's use against their own limit with
their file count, every user's downloads; aligned tables, one menu per row (edit / reset quota,
open source, copy, the owner's quota). The admin storage rows carry quota + file count, the admin
job list its owner.
- Settings: a Downloads tab — the download formats in one list (duplicate a built-in, edit or delete
your own) and the site sign-ins, moved from Account.
- "View" on an added download, a clip or a converting upload opens the tray on that row (unfolded,
back if closed; a finished one opens as a file; under a player it opens without taking focus).
- The download dialog opens on the format used last.
- DataTable: `pager={false}` for a short list, `cardRow` to give a lone "…" its own card line.
- Welcome and README speak of Files; a new Files screenshot.
This commit is contained in:
@@ -132,20 +132,32 @@ const PAGES = [
|
||||
"logs",
|
||||
"notifications",
|
||||
"files",
|
||||
"downloads",
|
||||
"plex",
|
||||
] as const;
|
||||
|
||||
export type Page = (typeof PAGES)[number];
|
||||
|
||||
/** Narrow an arbitrary string to a known Page (else null). */
|
||||
export function isPage(p: string | null | undefined): p is Page {
|
||||
function isPage(p: string | null | undefined): p is Page {
|
||||
return !!p && (PAGES as readonly string[]).includes(p);
|
||||
}
|
||||
|
||||
// A page this build no longer has, and the page that took its place. A bookmark, the remembered last
|
||||
// page and an old history entry can still name one; all three resolve through `resolvePage`, so a
|
||||
// retired page lands where its content went instead of on the feed.
|
||||
const RETIRED: Readonly<Record<string, Page>> = {
|
||||
// The download queue became the tray; what it downloaded lives in Files.
|
||||
downloads: "files",
|
||||
};
|
||||
|
||||
/** A page id as stored or linked: a live page, a retired page's successor, else null. */
|
||||
export function resolvePage(p: string | null | undefined): Page | null {
|
||||
if (isPage(p)) return p;
|
||||
return p && Object.prototype.hasOwnProperty.call(RETIRED, p) ? RETIRED[p]! : null;
|
||||
}
|
||||
|
||||
export function readPage(): Page {
|
||||
const p = new URLSearchParams(window.location.search).get("page");
|
||||
return isPage(p) ? p : "feed";
|
||||
return resolvePage(new URLSearchParams(window.location.search).get("page")) ?? "feed";
|
||||
}
|
||||
|
||||
/** Build a URL (path + query + fragment) from the CURRENT location with `updates` applied to the query —
|
||||
|
||||
Reference in New Issue
Block a user