/** * @license * SPDX-License-Identifier: Apache-2.0 */ /** * Exclusive landing page for issuperadmin logins — a platform operator, not * scoped to any tenant. Deliberately minimal: no sidebar, no merchant nav, * just the shared Header (for logout) and the existing tenant/store/rider * onboarding wizard (AdminConsole), which until now was only reachable * scoped to a single tenant's own Settings page. */ import React, { useState } from 'react'; import { Routes, Route, Navigate, useLocation } from 'react-router-dom'; import Header from './Header'; import AdminConsole from './AdminConsole'; import CatalogueBrowser from './CatalogueBrowser'; import SuperAdminSidebar, { type SuperAdminNavItem } from './SuperAdminSidebar'; import { UserPlus, Box } from 'lucide-react'; import type { AuthUser } from '../services/auth'; import { FIESTA_TENANT_ID, FIESTA_PRIMARY_LOCATION_ID } from '../services/fiestaApi'; interface SuperAdminPageProps { user: AuthUser; onLogout: () => void; } const NAV_ITEMS: SuperAdminNavItem[] = [ { id: 'onboarding', label: 'Onboard Tenant', icon: UserPlus }, { id: 'catalogue', label: 'Global Catalogue', icon: Box }, ]; export default function SuperAdminPage({ user, onLogout }: SuperAdminPageProps) { const [sidebarOpen, setSidebarOpen] = useState(false); const location = useLocation(); const profile = { name: user.name, role: 'Super Admin', email: user.email }; const tenantId = user.tenantid || FIESTA_TENANT_ID; const currentPath = location.pathname.split('/').pop(); const currentItem = NAV_ITEMS.find(item => item.id === currentPath) || NAV_ITEMS[0]; return (
setSidebarOpen(!sidebarOpen)} onHelpClick={() => {}} onLogoutClick={onLogout} profile={profile} storeContext={{ storeName: currentItem.label, icon: currentItem.icon }} />
setSidebarOpen(false)} />
} /> } /> } />
); }