import { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@components/UI/Dialog.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { useTranslation } from "react-i18next"; export interface ClientNotificationDialogProps { open: boolean; onOpenChange: (open: boolean) => void; } export const ClientNotificationDialog = ({ open, onOpenChange, }: ClientNotificationDialogProps) => { const { t } = useTranslation("dialog"); const { getClientNotification, removeClientNotification } = useDevice(); const localOnOpenChange = (open: boolean) => { removeClientNotification(0); if (!getClientNotification(0)) { onOpenChange(open); } }; const dialogContent = (() => { if (!getClientNotification(0)) { return; } switch (getClientNotification(0)?.payloadVariant.case) { // TODO: Add KeyVerification logic /*case "keyVerificationNumberInform": return <>; case "keyVerificationNumberRequest": return <>; case "keyVerificationFinal": return <>; case "duplicatedPublicKey": return <>; case "lowEntropyKey": return <>;*/ default: return ( {t("clientNotification.title")} {t([ `clientNotification.${getClientNotification(0)?.message}`, getClientNotification(0)?.message ?? "", ])} ); } })(); return ( {dialogContent} ); };