Files
siftlode/frontend/src/components/ui/backToTopState.ts
T
peter 1c4f0042d2 feat(files): download from anywhere — a link box, a pasted link, the palette; the running downloads in a tray
- Files toolbar link box (paste button, Enter); a lone http(s) link pasted onto any page opens the one
  app-wide download dialog, which now names the link; the palette's "Download from a link…" focuses
  the box on its history entry.
- The download tray, bottom right on every page: what waits, runs, is paused or failed (reason +
  Retry, the queue's right-click / "…" menu), and what finished in this tab as "Done · Open" until
  closed; folds to a pill (per-account pref); closed, it stays shut — across a reload — until the
  work changes or something finishes. Back to top steps up over it, the page end keeps clear.
- A finish is announced once: "Downloaded: …", whether a phone plays it, Copy link + Open (toasts
  and notices may carry a second action).
- The inbox's ready notice opens the file in its folder: download_done carries job_id + folder_id.
- GET /api/downloads is the queue only (in flight, failed, finished in the last 10 minutes), with
  each row's source key.
2026-10-11 16:56:13 +02:00

23 lines
900 B
TypeScript

import { createStore } from "../../lib/store";
// Whether the Back-to-top button is up. It floats over the page's bottom-right corner, so PageScroller
// reads this to keep the END of the page clear of it while it shows: a table's closing pager sat under
// the button — "100" and "All" covered (found in UAT, the channel manager on a short window).
export const backToTopShown = createStore(false);
export function useBackToTopShown(): boolean {
return backToTopShown.useValue();
}
// How tall the thing docked in the same corner under the button is (px; 0 = nothing) — the download
// tray. The button steps up over it, and PageScroller keeps the page's end clear of both.
const cornerLift = createStore(0);
export function setCornerLift(px: number): void {
if (cornerLift.get() !== px) cornerLift.set(px);
}
export function useCornerLift(): number {
return cornerLift.useValue();
}