'use client'; import { useEffect } from 'react'; import { useAuth } from '@/lib/hooks/useAuth'; import { Building2, Beaker } from 'lucide-react'; export default function SelectOrganizationPage() { const { organizations, selectOrganization, isLoading } = useAuth(); // ✅ Auto-redirect if only one organization useEffect(() => { if (!isLoading && organizations.length === 1) { selectOrganization(organizations[0].id); } }, [organizations, isLoading]); const getIcon = (type: string) => { return type === 'CLINIC' ? : ; }; if (isLoading) { return (

Loading organizations...

); } if (!organizations.length) { return (

No organizations found.

); } return (

Choose Organization

You have access to multiple organizations. Select one to continue.

{organizations.map((org) => ( ))}
); }