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

40 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-11-05 01:16:45 +01:00
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
2023-11-05 01:16:45 +01:00
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";
2023-11-05 01:16:45 +01:00
interface PassphraseGeneratePartProps {
onNext?: (mnemonic: string) => void;
}
export function PassphraseGeneratePart(props: PassphraseGeneratePartProps) {
const mnemonic = useMemo(() => genMnemonic(), []);
const { t } = useTranslation();
2023-11-05 01:16:45 +01:00
return (
<LargeCard>
<LargeCardText
title={t("auth.generate.title")}
icon={<Icon icon={Icons.USER} />}
>
{t("auth.generate.description")}
</LargeCardText>
2023-11-24 21:54:44 +01:00
<PassphraseDisplay mnemonic={mnemonic} />
<LargeCardButtons>
<Button theme="purple" onClick={() => props.onNext?.(mnemonic)}>
{t("actions.next")}
</Button>
</LargeCardButtons>
</LargeCard>
2023-11-05 01:16:45 +01:00
);
}