mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 14:51:45 +00:00
fix: hide MCP tokens tab when addon inactive, move permissions to users tab
- MCP tokens tab only shown when MCP addon is enabled - Permissions panel moved from own tab to users tab below invite links - Fixed inconsistent dropdown widths in permissions panel
This commit is contained in:
@@ -154,6 +154,7 @@ export default function PermissionsPanel(): React.ReactElement {
|
|||||||
value: l,
|
value: l,
|
||||||
label: t(LEVEL_LABELS[l] || l),
|
label: t(LEVEL_LABELS[l] || l),
|
||||||
}))}
|
}))}
|
||||||
|
style={{ minWidth: 160 }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
|
|||||||
import apiClient, { adminApi, authApi, notificationsApi } from '../api/client'
|
import apiClient, { adminApi, authApi, notificationsApi } from '../api/client'
|
||||||
import { useAuthStore } from '../store/authStore'
|
import { useAuthStore } from '../store/authStore'
|
||||||
import { useSettingsStore } from '../store/settingsStore'
|
import { useSettingsStore } from '../store/settingsStore'
|
||||||
|
import { useAddonStore } from '../store/addonStore'
|
||||||
import { useTranslation } from '../i18n'
|
import { useTranslation } from '../i18n'
|
||||||
import { getApiErrorMessage } from '../types'
|
import { getApiErrorMessage } from '../types'
|
||||||
import Navbar from '../components/Layout/Navbar'
|
import Navbar from '../components/Layout/Navbar'
|
||||||
@@ -58,15 +59,15 @@ export default function AdminPage(): React.ReactElement {
|
|||||||
const { demoMode, serverTimezone } = useAuthStore()
|
const { demoMode, serverTimezone } = useAuthStore()
|
||||||
const { t, locale } = useTranslation()
|
const { t, locale } = useTranslation()
|
||||||
const hour12 = useSettingsStore(s => s.settings.time_format) === '12h'
|
const hour12 = useSettingsStore(s => s.settings.time_format) === '12h'
|
||||||
|
const mcpEnabled = useAddonStore(s => s.isEnabled('mcp'))
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{ id: 'users', label: t('admin.tabs.users') },
|
{ id: 'users', label: t('admin.tabs.users') },
|
||||||
{ id: 'config', label: t('admin.tabs.config') },
|
{ id: 'config', label: t('admin.tabs.config') },
|
||||||
{ id: 'addons', label: t('admin.tabs.addons') },
|
{ id: 'addons', label: t('admin.tabs.addons') },
|
||||||
{ id: 'permissions', label: t('admin.tabs.permissions') },
|
|
||||||
{ id: 'settings', label: t('admin.tabs.settings') },
|
{ id: 'settings', label: t('admin.tabs.settings') },
|
||||||
{ id: 'backup', label: t('admin.tabs.backup') },
|
{ id: 'backup', label: t('admin.tabs.backup') },
|
||||||
{ id: 'audit', label: t('admin.tabs.audit') },
|
{ id: 'audit', label: t('admin.tabs.audit') },
|
||||||
{ id: 'mcp-tokens', label: t('admin.tabs.mcpTokens') },
|
...(mcpEnabled ? [{ id: 'mcp-tokens', label: t('admin.tabs.mcpTokens') }] : []),
|
||||||
{ id: 'github', label: t('admin.tabs.github') },
|
{ id: 'github', label: t('admin.tabs.github') },
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -636,6 +637,8 @@ export default function AdminPage(): React.ReactElement {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{activeTab === 'users' && <div className="mt-6"><PermissionsPanel /></div>}
|
||||||
|
|
||||||
{/* Create Invite Modal */}
|
{/* Create Invite Modal */}
|
||||||
<Modal isOpen={showCreateInvite} onClose={() => setShowCreateInvite(false)} title={t('admin.invite.create')} size="sm">
|
<Modal isOpen={showCreateInvite} onClose={() => setShowCreateInvite(false)} title={t('admin.invite.create')} size="sm">
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
@@ -1155,8 +1158,6 @@ export default function AdminPage(): React.ReactElement {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{activeTab === 'permissions' && <PermissionsPanel />}
|
|
||||||
|
|
||||||
{activeTab === 'backup' && <BackupPanel />}
|
{activeTab === 'backup' && <BackupPanel />}
|
||||||
|
|
||||||
{activeTab === 'audit' && <AuditLogPanel serverTimezone={serverTimezone} />}
|
{activeTab === 'audit' && <AuditLogPanel serverTimezone={serverTimezone} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user