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:
@@ -11,13 +11,18 @@ import { invalidateDownloads } from "../lib/downloads";
|
||||
const ProfileEditor = lazy(() => import("./ProfileEditor"));
|
||||
import { notify } from "../lib/notifications";
|
||||
import { notifyActionError } from "../lib/actionErrors";
|
||||
import { navigateTo } from "../lib/nav";
|
||||
import { showInTray } from "../lib/downloadQueue";
|
||||
import { profileName } from "../lib/vocab";
|
||||
import { LS } from "../lib/storage";
|
||||
import { usePref } from "../lib/usePref";
|
||||
import FilterSelect from "./ui/FilterSelect";
|
||||
import { Input } from "./ui/Input";
|
||||
|
||||
// Preset picker shown when the user hits Download on a card / in the player, or adds a URL from
|
||||
// the Download Center. Enqueues via the API and points the user at the Download Center.
|
||||
// Preset picker shown when the user hits Download on a card / in the player, or brings a link (the
|
||||
// Files link box, a paste anywhere). Enqueues via the API; its notice's "View" opens the tray on it.
|
||||
// It opens on the format used last (per account): a pasted link is then one Enter away.
|
||||
const parseProfile = (v: unknown): number | null => (typeof v === "number" ? v : null);
|
||||
|
||||
export default function DownloadDialog({
|
||||
source,
|
||||
title,
|
||||
@@ -36,23 +41,30 @@ export default function DownloadDialog({
|
||||
const [manage, setManage] = useState(false);
|
||||
|
||||
const profiles = profilesQ.data ?? [];
|
||||
const chosen = profileId ?? profiles[0]?.id ?? null;
|
||||
const [lastProfile, setLastProfile] = usePref<number | null>("downloadProfile", null, {
|
||||
localKey: LS.downloadProfile,
|
||||
parse: parseProfile,
|
||||
});
|
||||
// The one used last, while it still exists (a deleted format falls back to the first).
|
||||
const remembered = profiles.some((p) => p.id === lastProfile) ? lastProfile : null;
|
||||
const chosen = profileId ?? remembered ?? profiles[0]?.id ?? null;
|
||||
|
||||
const submit = async () => {
|
||||
if (!chosen || busy) return;
|
||||
setBusy(true);
|
||||
const displayName = name.trim() || undefined;
|
||||
try {
|
||||
await api.enqueueDownload({
|
||||
const job = await api.enqueueDownload({
|
||||
source,
|
||||
profile_id: chosen,
|
||||
display_name: displayName,
|
||||
});
|
||||
invalidateDownloads(qc);
|
||||
setLastProfile(chosen);
|
||||
notify({
|
||||
level: "success",
|
||||
message: t("downloads.dialog.added"),
|
||||
action: { label: t("downloads.dialog.view"), onClick: () => navigateTo("downloads") },
|
||||
action: { label: t("downloads.dialog.view"), onClick: () => showInTray(job.id) },
|
||||
});
|
||||
onClose();
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user