2025-11-19 02:14:37 +08:00
|
|
|
//
|
2026-03-10 01:32:57 +08:00
|
|
|
// Copyright (c) 2025-2026 rustmailer.com (https://rustmailer.com)
|
2025-11-19 02:14:37 +08:00
|
|
|
//
|
|
|
|
|
// This file is part of the Bichon Email Archiving Project
|
|
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
IconHelp,
|
|
|
|
|
IconLayoutDashboard,
|
|
|
|
|
IconSettings
|
|
|
|
|
} from '@tabler/icons-react'
|
2026-03-15 03:36:02 +08:00
|
|
|
import { IdCard, Inbox, Search, Users2 } from 'lucide-react'
|
2025-11-19 02:14:37 +08:00
|
|
|
import { type SidebarData } from '../types'
|
2025-11-24 21:51:16 +08:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2025-12-26 14:17:34 +08:00
|
|
|
import { useCurrentUser } from '@/hooks/use-current-user'
|
2025-11-19 02:14:37 +08:00
|
|
|
|
2025-11-24 21:51:16 +08:00
|
|
|
export function useSidebarData(): SidebarData {
|
|
|
|
|
const { t } = useTranslation()
|
2025-12-26 14:17:34 +08:00
|
|
|
|
|
|
|
|
const { require_any_permission } = useCurrentUser()
|
|
|
|
|
|
2025-11-24 21:51:16 +08:00
|
|
|
return {
|
|
|
|
|
navGroups: [
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.general'),
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.dashboard'),
|
|
|
|
|
url: '/',
|
|
|
|
|
icon: IconLayoutDashboard,
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.accounts'),
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.accounts'),
|
|
|
|
|
url: '/accounts',
|
|
|
|
|
icon: Inbox,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('common.search'),
|
|
|
|
|
url: '/search',
|
|
|
|
|
icon: Search,
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.auth'),
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.oauth2'),
|
|
|
|
|
url: '/oauth2',
|
|
|
|
|
icon: IdCard,
|
2025-12-26 14:17:34 +08:00
|
|
|
visible: require_any_permission(['system:root', 'account:create']),
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.users'),
|
|
|
|
|
items: [
|
2025-11-24 21:51:16 +08:00
|
|
|
{
|
2025-12-26 14:17:34 +08:00
|
|
|
title: t('navigation.users'),
|
|
|
|
|
url: '/users',
|
|
|
|
|
icon: Users2,
|
|
|
|
|
visible: require_any_permission(['system:root', 'user:manage']),
|
2025-11-24 21:51:16 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.other'),
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.settings'),
|
|
|
|
|
url: '/settings',
|
|
|
|
|
icon: IconSettings,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('navigation.apiDocs'),
|
|
|
|
|
url: '/api-docs',
|
|
|
|
|
icon: IconHelp,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}
|
2025-11-19 02:14:37 +08:00
|
|
|
}
|