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:
@@ -4,9 +4,9 @@ import { createStore } from "./store";
|
||||
// The download queue as this tab has watched it: which jobs it has seen finish. The tray shows them
|
||||
// ("Done · Open") until it is closed, and announces each once (the done notice).
|
||||
//
|
||||
// Watched where the queue is FETCHED, not in a component's effect: every reader of the queue (the
|
||||
// tray, the Downloads page) fetches through `fetchQueue`, so a finish is seen once whichever of them
|
||||
// polled, and nothing has to diff the previous render's data.
|
||||
// Watched where the queue is FETCHED, not in a component's effect: every reader of the queue fetches
|
||||
// through `fetchQueue`, so a finish is seen once whichever of them polled, and nothing has to diff the
|
||||
// previous render's data.
|
||||
|
||||
/** The statuses a job leaves on its own: it is waiting, or working. */
|
||||
export const IN_FLIGHT: ReadonlySet<string> = new Set(["queued", "running", "paused"]);
|
||||
@@ -14,6 +14,13 @@ export const IN_FLIGHT: ReadonlySet<string> = new Set(["queued", "running", "pau
|
||||
let lastSeen: Map<number, string> | null = null;
|
||||
const finished = createStore<QueueJob[]>([]);
|
||||
const unannounced = createStore<QueueJob[]>([]);
|
||||
const revealing = createStore<Reveal | null>(null);
|
||||
|
||||
/** A job to show in the tray, asked for at `at` (ms). */
|
||||
export interface Reveal {
|
||||
id: number;
|
||||
at: number;
|
||||
}
|
||||
|
||||
/** Note a fresh queue: a job that is done now and was not on the last look has just finished. The
|
||||
* first look only learns what is there — a file finished before this tab opened is old news. */
|
||||
@@ -51,9 +58,21 @@ export function takeUnannounced(): QueueJob[] {
|
||||
return list;
|
||||
}
|
||||
|
||||
/** "View" on a job just started (a download, a clip, an upload still converting): the tray opens on
|
||||
* its row — unfolded, back if it was closed, the keyboard on the row. One the tray no longer lists
|
||||
* because it is done already opens as a file. */
|
||||
export const showInTray = (id: number): void => revealing.set({ id, at: Date.now() });
|
||||
|
||||
/** The pending "View", until the tray has answered it. */
|
||||
export const useRevealing = (): Reveal | null => revealing.useValue();
|
||||
|
||||
/** The tray answered the "View" (or the job is not in the queue at all). */
|
||||
export const doneRevealing = (): void => revealing.set(null);
|
||||
|
||||
/** Forget what was watched (a test starts from a tab that has looked at nothing). */
|
||||
export function resetQueueWatch(): void {
|
||||
lastSeen = null;
|
||||
finished.set([]);
|
||||
unannounced.set([]);
|
||||
revealing.set(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user