2024-10-13 22:49:14 -04:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { Avatar, AvatarFallback } from "@app/components/ui/avatar";
|
|
|
|
import { Button } from "@app/components/ui/button";
|
|
|
|
import {
|
|
|
|
DropdownMenu,
|
|
|
|
DropdownMenuContent,
|
|
|
|
DropdownMenuGroup,
|
|
|
|
DropdownMenuItem,
|
|
|
|
DropdownMenuLabel,
|
|
|
|
DropdownMenuSeparator,
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
} from "@app/components/ui/dropdown-menu";
|
2024-10-14 12:10:02 -04:00
|
|
|
import {
|
|
|
|
Select,
|
|
|
|
SelectContent,
|
|
|
|
SelectGroup,
|
|
|
|
SelectItem,
|
|
|
|
SelectTrigger,
|
|
|
|
SelectValue,
|
|
|
|
} from "@app/components/ui/select";
|
2024-10-13 22:49:14 -04:00
|
|
|
import Link from "next/link";
|
|
|
|
|
|
|
|
type HeaderProps = {
|
|
|
|
name?: string;
|
|
|
|
email: string;
|
|
|
|
orgName: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function Header({ email, orgName, name }: HeaderProps) {
|
|
|
|
function getInitials() {
|
|
|
|
if (name) {
|
|
|
|
const [firstName, lastName] = name.split(" ");
|
|
|
|
return `${firstName[0]}${lastName[0]}`;
|
|
|
|
}
|
|
|
|
return email.substring(0, 2).toUpperCase();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className="flex items-center justify-between">
|
2024-10-14 00:02:55 -04:00
|
|
|
<div className="flex items-center gap-4">
|
2024-10-13 23:05:22 -04:00
|
|
|
<DropdownMenu>
|
|
|
|
<DropdownMenuTrigger asChild>
|
|
|
|
<Button
|
2024-10-14 12:10:02 -04:00
|
|
|
variant="outline"
|
2024-10-13 23:05:22 -04:00
|
|
|
className="relative h-10 w-10 rounded-full"
|
|
|
|
>
|
2024-10-14 12:10:02 -04:00
|
|
|
<Avatar className="h-9 w-9">
|
2024-10-13 23:05:22 -04:00
|
|
|
<AvatarFallback>
|
|
|
|
{getInitials()}
|
|
|
|
</AvatarFallback>
|
|
|
|
</Avatar>
|
|
|
|
</Button>
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent
|
|
|
|
className="w-56"
|
2024-10-14 12:10:02 -04:00
|
|
|
align="start"
|
2024-10-13 23:05:22 -04:00
|
|
|
forceMount
|
|
|
|
>
|
|
|
|
<DropdownMenuLabel className="font-normal">
|
|
|
|
<div className="flex flex-col space-y-1">
|
|
|
|
{name && (
|
|
|
|
<p className="text-sm font-medium leading-none truncate">
|
|
|
|
{name}
|
|
|
|
</p>
|
|
|
|
)}
|
|
|
|
<p className="text-xs leading-none text-muted-foreground truncate">
|
|
|
|
{email}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</DropdownMenuLabel>
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
<DropdownMenuGroup>
|
2024-10-14 12:10:02 -04:00
|
|
|
<DropdownMenuItem>Profile</DropdownMenuItem>
|
2024-10-13 23:05:22 -04:00
|
|
|
<DropdownMenuItem>Log out</DropdownMenuItem>
|
|
|
|
</DropdownMenuGroup>
|
|
|
|
</DropdownMenuContent>
|
|
|
|
</DropdownMenu>
|
2024-10-19 15:49:16 -04:00
|
|
|
<span className="truncate max-w-[150px] md:max-w-none font-medium">
|
2024-10-14 12:10:02 -04:00
|
|
|
{name || email}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
<div className="hidden md:block">
|
|
|
|
<div className="flex items-center gap-4 mr-4">
|
|
|
|
<Link
|
|
|
|
href="/docs"
|
2024-10-15 23:52:58 -04:00
|
|
|
className="text-muted-foreground hover:text-foreground"
|
2024-10-14 12:10:02 -04:00
|
|
|
>
|
|
|
|
Documentation
|
|
|
|
</Link>
|
|
|
|
<Link
|
|
|
|
href="/support"
|
2024-10-15 23:52:58 -04:00
|
|
|
className="text-muted-foreground hover:text-foreground"
|
2024-10-14 12:10:02 -04:00
|
|
|
>
|
|
|
|
Support
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<Select defaultValue={orgName}>
|
|
|
|
<SelectTrigger className="w-[100px] md:w-[180px]">
|
|
|
|
<SelectValue placeholder="Select an org" />
|
|
|
|
</SelectTrigger>
|
|
|
|
<SelectContent>
|
|
|
|
<SelectGroup>
|
|
|
|
<SelectItem value={orgName}>
|
|
|
|
{orgName}
|
|
|
|
</SelectItem>
|
|
|
|
</SelectGroup>
|
|
|
|
</SelectContent>
|
|
|
|
</Select>
|
2024-10-13 23:05:22 -04:00
|
|
|
</div>
|
2024-10-13 22:49:14 -04:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|