feat: move class selection to profile dropdown in header for improved user experience
This commit is contained in:
parent
de8742437f
commit
b3c6ae2460
@ -46,29 +46,6 @@ export const HeaderContent = ({ user }: { user?: User }) => {
|
|||||||
<NavbarBrand>
|
<NavbarBrand>
|
||||||
<p className="font-bold text-inherit">Toogether</p>
|
<p className="font-bold text-inherit">Toogether</p>
|
||||||
</NavbarBrand>
|
</NavbarBrand>
|
||||||
|
|
||||||
<NavbarContent as="div" justify="center">
|
|
||||||
<Autocomplete
|
|
||||||
size="sm"
|
|
||||||
label="Select an class"
|
|
||||||
value={selectedClass?.name}
|
|
||||||
selectedKey={selectedClass?.id}
|
|
||||||
onSelectionChange={(selectedId) => {
|
|
||||||
const inputSelectedClass = classes.find(
|
|
||||||
(Class) => Class.id === selectedId,
|
|
||||||
);
|
|
||||||
if (inputSelectedClass)
|
|
||||||
setSelectedClassId(inputSelectedClass.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{classes.map((Class) => (
|
|
||||||
<AutocompleteItem key={Class.id}>
|
|
||||||
{Class.name}
|
|
||||||
</AutocompleteItem>
|
|
||||||
))}
|
|
||||||
</Autocomplete>
|
|
||||||
</NavbarContent>
|
|
||||||
|
|
||||||
<NavbarContent as="div" justify="end">
|
<NavbarContent as="div" justify="end">
|
||||||
{user?.roles.includes("admin") ? (
|
{user?.roles.includes("admin") ? (
|
||||||
<NavbarItem>
|
<NavbarItem>
|
||||||
@ -98,11 +75,38 @@ export const HeaderContent = ({ user }: { user?: User }) => {
|
|||||||
size="sm"
|
size="sm"
|
||||||
/>
|
/>
|
||||||
</DropdownTrigger>
|
</DropdownTrigger>
|
||||||
<DropdownMenu aria-label="Profile Actions" variant="flat">
|
<DropdownMenu
|
||||||
<DropdownItem key="profile" className="h-14 gap-2">
|
aria-label="Profile Actions"
|
||||||
|
variant="flat"
|
||||||
|
closeOnSelect={false}
|
||||||
|
>
|
||||||
|
<DropdownItem key="profile" className="h-14 gap-2" showDivider>
|
||||||
<p>Signed in as</p>
|
<p>Signed in as</p>
|
||||||
<p className="font-semibold">{user?.name}</p>
|
<p className="font-semibold">{user?.name}</p>
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
|
<DropdownItem key="class" className="h-14 gap-2">
|
||||||
|
<Autocomplete
|
||||||
|
size="sm"
|
||||||
|
label="Select an class"
|
||||||
|
value={selectedClass?.name}
|
||||||
|
selectedKey={selectedClass?.id}
|
||||||
|
onSelectionChange={(selectedId) => {
|
||||||
|
const inputSelectedClass = classes.find(
|
||||||
|
(Class) => Class.id === selectedId,
|
||||||
|
);
|
||||||
|
if (inputSelectedClass)
|
||||||
|
setSelectedClassId(
|
||||||
|
inputSelectedClass.id,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{classes.map((Class) => (
|
||||||
|
<AutocompleteItem key={Class.id}>
|
||||||
|
{Class.name}
|
||||||
|
</AutocompleteItem>
|
||||||
|
))}
|
||||||
|
</Autocomplete>
|
||||||
|
</DropdownItem>
|
||||||
<DropdownItem key="settings">Settings</DropdownItem>
|
<DropdownItem key="settings">Settings</DropdownItem>
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
key="logout"
|
key="logout"
|
||||||
|
Loading…
Reference in New Issue
Block a user