import { Button } from "@components/UI/Button.tsx"; import { Dialog, DialogClose, DialogContent, DialogHeader, DialogTitle, } from "@components/UI/Dialog.tsx"; import { useNodeAsProto } from "@core/hooks/useNodesAsProto.ts"; import { useNodeErrors } from "@meshtastic/sdk-react"; import { LockKeyholeOpenIcon } from "lucide-react"; import { useTranslation } from "react-i18next"; import { useRefreshKeysDialog } from "./useRefreshKeysDialog.ts"; export interface RefreshKeysDialogProps { open: boolean; onOpenChange: (open: boolean) => void; } export const RefreshKeysDialog = ({ open, onOpenChange, }: RefreshKeysDialogProps) => { const { t } = useTranslation("dialog"); const nodeError = useNodeErrors()[0]; const nodeWithError = useNodeAsProto(nodeError?.node ?? 0); const { handleCloseDialog, handleNodeRemove } = useRefreshKeysDialog(); if (!nodeError) { return null; } const text = { title: t("refreshKeys.title", { interpolation: { escapeValue: false }, identifier: nodeWithError?.user?.longName ?? "", }), description: `${t("refreshKeys.description.unableToSendDmPrefix")}${ nodeWithError?.user?.longName ?? "" } (${nodeWithError?.user?.shortName ?? ""})${t( "refreshKeys.description.keyMismatchReasonSuffix", )}`, }; return ( {text.title} {text.description}
  • {t("refreshKeys.label.acceptNewKeys")}

    {t("refreshKeys.description.acceptNewKeys")}

); };