Files
Web-Frontend/client/src/components/layout/Header.jsx
T

40 lines
1.5 KiB
React
Raw Normal View History

2026-06-04 15:30:01 -07:00
import { useRecipe, Button, Stack, Text, Flex } from "@chakra-ui/react"
import UserAvatarMenu from "./UserAvatarMenu.jsx";
2026-06-04 15:30:01 -07:00
import { NavLink } from "react-router-dom";
2026-07-08 15:05:50 -07:00
import useAuthStore from "@/store/authStore";
2026-06-05 13:06:12 -07:00
// Import the asset properly so Vite can bundle it for any server
// import defaultAvatar from "@/assets/user_profile.svg";
// Accept a 'user' prop now, fallback to placeholder if empty
2026-07-08 15:05:50 -07:00
export default function Header() {
2026-06-05 13:06:12 -07:00
const recipe = useRecipe({ key: "header" });
const styles = recipe();
2026-07-08 15:05:50 -07:00
const { user } = useAuthStore();
console.log(user);
const displayName = user ? (user.fullName || user.username) : "Loading...";
const displayEmail = user?.email || "LDAP User";
2026-06-05 13:06:12 -07:00
return (
<Flex css={styles} justify="space-between" align="center" width="100%">
{/*/!* Home Link Logo *!/*/}
{/*<Button as={NavLink} to="/home" color="color" variant="plain" textStyle="5xl" fontWeight="bold">*/}
{/* VDAP*/}
{/*</Button>*/}
2026-06-05 13:06:12 -07:00
{/* User Profile Section */}
<Flex align="center" gap={3} pr={6}>
<Stack gap="0" textAlign="right" cursor="default">
2026-07-08 15:05:50 -07:00
<Text color="color" fontWeight="bold" textStyle="lg">{displayName}</Text>
<Text color="fg.muted" textStyle="sm">{displayEmail}</Text>
2026-06-05 13:06:12 -07:00
</Stack>
<UserAvatarMenu
2026-07-08 15:05:50 -07:00
name={displayName}
// avatar={user.avatar}
2026-06-05 13:06:12 -07:00
/>
</Flex>
</Flex>
);
}