diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index fb3fbdb..707017f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,8 +1,10 @@ import { useEffect } from "react"; import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom"; import Logo from "./components/Logo"; +import { ROUTES } from "./config/routes"; import Activate from "./pages/Activate"; import Drawer from "./pages/Drawer"; +import Editor from "./pages/Editor"; import Home from "./pages/Home"; import Login from "./pages/Login"; import Register from "./pages/Register"; @@ -30,17 +32,18 @@ export default function App() { return ( -
+
- } /> - } /> - } /> - } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> -
+
); } diff --git a/frontend/src/components/Logo.tsx b/frontend/src/components/Logo.tsx index 0e9d79d..d12fda9 100644 --- a/frontend/src/components/Logo.tsx +++ b/frontend/src/components/Logo.tsx @@ -4,6 +4,8 @@ import "@fontsource/knewave/400.css"; export default function Logo() { return ( diff --git a/frontend/src/components/ui/DateDisplay.tsx b/frontend/src/components/ui/DateDisplay.tsx new file mode 100644 index 0000000..c3343db --- /dev/null +++ b/frontend/src/components/ui/DateDisplay.tsx @@ -0,0 +1,28 @@ +interface DateDisplayProps { + date?: Date; + className?: string; +} + +export default function DateDisplay({ + date = new Date(), + className = "", +}: DateDisplayProps) { + const formattedDate = date.toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + }); + + return ( +
+ + Date + + + {formattedDate} + +
+ ); +} diff --git a/frontend/src/components/ui/FormField.tsx b/frontend/src/components/ui/FormField.tsx index 6d86a91..e6d42a6 100644 --- a/frontend/src/components/ui/FormField.tsx +++ b/frontend/src/components/ui/FormField.tsx @@ -19,19 +19,20 @@ export default function FormField({
- {error &&

{error}

} + {error &&

{error}

}
); } diff --git a/frontend/src/config/routes.ts b/frontend/src/config/routes.ts new file mode 100644 index 0000000..612fc5d --- /dev/null +++ b/frontend/src/config/routes.ts @@ -0,0 +1,10 @@ +export const ROUTES = { + HOME: "/", + ONBOARD: "/onboard", + VERIFY_EMAIL: "/verify-email", + ACTIVATE: "/activate/:uidb64/:token", + LOGIN: "/login", + DRAWER: "/drawer", + WRITE: "/quill", + READ: "/read", +}; diff --git a/frontend/src/pages/Activate.tsx b/frontend/src/pages/Activate.tsx index 2bef3e2..d96640b 100644 --- a/frontend/src/pages/Activate.tsx +++ b/frontend/src/pages/Activate.tsx @@ -70,15 +70,9 @@ export default function Activate() { {status === "error" && (
- +
-

- Activation Failed -

+

Activation Failed

The link might be expired or already used. Please try registering again. diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 7efe40e..37cc7eb 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -6,6 +6,7 @@ import { useNavigate } from "react-router-dom"; import { z } from "zod"; import Logo from "../components/Logo"; import FormField from "../components/ui/FormField"; +import { ROUTES } from "../config/routes"; import { useAuth } from "../store/useAuth"; const loginSchema = z.object({ @@ -34,7 +35,7 @@ export default function Login() { setApiError(null); try { await login(data); - navigate("/drawer"); + navigate(ROUTES.DRAWER); } catch (err) { console.error("Login error:", err); let message = "Invalid email or password"; @@ -48,62 +49,59 @@ export default function Login() { } }; - return ( -

-
-
-

- Sign in to -

+
+ +

+ Sign in to +

- {apiError && ( -
- {apiError} -
+ {apiError && ( +
+ {apiError} +
+ )} + + + + + +
+ -
- -
- Don't have an account?{" "} - -
- +
-
- ); + +
+ Don't have an account?{" "} + +
+ +
; } diff --git a/frontend/src/pages/Register.tsx b/frontend/src/pages/Register.tsx index 871647a..c2a55cb 100644 --- a/frontend/src/pages/Register.tsx +++ b/frontend/src/pages/Register.tsx @@ -62,9 +62,9 @@ export default function Register() { return (
-

+

Create a Account -

+ {apiError && (
@@ -104,15 +104,11 @@ export default function Register() { /> {/* Warning */} -
- -

+

+ +

Choose a password you won't forget.
- There is no reset.{" "} + There is no reset.{" "} If you lose it, your letters cannot be recovered.

@@ -121,6 +117,7 @@ export default function Register() {