feat: add ssajan in lots of flows

This commit is contained in:
ramvignesh-b
2026-04-28 03:12:25 +05:30
parent 935a43c311
commit ac2c7b0eac
5 changed files with 67 additions and 44 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ export function useLetters() {
return { return {
drafts: letters.filter((l) => l.status === "DRAFT"), drafts: letters.filter((l) => l.status === "DRAFT"),
kept: letters.filter((l) => l.type === "KEPT" && l.status === "SEALED"), kept: letters.filter((l) => l.type === "KEPT" && l.status === "SEALED"),
vault: letters.filter((l) => l.type === "VAULT"), vault: letters.filter((l) => l.type === "VAULT" && l.status === "SEALED"),
sent: letters.filter((l) => l.type === "SENT" && l.status === "SEALED"), sent: letters.filter((l) => l.type === "SENT" && l.status === "SEALED"),
}; };
}, [letters]); }, [letters]);
+7 -9
View File
@@ -16,8 +16,6 @@ export default function Activate() {
useEffect(() => { useEffect(() => {
if (!(uidb64 && token) || hasCalled.current) return; if (!(uidb64 && token) || hasCalled.current) return;
// prevent double api calls
hasCalled.current = true; hasCalled.current = true;
const activateAccount = async () => { const activateAccount = async () => {
@@ -46,7 +44,7 @@ export default function Activate() {
)} )}
{status === "success" && ( {status === "success" && (
<div className="flex flex-col items-center gap-6 animate-in fade-in zoom-in duration-500"> <div className="flex flex-col items-center gap-6 duration-500">
<div className="bg-success/10 p-4 rounded-full"> <div className="bg-success/10 p-4 rounded-full">
<CheckCircleIcon <CheckCircleIcon
size={64} size={64}
@@ -57,13 +55,12 @@ export default function Activate() {
<h2 className="font-display text-xl text-success"> <h2 className="font-display text-xl text-success">
Account Activated! Account Activated!
</h2> </h2>
<p className="opacity-70 mb-8 leading-relaxed"> <p className="opacity-70 leading-relaxed">
Welcome to <Logo /> Welcome to <Logo scale={1} />
<br /> <br />
Your identity is now verified and ready for timeless letters. Your identity is now verified and ready for timeless letters.
</p> </p>
<div className="divider opacity-10"></div> <div className="divider opacity-10 my-0"></div>
<button <button
type="button" type="button"
className="btn btn-primary w-full shadow-lg" className="btn btn-primary w-full shadow-lg"
@@ -85,16 +82,17 @@ export default function Activate() {
<XCircleIcon size={64} weight="duotone" className="text-error" /> <XCircleIcon size={64} weight="duotone" className="text-error" />
</div> </div>
<h2 className="font-display text-xl text-error">Activation Failed</h2> <h2 className="font-display text-xl text-error">Activation Failed</h2>
<p className="opacity-70 mb-8 leading-relaxed"> <p className="opacity-70 leading-relaxed">
The link might be expired or already used. Please try registering The link might be expired or already used. Please try registering
again. again.
</p> </p>
<div className="divider opacity-10 my-0"></div>
<button <button
type="button" type="button"
className="btn btn-ghost w-full" className="btn btn-ghost w-full"
onClick={() => navigate(ROUTES.ONBOARD)} onClick={() => navigate(ROUTES.ONBOARD)}
> >
Back to Registration Register Again
</button> </button>
</div> </div>
)} )}
+7
View File
@@ -5,6 +5,7 @@ import { DrawerSection } from "../components/drawer/DrawerSection.tsx";
import { LetterItem } from "../components/drawer/LetterItem.tsx"; import { LetterItem } from "../components/drawer/LetterItem.tsx";
import { PasskeyModal } from "../components/drawer/PasskeyModal.tsx"; import { PasskeyModal } from "../components/drawer/PasskeyModal.tsx";
import Logo from "../components/Logo"; import Logo from "../components/Logo";
import Saajan from "../components/ui/Saajan.tsx";
import { PATHS } from "../config/routes"; import { PATHS } from "../config/routes";
import { useAuth } from "../hooks/useAuth"; import { useAuth } from "../hooks/useAuth";
import { useLetters } from "../hooks/useLetters"; import { useLetters } from "../hooks/useLetters";
@@ -165,6 +166,12 @@ export default function Drawer() {
<footer className="mt-25 font-sans text-[0.6rem] tracking-[0.2em] uppercase text-base-content/10 z-10"> <footer className="mt-25 font-sans text-[0.6rem] tracking-[0.2em] uppercase text-base-content/10 z-10">
For your unsaid. For your unsaid.
</footer> </footer>
<div className="absolute bottom-0 z-50 font-sans">
<Saajan
message={`Good to see you again, ${user.full_name}.\nWhat's on your mind today?`}
position="top"
/>
</div>
</div> </div>
); );
} }
+6 -2
View File
@@ -293,7 +293,7 @@ export default function Editor() {
setLetterStatus(status); setLetterStatus(status);
setLastSavedPulseTick((prev) => prev + 1); setLastSavedPulseTick((prev) => prev + 1);
if (status === "SEALED") { if (status === "SEALED" || status === "VAULT") {
setSealedTargetId(targetId); setSealedTargetId(targetId);
} }
setSaveOverlay("saved"); setSaveOverlay("saved");
@@ -419,7 +419,11 @@ export default function Editor() {
/> />
)} )}
{sealedTargetId && ( {sealedTargetId && (
<PostSealModal sealedTargetId={sealedTargetId} navigate={navigate} /> <PostSealModal
sealedTargetId={sealedTargetId}
navigate={navigate}
type={status === "VAULT" ? "VAULT" : "KEPT"}
/>
)} )}
<div className="max-w-180 mx-auto px-1 md:px-0"> <div className="max-w-180 mx-auto px-1 md:px-0">
+46 -32
View File
@@ -1,41 +1,55 @@
import { EnvelopeSimpleOpenIcon } from "@phosphor-icons/react"; import { EnvelopeSimpleOpenIcon } from "@phosphor-icons/react";
import Logo from "../components/Logo"; import Logo from "../components/Logo";
import Saajan from "../components/ui/Saajan";
export default function VerifyEmail() { export default function VerifyEmail() {
return ( return (
<div className="glass-card w-full max-w-sm p-8 text-center flex flex-col items-center gap-6 fade-zoom"> <div className="relative">
<div className="auth-icon-container"> <Saajan
<EnvelopeSimpleOpenIcon message={"I sent something to your inbox.\nOpen it, and we can begin."}
size={32} />
weight="duotone"
className="text-primary" <div className="glass-card w-full max-w-sm p-8 text-center flex flex-col items-center gap-6 fade-zoom">
/> <div className="auth-icon-container">
<EnvelopeSimpleOpenIcon
size={32}
weight="duotone"
className="text-primary"
/>
</div>
<div className="space-y-2">
<h2 className="font-display text-xl text-primary">
Check Your Mailbox
</h2>
<p className="text-sm opacity-80 leading-relaxed font-sans mt-6">
You're one train away from starting your <Logo scale={0.8} />{" "}
journey.
</p>
</div>
<div className="divider opacity-10 my-0"></div>
<div className="alert bg-base-200/50 p-4 rounded-lg text-xs leading-relaxed opacity-70 text-center">
<p>
Nothing yet? Sometimes letters take the wrong train. Check your spam
folder.
<br />
<span className="underline font-bold">
The link expires in 24 hours.
</span>
<br /> I'm patient... but not endlessly so
</p>
</div>
<button
type="button"
className="text-xs italic opacity-40 cursor-pointer underline"
onClick={() => window.close()}
>
You can close this window now.
</button>
</div> </div>
<div className="space-y-2">
<h2 className="font-display text-xl text-primary">Check Your Email</h2>
<p className="text-sm opacity-80 leading-relaxed font-sans">
We've sent an activation link to your inbox. <br />
Please click it to verify your <Logo /> account.
</p>
</div>
<div className="divider opacity-10"></div>
<div className="alert bg-base-200/50 p-4 rounded-lg text-xs leading-relaxed text-left opacity-70">
<p>
Didn't receive it? Check your spam folder or wait for a few minutes.
The link will expire in 24 hours.
</p>
</div>
<button
type="button"
className="text-xs italic opacity-40 cursor-pointer underline"
onClick={() => window.close()}
>
You can close this window now.
</button>
</div> </div>
); );
} }