feat: platform admin frontend — pages, composables, navigation, impersonation

Build the frontend for platform admin in apps/app/:
- TypeScript types (admin.ts) and API composable (useAdmin.ts) with
  TanStack Query for all admin endpoints
- ImpersonationStore (Pinia) + ImpersonationBanner component integrated
  in the main layout, with token-based session management
- Platform navigation section (conditionally shown for super_admin users)
- Route guard blocking /platform/* for non-super_admin users
- 6 pages: dashboard with stats cards, organisations list/detail,
  users list/detail with impersonation, activity log with expandable rows
- All pages implement loading/error/empty states per conventions
- Vite build passes cleanly

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 23:49:36 +02:00
parent 07ba791405
commit 9e7f28420c
15 changed files with 2262 additions and 2 deletions

View File

@@ -44,6 +44,17 @@ export function setupGuards(router: Router) {
return { path: '/login', query: { to: to.fullPath } }
}
// Platform admin routes — require super_admin role
if (to.path.startsWith('/platform')) {
if (!authStore.isSuperAdmin) {
if (import.meta.env.DEV) console.log('🚫 Not a super admin, redirecting to dashboard')
return { name: 'dashboard' }
}
// Platform routes don't require organisation selection
if (import.meta.env.DEV) console.log('✅ Super admin access to platform route')
return
}
// Authenticated — check organisation selection for routes that need it
const orgStore = useOrganisationStore()
const isSelectOrgPage = to.path === '/select-organisation'