Skip to content

armgit / TREK

Public Imported from GitHub
0

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.

feat(client): let a managed route require an admin

Maurice887e6c5026c6
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 21fb7b6a9..2512ca9d3 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -479,7 +479,7 @@ export default function App() {
<Route
key={r.path}
path={r.path}
- element={<ProtectedRoute>{r.element}</ProtectedRoute>}
+ element={<ProtectedRoute adminRequired={r.adminOnly}>{r.element}</ProtectedRoute>}
/>
))}
<Route
diff --git a/client/src/managed/index.tsx b/client/src/managed/index.tsx
index 4f11922b2..12e701384 100644
--- a/client/src/managed/index.tsx
+++ b/client/src/managed/index.tsx
@@ -29,6 +29,15 @@ export interface ManagedRoute {
path: string
/** Rendered inside the app's ProtectedRoute wrapper, like every other screen. */
element: ReactElement
+ /**
+ * Refuse the route to anyone but an admin, the same way /admin does.
+ *
+ * Hiding the nav entry is not access control — the path is still typeable, and
+ * a screen about how the install is run should not open for a traveller who
+ * was invited to one trip. Set this alongside `adminOnly` on the matching nav
+ * entry; the two answer different questions.
+ */
+ adminOnly?: boolean
}
export interface ManagedNavItem {