Machine-baseline harvest (ruff + knip), all tsc/parse-green, no runtime change: - backend: remove 3 unused imports (channels/playlists/youtube) via ruff; drop the unused `job` binding in unshare_download (keep the _own_job ownership guard call). - frontend: remove `export` from 23 internally-used-only symbols (knip "unused exports") to shrink the public surface; delete 2 genuinely-dead declarations (PlexBrowseResult — leftover from the removed /browse route; WIDGET_TITLES — hardcoded English titles superseded by i18n). Held back for a decision (unused here = possibly-unwired, NOT dead — flagged, not removed): e2ee.lock()/clearDevice() (security primitives never wired to logout / a "forget device" feature) and loadDefaultViewFilters (App reimplements it inline — a DRY issue). See siftlode-ops/CODE-HYGIENE.md.
27 lines
881 B
TypeScript
27 lines
881 B
TypeScript
import i18n from "../i18n";
|
|
import { createStore } from "./store";
|
|
|
|
// A single, self-explanatory error dialog (modal) the user must acknowledge — used when the
|
|
// server can't carry out an action (a definitive 4xx/5xx response). Distinct from toasts
|
|
// (transient, e.g. connection blips) and from silent handling. Module-level so the non-React
|
|
// api layer can raise it; an <ErrorDialog> mounted at the app root renders the current one.
|
|
interface AppError {
|
|
title: string;
|
|
message: string;
|
|
}
|
|
|
|
const store = createStore<AppError | null>(null);
|
|
|
|
export function reportError(message?: string, title?: string): void {
|
|
store.set({
|
|
title: title || i18n.t("errors.title"),
|
|
message: message || i18n.t("errors.generic"),
|
|
});
|
|
}
|
|
|
|
export function dismissError(): void {
|
|
store.set(null);
|
|
}
|
|
|
|
export const subscribeError = store.subscribe;
|
|
export const getError = store.get;
|