From 9a43b2392ece9d9a546306557ada13656f4dc58a Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Thu, 12 May 2022 19:19:46 +0200 Subject: [PATCH] feat(Backup): Add backup screen. --- .../renderer/src/constants/lang/LangKeys.ts | 6 +++ packages/renderer/src/constants/lang/en.ts | 8 ++++ packages/renderer/src/constants/lang/es.ts | 11 +++++ .../Account/{ => Backup}/AccountBackup.tsx | 10 ++++- .../Account/Backup/AccountBackupDownload.tsx | 45 +++++++++++++++++++ .../Account/Backup/AccountBackupRestore.tsx | 45 +++++++++++++++++++ .../src/pages/Account/Backup/index.ts | 1 + packages/renderer/src/pages/Account/index.ts | 2 +- 8 files changed, 126 insertions(+), 2 deletions(-) rename packages/renderer/src/pages/Account/{ => Backup}/AccountBackup.tsx (74%) create mode 100644 packages/renderer/src/pages/Account/Backup/AccountBackupDownload.tsx create mode 100644 packages/renderer/src/pages/Account/Backup/AccountBackupRestore.tsx create mode 100644 packages/renderer/src/pages/Account/Backup/index.ts diff --git a/packages/renderer/src/constants/lang/LangKeys.ts b/packages/renderer/src/constants/lang/LangKeys.ts index ce7c2a7..b1ff733 100644 --- a/packages/renderer/src/constants/lang/LangKeys.ts +++ b/packages/renderer/src/constants/lang/LangKeys.ts @@ -46,4 +46,10 @@ export enum LangKeys { AccountSecurityFieldCurrentPassword = "account.security.field.currentPassword", AccountSecurityFieldPasswordFormatMsg = "account.security.field.password.format.message", AccountSecurityFieldRepeatPasswordMatchMsg = "account.security.field.repeatPassword.match.message", + AccountBackupDownloadTitle = "account.backup.download.title", + AccountBackupDownloadDesc = "account.backup.download.desc", + AccountBackupDownloadBtn = "account.backup.download.btn", + AccountBackupRestoreTitle = "account.backup.restore.title", + AccountBackupRestoreDesc = "account.backup.restore.desc", + AccountBackupRestoreBtn = "account.backup.restore.btn", } diff --git a/packages/renderer/src/constants/lang/en.ts b/packages/renderer/src/constants/lang/en.ts index 8352d1a..62597fc 100644 --- a/packages/renderer/src/constants/lang/en.ts +++ b/packages/renderer/src/constants/lang/en.ts @@ -53,6 +53,14 @@ const LangPackEN: { [key in LangKeys]: string } = { [LangKeys.AccountSecurityFieldRepeatPasswordMatchMsg]: "Passwords don't match", [LangKeys.CreatePassword]: "Create password", + [LangKeys.AccountBackupDownloadTitle]: "Download your backup file", + [LangKeys.AccountBackupDownloadDesc]: + "To be able to restore your Haveno account you need to create a backup file of your account. Keep it somewhere safe.", + [LangKeys.AccountBackupDownloadBtn]: "Download backup file", + [LangKeys.AccountBackupRestoreTitle]: "Restore an existing backup file", + [LangKeys.AccountBackupRestoreDesc]: + "When you restore an existing backup file of your Haveno account, you will lose the account you’re using currently. Please use with caution.", + [LangKeys.AccountBackupRestoreBtn]: "Restore backup", }; export default LangPackEN; diff --git a/packages/renderer/src/constants/lang/es.ts b/packages/renderer/src/constants/lang/es.ts index 1424e93..8809399 100644 --- a/packages/renderer/src/constants/lang/es.ts +++ b/packages/renderer/src/constants/lang/es.ts @@ -54,6 +54,17 @@ const LangPackES: { [key in LangKeys]: string } = { [LangKeys.AccountSecurityFieldRepeatPasswordMatchMsg]: "La confirmación de la contraseña no coincide con la contraseña.", [LangKeys.CreatePassword]: "Crear contraseña", + [LangKeys.AccountBackupDownloadTitle]: + "Descarga tu archivo de copia de seguridad", + [LangKeys.AccountBackupDownloadDesc]: + "Para poder restore your Haveno account you need to create a backup file of your account. Keep it somewhere safe.", + [LangKeys.AccountBackupDownloadBtn]: + "Descargar archivo de copia de seguridad", + [LangKeys.AccountBackupRestoreTitle]: + "Restaurar un archivo de copia de seguridad existente", + [LangKeys.AccountBackupRestoreDesc]: + "Cuando restaure un archivo de respaldo existente de su cuenta de Haveno, perderá la cuenta que está usando actualmente. Úselo con precaución.", + [LangKeys.AccountBackupRestoreBtn]: "Restaurar copia de seguridad", }; export default LangPackES; diff --git a/packages/renderer/src/pages/Account/AccountBackup.tsx b/packages/renderer/src/pages/Account/Backup/AccountBackup.tsx similarity index 74% rename from packages/renderer/src/pages/Account/AccountBackup.tsx rename to packages/renderer/src/pages/Account/Backup/AccountBackup.tsx index 38b5f01..2574f63 100644 --- a/packages/renderer/src/pages/Account/AccountBackup.tsx +++ b/packages/renderer/src/pages/Account/Backup/AccountBackup.tsx @@ -14,12 +14,20 @@ // limitations under the License. // ============================================================================= +import { Box, Stack } from "@mantine/core"; import { AccountLayout } from "@templates/AccountLayout"; +import { AccountBackupDownload } from "./AccountBackupDownload"; +import { AccountRestoreDownload } from "./AccountBackupRestore"; export function AccountBackup() { return ( -

Account Backup

+ + + + + +
); } diff --git a/packages/renderer/src/pages/Account/Backup/AccountBackupDownload.tsx b/packages/renderer/src/pages/Account/Backup/AccountBackupDownload.tsx new file mode 100644 index 0000000..d0db269 --- /dev/null +++ b/packages/renderer/src/pages/Account/Backup/AccountBackupDownload.tsx @@ -0,0 +1,45 @@ +import { FormattedMessage } from "react-intl"; +import { Box, createStyles } from "@mantine/core"; +import { BodyText, Heading } from "@atoms/Typography"; +import { LangKeys } from "@constants/lang"; +import { Button } from "@atoms/Buttons"; + +export function AccountBackupDownload() { + const { classes } = useStyles(); + + return ( + + + Download your backup file + + + + To be able to restore your Haveno account you need to create a backup + file of your account. Keep it somewhere safe. + + + + + ); +} + +const useStyles = createStyles((theme) => ({ + heading: { + marginBottom: theme.spacing.md, + }, + desc: { + marginBottom: theme.spacing.lg, + }, +})); diff --git a/packages/renderer/src/pages/Account/Backup/AccountBackupRestore.tsx b/packages/renderer/src/pages/Account/Backup/AccountBackupRestore.tsx new file mode 100644 index 0000000..d2d48f9 --- /dev/null +++ b/packages/renderer/src/pages/Account/Backup/AccountBackupRestore.tsx @@ -0,0 +1,45 @@ +import { Box, createStyles } from "@mantine/core"; +import { BodyText, Heading } from "@atoms/Typography"; +import { LangKeys } from "@constants/lang"; +import { Button } from "@atoms/Buttons"; +import { FormattedMessage } from "react-intl"; + +export function AccountRestoreDownload() { + const { classes } = useStyles(); + + return ( + + + Restore an existing backup file + + + + When you restore an existing backup file of your Haveno account, you + will lose the account you’re using currently. Please use with caution. + + + + + ); +} + +const useStyles = createStyles((theme) => ({ + heading: { + marginBottom: theme.spacing.md, + }, + desc: { + marginBottom: theme.spacing.lg, + }, +})); diff --git a/packages/renderer/src/pages/Account/Backup/index.ts b/packages/renderer/src/pages/Account/Backup/index.ts new file mode 100644 index 0000000..2837403 --- /dev/null +++ b/packages/renderer/src/pages/Account/Backup/index.ts @@ -0,0 +1 @@ +export * from "./AccountBackup"; diff --git a/packages/renderer/src/pages/Account/index.ts b/packages/renderer/src/pages/Account/index.ts index b951134..0b50728 100644 --- a/packages/renderer/src/pages/Account/index.ts +++ b/packages/renderer/src/pages/Account/index.ts @@ -16,7 +16,7 @@ export * from "./AddPaymentAccount"; export * from "./PaymentMethods"; -export * from "./AccountBackup"; +export * from "./Backup"; export * from "./NodeSettings"; export * from "./AccountPaymentAccounts"; export * from "./AccountSecurity";