/opt/mawid/apps/dashboard/app/(app)
NameSizeModeActions
conversations/-0755rm
patients/-0755rm
settings/-0755rm
layout.tsx26710644editdlrm
page.tsx159060644editdlrm
Edit: /opt/mawid/apps/dashboard/app/(app)/layout.tsx (2671B)
'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { usePathname, useRouter } from 'next/navigation'; import { getToken, setToken } from '@/lib/api'; import { useLang, type UiLang } from '@/lib/i18n'; const NAV = [ { href: '/', key: 'calendar' as const }, { href: '/patients', key: 'patients' as const }, { href: '/conversations', key: 'conversations' as const }, { href: '/settings', key: 'settings' as const }, ]; export default function AppLayout({ children }: { children: React.ReactNode }) { const { t, lang, setLang } = useLang(); const router = useRouter(); const pathname = usePathname(); const [ready, setReady] = useState(false); useEffect(() => { if (!getToken()) router.replace('/login'); else setReady(true); }, [router]); if (!ready) return null; return (
{t('appName')}
{(['tr', 'ar', 'en'] as UiLang[]).map((code) => ( ))}
{children}
); }