mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-07 01:56:53 +00:00
feat(ui): refine default frontend layouts
This commit is contained in:
+17
-9
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
LayoutDashboard,
|
||||
Activity,
|
||||
Key,
|
||||
FileText,
|
||||
Wallet,
|
||||
@@ -12,19 +13,14 @@ import {
|
||||
FlaskConical,
|
||||
MessageSquare,
|
||||
CreditCard,
|
||||
ListTodo,
|
||||
} from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
import { WORKSPACE_IDS } from '@/components/layout/lib/workspace-registry'
|
||||
import { type SidebarData } from '@/components/layout/types'
|
||||
import { getDashboardSectionNavItems } from '@/features/dashboard/section-registry'
|
||||
import { getModelsSectionNavItems } from '@/features/models/section-registry'
|
||||
import { getUsageLogsSectionNavItems } from '@/features/usage-logs/section-registry'
|
||||
|
||||
export function useSidebarData(): SidebarData {
|
||||
const { t } = useTranslation()
|
||||
const user = useAuthStore((s) => s.auth.user)
|
||||
const isAdmin = Boolean(user?.role && user.role >= 10)
|
||||
|
||||
return {
|
||||
workspaces: [
|
||||
@@ -56,10 +52,15 @@ export function useSidebarData(): SidebarData {
|
||||
id: 'general',
|
||||
title: t('General'),
|
||||
items: [
|
||||
{
|
||||
title: t('Overview'),
|
||||
url: '/dashboard/overview',
|
||||
icon: Activity,
|
||||
},
|
||||
{
|
||||
title: t('Dashboard'),
|
||||
url: '/dashboard/models',
|
||||
icon: LayoutDashboard,
|
||||
items: getDashboardSectionNavItems(t, { isAdmin }),
|
||||
},
|
||||
{
|
||||
title: t('API Keys'),
|
||||
@@ -68,8 +69,15 @@ export function useSidebarData(): SidebarData {
|
||||
},
|
||||
{
|
||||
title: t('Usage Logs'),
|
||||
url: '/usage-logs/common',
|
||||
icon: FileText,
|
||||
items: getUsageLogsSectionNavItems(t),
|
||||
},
|
||||
{
|
||||
title: t('Task Logs'),
|
||||
url: '/usage-logs/task',
|
||||
activeUrls: ['/usage-logs/drawing'],
|
||||
configUrls: ['/usage-logs/drawing', '/usage-logs/task'],
|
||||
icon: ListTodo,
|
||||
},
|
||||
{
|
||||
title: t('Wallet'),
|
||||
@@ -94,8 +102,8 @@ export function useSidebarData(): SidebarData {
|
||||
},
|
||||
{
|
||||
title: t('Models'),
|
||||
url: '/models/metadata',
|
||||
icon: Box,
|
||||
items: getModelsSectionNavItems(t),
|
||||
},
|
||||
{
|
||||
title: t('Users'),
|
||||
|
||||
Reference in New Issue
Block a user