Sweep the rounded-lg solid/ghost/outline action-button family onto the shared primitive: ConfirmProvider, ErrorDialog, DownloadDialog, DownloadCenter, downloadModals, downloadAdmin, ProfileEditor, PersonalViewsModal, SettingsPanel, WatchPage, DraftSaveBar. Deliberately left on their own styles per the agreed scope: login/onboarding rounded-xl CTAs (Welcome/Onboarding/ Setup/KeyGate), glass Plex surfaces, segmented pills/toggles/switches/chips, dropdown triggers, data-driven Banner/tone maps, text-xs dense buttons, and tiny inline p-1/p-1.5 icon controls — none map 1:1 to a variant+size without a visual change, and the repo has no tailwind-merge.
21 lines
792 B
TypeScript
21 lines
792 B
TypeScript
import { useSyncExternalStore } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { dismissError, getError, subscribeError } from "../lib/errorDialog";
|
|
import Modal from "./Modal";
|
|
import { Button } from "./ui/Button";
|
|
|
|
// Renders the current app error (if any) as a modal the user must acknowledge.
|
|
export default function ErrorDialog() {
|
|
const { t } = useTranslation();
|
|
const err = useSyncExternalStore(subscribeError, getError, getError);
|
|
if (!err) return null;
|
|
return (
|
|
<Modal title={err.title} onClose={dismissError} maxWidth="max-w-md">
|
|
<p className="text-sm leading-relaxed text-fg/90">{err.message}</p>
|
|
<div className="flex justify-end mt-5">
|
|
<Button onClick={dismissError}>{t("errors.ok")}</Button>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}
|