diff --git a/frontend/src/layouts/Authenticated.tsx b/frontend/src/layouts/Authenticated.tsx index 97d1589..fc0c459 100644 --- a/frontend/src/layouts/Authenticated.tsx +++ b/frontend/src/layouts/Authenticated.tsx @@ -62,6 +62,7 @@ export default function LayoutAuthenticated({ children, permission }: Props) { const router = useRouter(); const { token, currentUser } = useAppSelector((state) => state.auth); const [isAsideOpen, setIsAsideOpen] = useState(false); + const isClientUser = currentUser?.app_role?.name === 'Client'; function getLocalToken() { if (typeof window === 'undefined') { @@ -109,6 +110,21 @@ export default function LayoutAuthenticated({ children, permission }: Props) { } }, [currentUser, permission]); + useEffect(() => { + if (!isClientUser) { + return; + } + + if ( + router.pathname === '/client-portal' || + router.pathname === '/profile' + ) { + return; + } + + router.push('/client-portal'); + }, [isClientUser, router.pathname]); + useEffect(() => { function closeAside() { setIsAsideOpen(false); @@ -122,6 +138,10 @@ export default function LayoutAuthenticated({ children, permission }: Props) { }, [router.events]); const visibleNavItems = navItems.filter((item) => { + if (isClientUser) { + return item.href === '/client-portal' || item.href === '/profile'; + } + if (!item.permission) { return true; } @@ -170,8 +190,9 @@ export default function LayoutAuthenticated({ children, permission }: Props) { Today
- Prepare, follow up, and keep every coaching relationship warm - between sessions. + {isClientUser + ? 'Review shared notes, commitments, and resources from your coach.' + : 'Prepare, follow up, and keep every coaching relationship warm between sessions.'}
@@ -242,7 +263,9 @@ export default function LayoutAuthenticated({ children, permission }: Props) { Workspace status- Review sessions, clients, tasks, and shared client materials. + {isClientUser + ? 'Review your commitments, notes, and shared resources.' + : 'Review sessions, clients, tasks, and shared client materials.'}
{ + const { currentUser } = useAppSelector((state) => state.auth); const [clients, setClients] = React.useState< - Array<{ id: string; name: string }> + Array<{ id: string; name: string; email?: string }> >([]); const [clientId, setClientId] = React.useState(''); const [portalClient, setPortalClient] = React.useState- Preview the client-facing workspace with shared notes, - commitments, resources, and a pre-session reflection prompt. + {isClientUser + ? 'Review shared notes, commitments, resources, and reflections for your coaching work.' + : 'Preview the client-facing workspace with shared notes, commitments, resources, and a pre-session reflection prompt.'}
- MVP note: this is still a coach-visible preview. Final client - access should be a client role or magic-link route. -
-+ Coaches can preview what each client sees before sharing + notes, commitments, or resources. +
+