2026-09-03 14:07:39 -07:00
|
|
|
import {useSlotRecipe, Text, Flex} from "@chakra-ui/react"
|
2025-07-21 11:33:44 -07:00
|
|
|
import UserAvatarMenu from "./UserAvatarMenu.jsx";
|
2026-07-08 15:05:50 -07:00
|
|
|
import useAuthStore from "@/store/authStore";
|
2026-07-22 14:58:59 -07:00
|
|
|
import {SearchBar} from "@/components/dashboard/SearchBar.jsx";
|
2025-07-21 11:33:44 -07:00
|
|
|
|
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-09-03 14:07:39 -07:00
|
|
|
const recipe = useSlotRecipe({key: "header"});
|
|
|
|
|
const styles = recipe();
|
2025-07-16 15:02:57 -07:00
|
|
|
|
2026-09-03 14:07:39 -07:00
|
|
|
const {user} = useAuthStore();
|
|
|
|
|
console.log(user);
|
|
|
|
|
const displayName = user ? (user.firstName || user.username) : "Loading...";
|
|
|
|
|
const avatarname = user ? (user.fullName || user.username) : "Loading...";
|
2026-07-08 15:05:50 -07:00
|
|
|
|
2026-09-03 14:07:39 -07:00
|
|
|
const displayEmail = user?.email || "LDAP User";
|
2026-07-08 15:05:50 -07:00
|
|
|
|
2026-09-03 14:07:39 -07:00
|
|
|
return (
|
|
|
|
|
<Flex css={styles.root}>
|
|
|
|
|
<Flex css={styles.search_bar}>
|
|
|
|
|
<SearchBar placeholder="Enter a volcano to search"/>
|
|
|
|
|
</Flex>
|
|
|
|
|
|
|
|
|
|
{/* User Profile Section */}
|
|
|
|
|
<Flex css={styles.user_info}>
|
|
|
|
|
<Text>{displayName}</Text>
|
|
|
|
|
<UserAvatarMenu
|
|
|
|
|
name={avatarname}
|
|
|
|
|
// avatar={user.avatar}
|
|
|
|
|
/>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
2026-06-05 13:06:12 -07:00
|
|
|
}
|