import { useEffect, type FC } from 'react';
import { Box, CircularProgress, MenuItem, Select, Typography } from '@mui/material';
import { useProfileStore } from '../../store/useStore';
/** A compact dropdown for switching the active profile (the subject of care
* whose data the dashboard shows). Sits in the AppBar. Triggers `loadProfiles`
* on mount so the list + per-profile DEKs are ready. */
export const ProfileSwitcher: FC = () => {
const { profiles, activeProfileId, isLoading, loadProfiles, setActiveProfile } =
useProfileStore();
useEffect(() => {
loadProfiles();
}, [loadProfiles]);
if (profiles.length === 0) {
return isLoading ? (
) : (
No profile
);
}
return (
);
};
export default ProfileSwitcher;