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:
2026-10-11 19:37:13 +02:00
parent 1c4f0042d2
commit 078194731b
69 changed files with 1553 additions and 1147 deletions
+8 -11
View File
@@ -2,12 +2,11 @@ import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react
import { useLatest } from "../lib/useLatest";
import { useTranslation } from "react-i18next";
import { useMe } from "../lib/useMe";
import { isPage, urlWithParams, type Page } from "../lib/urlState";
import { resolvePage, urlWithParams, type Page } from "../lib/urlState";
import { LOGS_KEYS } from "../lib/logsUrlState";
import { pageTitleKey } from "../lib/pageMeta";
import { useDocumentObjectTitle } from "../lib/documentTitle";
import { setAccountRaw } from "../lib/storage";
import { setNavigator } from "../lib/nav";
import {
backStaysInDocument,
closeOverlaysThenNavigate,
@@ -156,9 +155,6 @@ export function NavigationProvider({ children }: { children: ReactNode }) {
}
}, []);
// Expose setPage to decoupled callers (download toast "View", etc.) via the lib/nav singleton.
useEffect(() => setNavigator(setPage), [setPage]);
// Leaving the feed ends any live YouTube search, so coming back shows the normal feed. Adjusted
// DURING the render that changes the page, against the page we were last on: as an effect it ran
// after the new page had already committed, so for one frame a module rendered with a live search
@@ -206,17 +202,18 @@ export function NavigationProvider({ children }: { children: ReactNode }) {
}
function onPop(e: PopStateEvent) {
// An entry can name a page this build no longer has (one pushed before a module was removed,
// reached by Back after a reload onto the new build); that lands on the feed, not on a crash.
// The entry is rewritten to say so: left alone, the address bar would keep naming the dead page
// and a click on Feed would be a no-op (setPage's same-page guard). It spreads the LIVE entry,
// not `e.state`: lib/history's listener ran first and already took the spent `sfNav` off it.
// reached by Back after a reload onto the new build); that lands where the page's content went
// (`resolvePage`), else on the feed, not on a crash. The entry is rewritten to say so: left
// alone, the address bar would keep naming the dead page and a click on the page it landed on
// would be a no-op (setPage's same-page guard). It spreads the LIVE entry, not `e.state`:
// lib/history's listener ran first and already took the spent `sfNav` off it.
const sf: unknown = e.state?.sfPage;
const p: Page = typeof sf === "string" && isPage(sf) ? sf : "feed";
const p: Page = (typeof sf === "string" && resolvePage(sf)) || "feed";
if (typeof sf === "string" && sf !== p)
window.history.replaceState(
{ ...window.history.state, sfPage: p },
"",
urlWithParams({ page: null }),
urlWithParams({ page: p === "feed" ? null : p }),
);
setPageState(p);
setAccountRaw(PAGE_KEY, p);