prmbr-image-mksaas/src/components/dashboard/dashboard-sidebar.tsx
javayhu a6e2ee698a refactor: update site metadata and translations
- Renamed "Site" to "Metadata" in translation files for clarity.
- Updated the title, tagline, and description in both English and Chinese translations to reflect the new branding.
- Adjusted references in various components to use the updated metadata structure.
- Removed the obsolete site.webmanifest file and updated the manifest path in the metadata construction.
2025-03-23 15:37:38 +08:00

62 lines
1.7 KiB
TypeScript

'use client';
import { NavMain } from '@/components/dashboard/nav-main';
import { NavUser } from '@/components/dashboard/nav-user';
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem
} from '@/components/ui/sidebar';
import { getNavMainLinks } from '@/config';
import { LocaleLink } from '@/i18n/navigation';
import { useTranslations } from 'next-intl';
import * as React from 'react';
import { Logo } from '../logo';
import { SidebarUpgradeCard } from './sidebar-upgrade-card';
import { authClient } from '@/lib/auth-client';
export function DashboardSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
const t = useTranslations();
const mainLinks = getNavMainLinks();
const { data: session, error } = authClient.useSession();
const user = session?.user;
return (
<Sidebar collapsible="icon" {...props}>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
asChild
className="data-[slot=sidebar-menu-button]:!p-1.5"
>
<LocaleLink href="/">
<Logo className="size-5 rounded-full" />
<span className="truncate font-semibold text-base">
{t('Metadata.name')}
</span>
</LocaleLink>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<NavMain items={mainLinks} />
</SidebarContent>
<SidebarFooter className="flex flex-col gap-4">
{/* TODO: show or hide based on user status */}
<SidebarUpgradeCard />
{user && <NavUser user={user} />}
</SidebarFooter>
</Sidebar>
);
}