mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-12 02:06:37 +08:00
fix sidebar
This commit is contained in:
@@ -44,6 +44,7 @@ import {
|
|||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
} from "@/components/ui/alert-dialog"
|
} from "@/components/ui/alert-dialog"
|
||||||
import {
|
import {
|
||||||
|
ArrowUpRight,
|
||||||
Bell,
|
Bell,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
Code,
|
Code,
|
||||||
@@ -163,9 +164,13 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|||||||
|
|
||||||
const adminFiltered = React.useMemo(() => {
|
const adminFiltered = React.useMemo(() => {
|
||||||
const displayConfig = parseMenuDisplayConfig(config?.menu_display_config)
|
const displayConfig = parseMenuDisplayConfig(config?.menu_display_config)
|
||||||
return data.admin.filter((item) => displayConfig[item.url])
|
return data.admin.filter((item) => displayConfig[item.url] !== false)
|
||||||
}, [config])
|
}, [config])
|
||||||
|
|
||||||
|
const documentFiltered = React.useMemo(() => {
|
||||||
|
const displayConfig = parseMenuDisplayConfig(config?.menu_display_config)
|
||||||
|
return data.document.filter((item) => displayConfig[item.url] !== false)
|
||||||
|
}, [config])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -324,6 +329,40 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|||||||
</SidebarGroup>
|
</SidebarGroup>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{documentFiltered.length > 0 && (
|
||||||
|
<SidebarGroup className="py-0 pt-4">
|
||||||
|
<SidebarGroupLabel className="text-xs font-normal text-muted-foreground">
|
||||||
|
文档库
|
||||||
|
</SidebarGroupLabel>
|
||||||
|
<SidebarGroupContent className="py-1">
|
||||||
|
<SidebarMenu className="gap-1">
|
||||||
|
{documentFiltered.map((item) => (
|
||||||
|
<SidebarMenuItem key={item.title}>
|
||||||
|
<SidebarMenuButton
|
||||||
|
tooltip={item.title}
|
||||||
|
isActive={pathname === item.url}
|
||||||
|
asChild
|
||||||
|
>
|
||||||
|
{item.external ? (
|
||||||
|
<Link href={item.url} target="_blank" rel="noopener noreferrer" onClick={handleCloseSidebar}>
|
||||||
|
{item.icon && <item.icon />}
|
||||||
|
<span className="flex-1">{item.title}</span>
|
||||||
|
<ArrowUpRight className="size-3 text-muted-foreground" />
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<Link href={item.url} onClick={handleCloseSidebar}>
|
||||||
|
{item.icon && <item.icon />}
|
||||||
|
<span className="flex-1">{item.title}</span>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
</SidebarMenuButton>
|
||||||
|
</SidebarMenuItem>
|
||||||
|
))}
|
||||||
|
</SidebarMenu>
|
||||||
|
</SidebarGroupContent>
|
||||||
|
</SidebarGroup>
|
||||||
|
)}
|
||||||
|
|
||||||
</SidebarContent>
|
</SidebarContent>
|
||||||
<SidebarFooter className="mt-auto px-3 py-3 group-data-[collapsible=icon]:hidden">
|
<SidebarFooter className="mt-auto px-3 py-3 group-data-[collapsible=icon]:hidden">
|
||||||
<div className="border-t border-border/60 pt-3 text-[11px] leading-5 text-muted-foreground">
|
<div className="border-t border-border/60 pt-3 text-[11px] leading-5 text-muted-foreground">
|
||||||
|
|||||||
Reference in New Issue
Block a user