feat(managed): an install's own admin tabs on the phone too

The mobile admin never read managedAdminTabs, so a tab an install attaches
there (managed/index.tsx) existed on the desktop only. The phone's section
picker now lists them after the built-in sections, as the desktop sidebar does,
and shows `mobileElement` when a tab brings a phone layout of its own, else its
desktop `element`. TREK itself attaches nothing; the seam stays empty.
This commit is contained in:
Maurice
2026-11-07 10:47:59 +01:00
parent 315db3fa5a
commit e5a119b6bd
3 changed files with 91 additions and 0 deletions
+6
View File
@@ -78,6 +78,12 @@ export interface ManagedAdminTab {
group?: 'users' | 'config' | 'integration' | 'maintenance'
/** Rendered in the tab body. /admin already requires an admin to get here. */
element: ReactElement
/**
* The same tab laid out for a phone, in the mobile admin's section picker.
* Without it the phone shows `element`, which then has to hold up on a narrow
* screen by itself.
*/
mobileElement?: ReactElement
}
/** Extra protected routes. Spread into the router next to the built-in ones. */
@@ -44,6 +44,7 @@ import MAdminSheets from './MAdminSheets'
import MAdminStoragePanel from './MAdminStoragePanel'
import MAdminUsersSection from './MAdminUsersSection'
import { MAdminButton } from './MAdminUi'
import { managedAdminTabs } from '../../../managed'
// Stat card of the 2×2 grid (design §6.3): 34px icon tile, 19px/800 number,
// small tracking label. Count-up animation matches the desktop stat cards.
@@ -98,6 +99,8 @@ export default function MAdmin() {
...(managed ? [] : [{ id: 'backup', label: t('admin.tabs.backup'), icon: Database }]),
{ id: 'audit', label: t('admin.tabs.audit'), icon: ScrollText },
...(devMode ? [{ id: 'dev-notifications', label: 'Dev: Notifications', icon: Bug }] : []),
// The install's own tabs (managed/index.tsx), after the built-in ones as on the desktop.
...managedAdminTabs.map(tab => ({ id: tab.id, label: tab.label, icon: tab.Icon })),
]
const activeSection = sections.find((s) => s.id === activeTab) ?? sections[0]
@@ -227,6 +230,9 @@ export default function MAdmin() {
{activeTab === 'backup' && <MAdminBackupPanel />}
{activeTab === 'audit' && <MAdminAuditLogPanel serverTimezone={serverTimezone} />}
{activeTab === 'dev-notifications' && <MAdminDevNotificationsPanel />}
{managedAdminTabs.map(tab =>
activeTab === tab.id ? <div key={tab.id}>{tab.mobileElement ?? tab.element}</div> : null,
)}
<MAdminSheets admin={admin} t={t} />
</div>