The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
feat(client): let a managed surface attach as an admin tab
Mauricef2329c9a639d
diff --git a/client/src/managed/index.test.ts b/client/src/managed/index.test.tsindex 089169a20..c9373f104 100644--- a/client/src/managed/index.test.ts+++ b/client/src/managed/index.test.ts@@ -8,12 +8,19 @@*/import { describe, it, expect } from 'vitest'import { Briefcase } from 'lucide-react'-import { managedNavItems, managedRoutes, visibleManagedNavItems, type ManagedNavItem } from './index'+import {+ managedAdminTabs,+ managedNavItems,+ managedRoutes,+ visibleManagedNavItems,+ type ManagedNavItem,+} from './index'describe('managed attachment point', () => {it('FE-MANAGED-001: ships empty, so the public build registers nothing', () => {expect(managedRoutes).toEqual([])expect(managedNavItems).toEqual([])+ expect(managedAdminTabs).toEqual([])})it('FE-MANAGED-002: an empty list stays empty for either kind of user', () => {diff --git a/client/src/managed/index.tsx b/client/src/managed/index.tsxindex 12e701384..dbe5a90c5 100644--- a/client/src/managed/index.tsx+++ b/client/src/managed/index.tsx@@ -64,8 +64,35 @@ export function visibleManagedNavItems(isAdmin: boolean): ManagedNavItem[] {return managedNavItems.filter((item) => !item.adminOnly || isAdmin)}+export interface ManagedAdminTab {+ /** Tab id, also the deep-link value of ?tab= on /admin. Keep it bare. */+ id: string+ label: string+ /** lucide-react, like every other icon in the app. */+ Icon: LucideIcon+ /**+ * Which group heading the tab sits under. The admin sidebar groups tabs and+ * requires a group's tabs to be contiguous, so this is appended to the end of+ * whichever group it names rather than inserted mid-list.+ */+ group?: 'users' | 'config' | 'integration' | 'maintenance'+ /** Rendered in the tab body. /admin already requires an admin to get here. */+ element: ReactElement+}+/** Extra protected routes. Spread into the router next to the built-in ones. */export const managedRoutes: ManagedRoute[] = []+/**+ * Extra tabs in Admin → the left sidebar.+ *+ * This is where a surface belongs when it is about the install rather than about+ * a trip: /admin is already behind an admin check, already grouped, and already+ * the place somebody looks when they want to change how their instance works.+ * A top-level nav entry would put it next to My Trips for a screen opened once+ * a month by one person.+ */+export const managedAdminTabs: ManagedAdminTab[] = []+/** Extra entries for the desktop navbar and the mobile tab bar. */export const managedNavItems: ManagedNavItem[] = []diff --git a/client/src/pages/AdminPage.tsx b/client/src/pages/AdminPage.tsxindex 81f71b83a..9fc153137 100644--- a/client/src/pages/AdminPage.tsx+++ b/client/src/pages/AdminPage.tsx@@ -1,4 +1,4 @@-import React from 'react'+import React, { Fragment } from 'react'import { adminApi } from '../api/client'import DevNotificationsPanel from '../components/Admin/DevNotificationsPanel'import DefaultUserSettingsTab from '../components/Admin/DefaultUserSettingsTab'@@ -21,6 +21,7 @@ import AdminUsersTab from './admin/AdminUsersTab'import AdminSettingsTab from './admin/AdminSettingsTab'import AdminNotificationsTab from './admin/AdminNotificationsTab'import AdminUserModals from './admin/AdminUserModals'+import { managedAdminTabs } from '../managed'export default function AdminPage(): React.ReactElement {// ViewportRoute in App.tsx picks the branch now, so the phone screen is a@@ -46,6 +47,7 @@ function AdminPageDesktop(): React.ReactElement {const gConfig = t('admin.group.config')const gIntegration = t('admin.group.integration')const gMaintenance = t('admin.group.maintenance')+ const GROUP_LABELS = { users: gUsers, config: gConfig, integration: gIntegration, maintenance: gMaintenance }const TABS: PageSidebarTab[] = [{ id: 'users', label: t('admin.tabs.users'), icon: Users, group: gUsers },{ id: 'defaults', label: t('admin.tabs.defaults'), icon: UserCog, group: gUsers },@@ -62,6 +64,14 @@ function AdminPageDesktop(): React.ReactElement {...(managed ? [] : [{ id: 'backup', label: t('admin.tabs.backup'), icon: Database, group: gMaintenance }]),{ id: 'audit', label: t('admin.tabs.audit'), icon: ScrollText, group: gMaintenance },...(devMode ? [{ id: 'dev-notifications', label: 'Dev: Notifications', icon: Bug, group: gMaintenance }] : []),+ // Empty in this repository — see client/src/managed. Appended per group+ // rather than inserted, because the sidebar needs a group's tabs contiguous.+ ...managedAdminTabs.map(tab => ({+ id: tab.id,+ label: tab.label,+ icon: tab.Icon,+ group: GROUP_LABELS[tab.group ?? 'config'],+ })),]return (@@ -175,6 +185,11 @@ function AdminPageDesktop(): React.ReactElement {{activeTab === 'defaults' && <DefaultUserSettingsTab />}{activeTab === 'dev-notifications' && <DevNotificationsPanel />}++ {/* Empty in this repository — see client/src/managed. */}+ {managedAdminTabs.map(tab => (+ activeTab === tab.id ? <Fragment key={tab.id}>{tab.element}</Fragment> : null+ ))}</PageSidebar></div>