1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-23 15:07:43 +01:00
smov/src/pages/parts/auth/PassphraseGeneratePart.tsx
2023-11-30 23:37:07 +01:00

39 lines
1.1 KiB
TypeScript

import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { genMnemonic } from "@/backend/accounts/crypto";
import { Button } from "@/components/buttons/Button";
import { PassphraseDisplay } from "@/components/form/PassphraseDisplay";
import { Icon, Icons } from "@/components/Icon";
import {
LargeCard,
LargeCardButtons,
LargeCardText,
} from "@/components/layout/LargeCard";
interface PassphraseGeneratePartProps {
onNext?: (mnemonic: string) => void;
}
export function PassphraseGeneratePart(props: PassphraseGeneratePartProps) {
const mnemonic = useMemo(() => genMnemonic(), []);
const { t } = useTranslation();
return (
<LargeCard>
<LargeCardText
title={t("auth.generate.title")}
icon={<Icon icon={Icons.USER} />}
>
{t("auth.generate.description")}
</LargeCardText>
<PassphraseDisplay mnemonic={mnemonic} />
<LargeCardButtons>
<Button theme="purple" onClick={() => props.onNext?.(mnemonic)}>
{t("auth.generate.next")}
</Button>
</LargeCardButtons>
</LargeCard>
);
}