feat: route location state to drawer from login

This commit is contained in:
me
2026-05-06 21:21:28 +05:30
parent 9800174df1
commit e532507a0f
4 changed files with 322 additions and 323 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ export default function App() {
return ( return (
<BrowserRouter> <BrowserRouter>
<main className="relative min-h-screen min-w-screen flex items-center justify-center w-full bg-base-200 before:absolute before:top-0 before:left-0 before:w-full before:h-full before:content-[''] before:opacity-[0.03] before:z-10 before:pointer-events-none before:bg-[url('assets/noise.gif')]"> <main className="relative min-h-screen min-w-screen flex items-center justify-center w-full bg-base-200 before:absolute before:top-0 before:left-0 before:w-full before:h-full before:content-[''] before:opacity-[0.03] before:z-50 before:pointer-events-none before:bg-[url('assets/noise.gif')]">
<Suspense fallback={<SplashScreen />}> <Suspense fallback={<SplashScreen />}>
<Routes> <Routes>
<Route path={ROUTES.HOME} element={<Home />} /> <Route path={ROUTES.HOME} element={<Home />} />
@@ -34,8 +34,7 @@ export default function WelcomeModal({
className="inline text-primary" className="inline text-primary"
weight="fill" weight="fill"
/> />
<div className="divider my-0"></div> <span className="divider my-0 block"></span>
<br />
Everything you write here is sealed with your password,{" "} Everything you write here is sealed with your password,{" "}
<span className="font-display text-success">cryptographically</span> <span className="font-display text-success">cryptographically</span>
, before it leaves your hands. , before it leaves your hands.
@@ -44,11 +43,11 @@ export default function WelcomeModal({
<div className="alert alert-warning bg-paper/20 border-paper/20 flex items-start gap-3 text-left py-3"> <div className="alert alert-warning bg-paper/20 border-paper/20 flex items-start gap-3 text-left py-3">
<WarningIcon size={24} weight="fill" className="shrink-0 mt-0.5" /> <WarningIcon size={24} weight="fill" className="shrink-0 mt-0.5" />
<p className="text-sm font-medium text-primary-content"> <div className="text-sm font-medium text-primary-content">
If you ever happen to forget your password, your letters are lost If you ever happen to forget your password, your letters are lost
to time, forever. to time, forever.
<br /> <br />
<span className="font-bold mt-2"> <span className="font-bold mt-2 block">
I highly, highly recommend storing this password in your{" "} I highly, highly recommend storing this password in your{" "}
<a <a
href="https://www.privacyguides.org/en/passwords/" href="https://www.privacyguides.org/en/passwords/"
@@ -60,7 +59,7 @@ export default function WelcomeModal({
</a>{" "} </a>{" "}
or somewhere safe to remember it. or somewhere safe to remember it.
</span> </span>
</p> </div>
</div> </div>
<div className="modal-action w-full"> <div className="modal-action w-full">
+2 -2
View File
@@ -7,7 +7,7 @@ import { useLocation, useNavigate } from "react-router-dom";
import { z } from "zod"; import { z } from "zod";
import { api, publicApi } from "../api/apiClient"; import { api, publicApi } from "../api/apiClient";
import Logo from "../components/Logo"; import Logo from "../components/Logo";
import WelcomeModal from "../components/login/WelcomeModal.tsx"; import WelcomeModal from "../components/login/WelcomeModal";
import FormField from "../components/ui/FormField"; import FormField from "../components/ui/FormField";
import Saajan from "../components/ui/Saajan"; import Saajan from "../components/ui/Saajan";
import { endpoints } from "../config/endpoints"; import { endpoints } from "../config/endpoints";
@@ -64,7 +64,7 @@ export default function Login() {
await setAuthStore(authData.access, userData, masterKey); await setAuthStore(authData.access, userData, masterKey);
navigate(nextRoute, { replace: true }); navigate(nextRoute, { replace: true, state: location.state });
} catch (err) { } catch (err) {
let message = let message =
"Sorry, we're experiencing technical issues.\nPlease try again later."; "Sorry, we're experiencing technical issues.\nPlease try again later.";