1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-22 14:57:40 +01:00
smov/src/pages/parts/auth/PassphraseGeneratePart.tsx
William Oldham 75933e7080 More localisation
Co-authored-by: mrjvs <mistrjvs@gmail.com>
2023-11-27 19:19:03 +00: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("actions.next")}
</Button>
</LargeCardButtons>
</LargeCard>
);
}