Command Menu improvements (#857)

* Add dialogs for reset and clear actions + clear stores

* Catch failures

* Improve tests, don't reset store on failure

* Remove unnecessary i18n string

---------

Co-authored-by: philon- <philon-@users.noreply.github.com>
This commit is contained in:
Jeremy Gallant
2025-09-18 08:13:19 -04:00
committed by GitHub
co-authored by philon-
parent 1bdd923365
commit 8cc451546d
14 changed files with 567 additions and 18 deletions
@@ -0,0 +1,35 @@
import { clearAllStores } from "@core/stores";
import { useTranslation } from "react-i18next";
import { DialogWrapper } from "../DialogWrapper.tsx";
export interface ClearAllStoresDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
}
export const ClearAllStoresDialog = ({
open,
onOpenChange,
}: ClearAllStoresDialogProps) => {
const { t } = useTranslation("dialog");
const handleClearAllStores = () => {
clearAllStores();
// Reload the app to ensure all state is cleared
window.location.href = "/";
};
return (
<DialogWrapper
open={open}
onOpenChange={onOpenChange}
type="confirm"
variant="destructive"
title={t("clearAllStores.title")}
description={t("clearAllStores.description")}
confirmText={t("clearAllStores.confirm")}
onConfirm={handleClearAllStores}
/>
);
};