From 6da3df27d8bb5ffdb00ac54acf600a292e7bed44 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Mon, 2 Feb 2026 01:56:12 +0530 Subject: [PATCH] Fix frontend types and normalize API responses --- frontend/src/app/_components/Shell.tsx | 14 ++- frontend/src/app/departments/page.tsx | 16 ++-- frontend/src/app/hr/page.tsx | 36 ++++---- frontend/src/app/page.tsx | 27 +++--- frontend/src/app/people/page.tsx | 21 +++-- frontend/src/app/projects/[id]/page.tsx | 35 +++++--- frontend/src/app/projects/page.tsx | 8 +- frontend/src/lib/normalize.ts | 110 ++++++++++++++++++++++++ 8 files changed, 195 insertions(+), 72 deletions(-) create mode 100644 frontend/src/lib/normalize.ts diff --git a/frontend/src/app/_components/Shell.tsx b/frontend/src/app/_components/Shell.tsx index 68d875e..f0ad53f 100644 --- a/frontend/src/app/_components/Shell.tsx +++ b/frontend/src/app/_components/Shell.tsx @@ -2,7 +2,7 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import styles from "./Shell.module.css"; const NAV = [ @@ -15,16 +15,14 @@ const NAV = [ export function Shell({ children }: { children: React.ReactNode }) { const path = usePathname(); - const [actorId, setActorId] = useState(""); - - useEffect(() => { + const [actorId, setActorId] = useState(() => { + if (typeof window === "undefined") return ""; try { - const stored = window.localStorage.getItem("actor_employee_id"); - if (stored) setActorId(stored); + return window.localStorage.getItem("actor_employee_id") ?? ""; } catch { - // ignore + return ""; } - }, []); + }); return (