Tidy beta landing page and qBittorrent status
This commit is contained in:
@@ -38,41 +38,52 @@ export default function HeaderActions() {
|
||||
return null
|
||||
}
|
||||
|
||||
const roleItems =
|
||||
role === null
|
||||
? []
|
||||
: role === 'admin'
|
||||
? [
|
||||
{
|
||||
href: '/admin',
|
||||
label: 'Config',
|
||||
match: (path: string) => path.startsWith('/admin'),
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
href: '/profile',
|
||||
label: 'Profile',
|
||||
match: (path: string) => path.startsWith('/profile') && !path.startsWith('/profile/invites'),
|
||||
},
|
||||
{
|
||||
href: '/profile/invites',
|
||||
label: 'Invites',
|
||||
match: (path: string) => path.startsWith('/profile/invites'),
|
||||
},
|
||||
]
|
||||
|
||||
const items = [
|
||||
{ href: '/', label: 'Health', icon: '01', match: (path: string) => path === '/' },
|
||||
{ href: '/', label: 'Health', match: (path: string) => path === '/' },
|
||||
{
|
||||
href: '/portal/requests',
|
||||
label: 'Requests',
|
||||
icon: '02',
|
||||
match: (path: string) => path === '/portal/requests' || path.startsWith('/requests/'),
|
||||
},
|
||||
{
|
||||
href: '/portal/issues',
|
||||
label: 'Issues',
|
||||
icon: '03',
|
||||
match: (path: string) => path === '/portal/issues' || path === '/admin/issues',
|
||||
},
|
||||
{
|
||||
href: role === 'admin' ? '/users' : '/profile',
|
||||
label: role === 'admin' ? 'Users' : 'Profile',
|
||||
icon: '04',
|
||||
match: (path: string) => path.startsWith('/users') || path.startsWith('/profile'),
|
||||
},
|
||||
{
|
||||
href: role === 'admin' ? '/admin' : '/profile/invites',
|
||||
label: role === 'admin' ? 'Config' : 'Invites',
|
||||
icon: '05',
|
||||
match: (path: string) => path.startsWith('/admin') || path.startsWith('/profile/invites'),
|
||||
},
|
||||
...roleItems,
|
||||
]
|
||||
|
||||
return (
|
||||
<nav className="header-actions" aria-label="Primary">
|
||||
{items.map((item) => {
|
||||
{items.map((item, index) => {
|
||||
const active = item.match(pathname)
|
||||
return (
|
||||
<a key={item.href} href={item.href} className={active ? 'is-active' : undefined}>
|
||||
<span aria-hidden="true">{item.icon}</span>
|
||||
<span aria-hidden="true">{String(index + 1).padStart(2, '0')}</span>
|
||||
{item.label}
|
||||
</a>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user