mirror of
https://github.com/Since-3/since3-portal.git
synced 2026-10-12 20:51:17 +00:00
see comments
This commit is contained in:
parent
f99515a374
commit
c5005be2cb
6 changed files with 66 additions and 21 deletions
|
|
@ -6,6 +6,7 @@ import {
|
|||
SidebarGroupContent,
|
||||
SidebarHeader,
|
||||
SidebarMenu,
|
||||
SidebarRail,
|
||||
} from "@/components/ui/sidebar";
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||
import { Session } from "../../types/user";
|
||||
|
|
@ -16,7 +17,7 @@ import UserBadge from "./user-badge";
|
|||
|
||||
export function AppSidebar({ session }: { session: Session }) {
|
||||
const menu = session.isAdmin ? adminMenu : clientMenu;
|
||||
const avatarUrl = `https://api.dicebear.com/10.x/waves/svg?seed=${encodeURIComponent(session.email)}`;
|
||||
const avatarUrl = `https://api.dicebear.com/10.x/waves/svg?seed=${encodeURIComponent(session.userId)}`;
|
||||
|
||||
return (
|
||||
<Sidebar>
|
||||
|
|
@ -52,6 +53,7 @@ export function AppSidebar({ session }: { session: Session }) {
|
|||
<p className="truncate text-xs text-muted-foreground">{session.email}</p>
|
||||
<LogoutButton />
|
||||
</SidebarFooter>
|
||||
<SidebarRail />
|
||||
</Sidebar>
|
||||
)
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { SidebarMenuButton, SidebarMenuItem } from "@/components/ui/sidebar";
|
||||
import { SidebarMenuButton, SidebarMenuItem, useSidebar } from "@/components/ui/sidebar";
|
||||
|
||||
export function SidebarMenuLink({
|
||||
title,
|
||||
|
|
@ -14,12 +14,13 @@ export function SidebarMenuLink({
|
|||
icon: React.ReactNode;
|
||||
}) {
|
||||
const pathname = usePathname();
|
||||
const { setOpenMobile } = useSidebar();
|
||||
const isActive = pathname === url;
|
||||
|
||||
return (
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton
|
||||
render={<Link href={url} />}
|
||||
render={<Link href={url} onClick={() => setOpenMobile(false)} />}
|
||||
isActive={isActive}
|
||||
className="h-10 text-[0.95rem]"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue