Added LDAP config and auth
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
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 the asset properly so Vite can bundle it for any server
|
||||
// import defaultAvatar from "@/assets/user_profile.svg";
|
||||
|
||||
// TODO: Pull this dynamically from an Auth Context later!
|
||||
const placeholderUser = {
|
||||
name: "Princess Zelda",
|
||||
email: "zelda.royal@hyrule.gov",
|
||||
// avatar: defaultAvatar
|
||||
}
|
||||
|
||||
// Accept a 'user' prop now, fallback to placeholder if empty
|
||||
export default function Header({ user = placeholderUser }) {
|
||||
export default function Header() {
|
||||
const recipe = useRecipe({ key: "header" });
|
||||
const styles = recipe();
|
||||
|
||||
const { user } = useAuthStore();
|
||||
console.log(user);
|
||||
const displayName = user ? (user.fullName || user.username) : "Loading...";
|
||||
|
||||
const displayEmail = user?.email || "LDAP User";
|
||||
|
||||
return (
|
||||
<Flex css={styles} justify="space-between" align="center" width="100%">
|
||||
{/* Home Link Logo */}
|
||||
@@ -27,12 +27,12 @@ export default function Header({ user = placeholderUser }) {
|
||||
{/* User Profile Section */}
|
||||
<Flex align="center" gap={3} pr={6}>
|
||||
<Stack gap="0" textAlign="right" cursor="default">
|
||||
<Text color="color" fontWeight="bold" textStyle="lg">{user.name}</Text>
|
||||
<Text color="fg.muted" textStyle="sm">{user.email}</Text>
|
||||
<Text color="color" fontWeight="bold" textStyle="lg">{displayName}</Text>
|
||||
<Text color="fg.muted" textStyle="sm">{displayEmail}</Text>
|
||||
</Stack>
|
||||
<UserAvatarMenu
|
||||
name={user.name}
|
||||
avatar={user.avatar}
|
||||
name={displayName}
|
||||
// avatar={user.avatar}
|
||||
/>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
Reference in New Issue
Block a user