From 014764feb1860d5a442787024eb45ee55e106561 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 26 Mar 2024 13:55:04 -0500 Subject: [PATCH] add setup restore route, organize setup routes into folder --- public/i18n/en.json | 1 + src/components/layout/BackLink.tsx | 7 +++++- src/router.tsx | 5 ++-- src/routes/index.ts | 3 --- src/routes/settings/Restore.tsx | 2 +- src/routes/{ => setup}/ImportProfile.tsx | 0 src/routes/{ => setup}/NewProfile.tsx | 0 src/routes/setup/Restore.tsx | 30 ++++++++++++++++++++++++ src/routes/{Setup.tsx => setup/Root.tsx} | 2 +- src/routes/setup/index.ts | 4 ++++ 10 files changed, 45 insertions(+), 9 deletions(-) rename src/routes/{ => setup}/ImportProfile.tsx (100%) rename src/routes/{ => setup}/NewProfile.tsx (100%) create mode 100644 src/routes/setup/Restore.tsx rename src/routes/{Setup.tsx => setup/Root.tsx} (97%) create mode 100644 src/routes/setup/index.ts diff --git a/public/i18n/en.json b/public/i18n/en.json index 6f6f389..9de5ccd 100644 --- a/public/i18n/en.json +++ b/public/i18n/en.json @@ -693,6 +693,7 @@ }, "onboarding": { "welcome": "Welcome!", + "setup": "Setup", "restore_from_backup": "If you've used Mutiny before you can restore from a backup. Otherwise you can skip this and enjoy your new wallet!", "not_available": "We don't do that yet", "secure_your_funds": "Secure your funds" diff --git a/src/components/layout/BackLink.tsx b/src/components/layout/BackLink.tsx index 7770ef0..28e8b50 100644 --- a/src/components/layout/BackLink.tsx +++ b/src/components/layout/BackLink.tsx @@ -3,12 +3,17 @@ import { ChevronLeft } from "lucide-solid"; import { useI18n } from "~/i18n/context"; -export function BackLink(props: { href?: string; title?: string }) { +export function BackLink(props: { + href?: string; + title?: string; + showOnDesktop?: boolean; +}) { const i18n = useI18n(); return ( {props.title ? props.title : i18n.t("common.home")} diff --git a/src/router.tsx b/src/router.tsx index d100f21..c77cb21 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -23,9 +23,7 @@ import { EditProfile, Feedback, Gift as GiftReceive, - ImportProfile, Main, - NewProfile, NotFound, Profile, Receive, @@ -34,7 +32,6 @@ import { Scanner, Search, Send, - Setup, Swap, SwapLightning } from "~/routes"; @@ -55,6 +52,7 @@ import { Servers, Settings } from "~/routes/settings"; +import { ImportProfile, NewProfile, Setup, SetupRestore } from "~/routes/setup"; import { Provider as MegaStoreProvider, useMegaStore } from "~/state/megaStore"; function GlobalListeners() { @@ -158,6 +156,7 @@ export function Router() { > + diff --git a/src/routes/index.ts b/src/routes/index.ts index a4dafcd..860fab1 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -11,8 +11,5 @@ export * from "./Search"; export * from "./Redeem"; export * from "./Profile"; export * from "./Chat"; -export * from "./Setup"; -export * from "./NewProfile"; export * from "./Request"; -export * from "./ImportProfile"; export * from "./EditProfile"; diff --git a/src/routes/settings/Restore.tsx b/src/routes/settings/Restore.tsx index 1e9c35e..874d42d 100644 --- a/src/routes/settings/Restore.tsx +++ b/src/routes/settings/Restore.tsx @@ -77,7 +77,7 @@ function SeedTextField(props: TextFieldProps) { ); } -function TwelveWordsEntry() { +export function TwelveWordsEntry() { const i18n = useI18n(); const [state, actions] = useMegaStore(); diff --git a/src/routes/ImportProfile.tsx b/src/routes/setup/ImportProfile.tsx similarity index 100% rename from src/routes/ImportProfile.tsx rename to src/routes/setup/ImportProfile.tsx diff --git a/src/routes/NewProfile.tsx b/src/routes/setup/NewProfile.tsx similarity index 100% rename from src/routes/NewProfile.tsx rename to src/routes/setup/NewProfile.tsx diff --git a/src/routes/setup/Restore.tsx b/src/routes/setup/Restore.tsx new file mode 100644 index 0000000..19a4633 --- /dev/null +++ b/src/routes/setup/Restore.tsx @@ -0,0 +1,30 @@ +import { + BackLink, + DefaultMain, + LargeHeader, + NiceP, + VStack +} from "~/components"; +import { useI18n } from "~/i18n/context"; +import { TwelveWordsEntry } from "~/routes/settings/Restore"; + +export function SetupRestore() { + const i18n = useI18n(); + return ( + + + {i18n.t("settings.restore.title")} + + +

{i18n.t("settings.restore.restore_tip")}

+

{i18n.t("settings.restore.multi_browser_warning")}

+
+ +
+
+ ); +} diff --git a/src/routes/Setup.tsx b/src/routes/setup/Root.tsx similarity index 97% rename from src/routes/Setup.tsx rename to src/routes/setup/Root.tsx index 7517f75..e5aa6fd 100644 --- a/src/routes/Setup.tsx +++ b/src/routes/setup/Root.tsx @@ -62,7 +62,7 @@ export function Setup() { intent="text" layout="full" disabled={isCreatingNewWallet()} - onClick={() => navigate("/settings/restore")} + onClick={() => navigate("/setup/restore")} > Import Existing diff --git a/src/routes/setup/index.ts b/src/routes/setup/index.ts new file mode 100644 index 0000000..577594d --- /dev/null +++ b/src/routes/setup/index.ts @@ -0,0 +1,4 @@ +export * from "./Restore"; +export * from "./ImportProfile"; +export * from "./NewProfile"; +export * from "./Root";