From 0fb31b9f0b9421319e31f6bfcb2695c58eea006e Mon Sep 17 00:00:00 2001 From: ramvignesh-b Date: Tue, 14 Apr 2026 23:53:16 +0530 Subject: [PATCH] feat: add welcome modal to login page --- frontend/src/pages/Activate.tsx | 8 +- frontend/src/pages/Login.tsx | 165 +++++++++++++++++++++----------- 2 files changed, 117 insertions(+), 56 deletions(-) diff --git a/frontend/src/pages/Activate.tsx b/frontend/src/pages/Activate.tsx index cad05d5..507a128 100644 --- a/frontend/src/pages/Activate.tsx +++ b/frontend/src/pages/Activate.tsx @@ -62,12 +62,16 @@ export default function Activate() {
Your identity is now verified and ready for timeless letters.

+
+ )} diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 075fa3a..0c6d6a9 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -1,8 +1,9 @@ import { zodResolver } from "@hookform/resolvers/zod"; +import { ShieldCheckIcon, WarningIcon } from "@phosphor-icons/react"; import axios from "axios"; import { useState } from "react"; import { useForm } from "react-hook-form"; -import { useNavigate } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router-dom"; import { z } from "zod"; import { api, publicApi } from "../api/apiClient"; import Logo from "../components/Logo"; @@ -13,7 +14,7 @@ import { useAuth } from "../hooks/useAuth"; import { CryptoUtils } from "../utils/crypto"; const loginSchema = z.object({ - email: z.string().email("Please enter a valid email"), + email: z.email("Please enter a valid email"), password: z.string().min(1, "Password is required"), }); @@ -21,9 +22,11 @@ type LoginInputs = z.infer; export default function Login() { const navigate = useNavigate(); + const location = useLocation(); const [isLoading, setIsLoading] = useState(false); const [apiError, setApiError] = useState(null); const { setAuthStore } = useAuth(); + const [showWelcome, setShowWelcome] = useState(!!location.state?.firstTime); const { register, @@ -70,62 +73,116 @@ export default function Login() { }; return ( -
-
-

- Sign in to -

+
+ {showWelcome && ( +
+
+
+
+ +
+

+ Welcome to ! +

+

+ To ensure complete privacy, + all your letters are{" "} + + sealed with your password + + , which only you have access to. +
+ + The server never sees it, and it's a solemn promise! + +

- {apiError && ( -
- {apiError} +
+ +

+ If you ever happen to forget your password, your letters are + lost to time, forever. +

+
+ +
+ +
+
- )} - - - - - -
-
+ )} +
+ +

+ Sign in to +

-
- Don't have an account?{" "} - -
- + {apiError && ( +
+ {apiError} +
+ )} + + + + + +
+ +
+ +
+ Don't have an account?{" "} + +
+ +
); }