Skip to content

Commit

Permalink
fix: routes
Browse files Browse the repository at this point in the history
  • Loading branch information
reyamir committed Jun 19, 2024
1 parent d14e609 commit e1424b8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
23 changes: 10 additions & 13 deletions apps/desktop2/src/routes/auth/$account.backup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ function Screen() {
return toast.warning("You need to confirm before continue");
}

return navigate({
to: "/auth/$account/settings",
params: { account },
});
navigate({ to: "/", replace: true });
}

// start loading
Expand Down Expand Up @@ -65,15 +62,15 @@ function Screen() {
};

return (
<div className="mx-auto flex h-full w-full flex-col items-center justify-center gap-6 px-5 xl:max-w-xl">
<div className="flex flex-col items-center justify-center w-full h-full gap-6 px-5 mx-auto xl:max-w-xl">
<div className="flex flex-col text-center">
<h3 className="text-xl font-semibold">Backup your sign in keys</h3>
<p className="text-neutral-700 dark:text-neutral-300">
It's use for login to Lume or other Nostr clients. You will lost
access to your account if you lose this key.
</p>
</div>
<div className="flex w-full flex-col gap-5">
<div className="flex flex-col w-full gap-5">
<div className="flex flex-col gap-2">
<label htmlFor="passphase" className="font-medium">
Set a passphase to secure your key
Expand All @@ -84,7 +81,7 @@ function Screen() {
type="password"
value={passphase}
onChange={(e) => setPassphase(e.target.value)}
className="w-full h-11 rounded-lg border-transparent bg-neutral-100 px-3 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:bg-white/10 dark:placeholder:text-neutral-400"
className="w-full px-3 border-transparent rounded-lg h-11 bg-neutral-100 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:bg-white/10 dark:placeholder:text-neutral-400"
/>
</div>
</div>
Expand All @@ -100,12 +97,12 @@ function Screen() {
type="text"
value={displayNsec(key, 36)}
readOnly
className="w-full h-11 rounded-lg border-transparent bg-neutral-100 px-3 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:bg-white/10 dark:placeholder:text-neutral-400"
className="w-full px-3 border-transparent rounded-lg h-11 bg-neutral-100 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:bg-white/10 dark:placeholder:text-neutral-400"
/>
<button
type="button"
onClick={() => copyKey()}
className="inline-flex h-11 w-24 items-center justify-center rounded-lg bg-neutral-200 hover:bg-neutral-300 dark:bg-white/20 dark:hover:bg-white/30"
className="inline-flex items-center justify-center w-24 rounded-lg h-11 bg-neutral-200 hover:bg-neutral-300 dark:bg-white/20 dark:hover:bg-white/30"
>
{copied ? "Copied" : "Copy"}
</button>
Expand All @@ -120,7 +117,7 @@ function Screen() {
onCheckedChange={() =>
setConfirm((state) => ({ ...state, c1: !state.c1 }))
}
className="flex size-6 appearance-none items-center justify-center rounded-md bg-neutral-100 outline-none dark:bg-white/10 dark:hover:bg-white/20"
className="flex items-center justify-center rounded-md outline-none appearance-none size-6 bg-neutral-100 dark:bg-white/10 dark:hover:bg-white/20"
id="confirm1"
>
<Checkbox.Indicator className="text-blue-500">
Expand All @@ -140,7 +137,7 @@ function Screen() {
onCheckedChange={() =>
setConfirm((state) => ({ ...state, c2: !state.c2 }))
}
className="flex size-6 appearance-none items-center justify-center rounded-md bg-neutral-100 outline-none dark:bg-white/10 dark:hover:bg-white/20"
className="flex items-center justify-center rounded-md outline-none appearance-none size-6 bg-neutral-100 dark:bg-white/10 dark:hover:bg-white/20"
id="confirm2"
>
<Checkbox.Indicator className="text-blue-500">
Expand All @@ -160,7 +157,7 @@ function Screen() {
onCheckedChange={() =>
setConfirm((state) => ({ ...state, c3: !state.c3 }))
}
className="flex size-6 appearance-none items-center justify-center rounded-md bg-neutral-100 outline-none dark:bg-white/10 dark:hover:bg-white/20"
className="flex items-center justify-center rounded-md outline-none appearance-none size-6 bg-neutral-100 dark:bg-white/10 dark:hover:bg-white/20"
id="confirm3"
>
<Checkbox.Indicator className="text-blue-500">
Expand All @@ -183,7 +180,7 @@ function Screen() {
type="button"
onClick={() => submit()}
disabled={loading}
className="inline-flex h-11 w-full shrink-0 items-center justify-center rounded-lg bg-blue-500 font-semibold text-white hover:bg-blue-600 disabled:opacity-50"
className="inline-flex items-center justify-center w-full font-semibold text-white bg-blue-500 rounded-lg h-11 shrink-0 hover:bg-blue-600 disabled:opacity-50"
>
{loading ? <Spinner /> : t("global.continue")}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createLazyFileRoute } from "@tanstack/react-router";
import { useState } from "react";
import { toast } from "sonner";

export const Route = createLazyFileRoute("/auth/privkey")({
export const Route = createLazyFileRoute("/auth/import")({
component: Screen,
});

Expand All @@ -27,11 +27,7 @@ function Screen() {
const npub = await NostrAccount.saveAccount(key, password);

if (npub) {
navigate({
to: "/$account/home",
params: { account: npub },
replace: true,
});
navigate({ to: "/", replace: true });
}
} catch (e) {
setLoading(false);
Expand Down
6 changes: 1 addition & 5 deletions apps/desktop2/src/routes/auth/remote.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ function Screen() {
const remoteAccount = await NostrAccount.connectRemoteAccount(uri);

if (remoteAccount?.length) {
return navigate({
to: "/$account/home",
params: { account: remoteAccount },
replace: true,
});
navigate({ to: "/", replace: true });
}
} catch (e) {
setLoading(false);
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop2/src/routes/landing.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function Screen() {
</div>
<div className="flex flex-col gap-1 pb-2.5">
<Link
to="/auth/privkey"
to="/auth/import"
className="inline-flex items-center w-full gap-2 px-2 rounded-lg h-11 hover:bg-neutral-100 dark:hover:bg-white/10"
>
<div className="inline-flex items-center justify-center size-9">
Expand Down

0 comments on commit e1424b8

Please sign in to comment.