// vibe_erp main app shell with i18n support. import { NavLink, Outlet } from 'react-router-dom' import { useEffect, useState } from 'react' import { useAuth } from '@/auth/AuthContext' import { useLocale, useT, AVAILABLE_LOCALES } from '@/i18n/LocaleContext' import type { MessageKey } from '@/i18n/messages' import { meta } from '@/api/client' import type { MetaInfo } from '@/types/api' interface NavItem { to: string labelKey: MessageKey } interface NavGroup { headingKey: MessageKey items: NavItem[] } const NAV: NavGroup[] = [ { headingKey: 'nav.overview', items: [{ to: '/', labelKey: 'nav.dashboard' }], }, { headingKey: 'nav.catalog', items: [ { to: '/items', labelKey: 'nav.items' }, { to: '/uoms', labelKey: 'nav.uoms' }, { to: '/partners', labelKey: 'nav.partners' }, ], }, { headingKey: 'nav.inventory', items: [ { to: '/locations', labelKey: 'nav.locations' }, { to: '/balances', labelKey: 'nav.balances' }, { to: '/movements', labelKey: 'nav.movements' }, ], }, { headingKey: 'nav.orders', items: [ { to: '/sales-orders', labelKey: 'nav.salesOrders' }, { to: '/purchase-orders', labelKey: 'nav.purchaseOrders' }, ], }, { headingKey: 'nav.production', items: [ { to: '/work-orders', labelKey: 'nav.workOrders' }, { to: '/shop-floor', labelKey: 'nav.shopFloor' }, ], }, { headingKey: 'nav.finance', items: [ { to: '/accounts', labelKey: 'nav.accounts' }, { to: '/journal-entries', labelKey: 'nav.journalEntries' }, ], }, { headingKey: 'nav.system', items: [ { to: '/users', labelKey: 'nav.users' }, { to: '/roles', labelKey: 'nav.roles' }, ], }, ] export function AppLayout() { const { username, logout } = useAuth() const { locale, setLocale } = useLocale() const t = useT() const [info, setInfo] = useState(null) useEffect(() => { meta.info().then(setInfo).catch(() => setInfo(null)) }, []) return (
{/* ─── Sidebar ──────────────────────────────────────────── */} {/* ─── Main column ─────────────────────────────────────── */}
vibe_erp
{username ? ( <> {t('label.signedInAs')}{' '} {username} ) : null}
) }