35 lines
1.3 KiB
React
35 lines
1.3 KiB
React
import { useRecipe, Button, Stack, Text, Flex } from "@chakra-ui/react"
|
|
import UserAvatarMenu from "./UserAvatarMenu.jsx";
|
|
import { NavLink } from "react-router-dom";
|
|
import useAuthStore from "@/store/authStore";
|
|
import {SearchBar} from "@/components/dashboard/SearchBar.jsx";
|
|
|
|
// 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
|
|
export default function Header() {
|
|
const recipe = useRecipe({ key: "header" });
|
|
const styles = recipe();
|
|
|
|
const { user } = useAuthStore();
|
|
console.log(user);
|
|
const displayName = user ? (user.firstName || user.username) : "Loading...";
|
|
const avatarname = user ? (user.fullName || user.username) : "Loading...";
|
|
|
|
const displayEmail = user?.email || "LDAP User";
|
|
|
|
return (
|
|
<Flex css={styles} >
|
|
<SearchBar placeholder="Enter a volcano to search" size="sm" width="410px" />
|
|
{/* User Profile Section */}
|
|
<Flex align="center" gap={3} pr={6}>
|
|
<Text fontWeight="bold" textStyle="md" >{displayName}</Text>
|
|
<UserAvatarMenu
|
|
name={avatarname}
|
|
// avatar={user.avatar}
|
|
/>
|
|
</Flex>
|
|
</Flex>
|
|
);
|
|
} |