Files
mutiny-web/src/components/Logs.tsx
2023-08-22 15:02:54 -05:00

36 lines
1.0 KiB
TypeScript

import { MutinyWallet } from "@mutinywallet/mutiny-wasm";
import { Button, InnerCard, NiceP, VStack } from "~/components";
import { useI18n } from "~/i18n/context";
import { downloadTextFile } from "~/utils/download";
export function Logs() {
const i18n = useI18n();
async function handleSave() {
try {
const logs = await MutinyWallet.get_logs();
await downloadTextFile(
logs.join("") || "",
"mutiny-logs.txt",
"text/plain"
);
} catch (e) {
console.error(e);
}
}
return (
<InnerCard title={i18n.t("settings.emergency_kit.logs.title")}>
<VStack>
<NiceP>
{i18n.t("settings.emergency_kit.logs.something_screwy")}
</NiceP>
<Button intent="green" onClick={handleSave}>
{i18n.t("settings.emergency_kit.logs.download_logs")}
</Button>
</VStack>
</InnerCard>
);
}