-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add sidebar components * feat: rework sidenav to use new sidebar component * chore: format * chore: make the configured collapsible type actually do something * fix: set default value for sidebar as open instead of closed * fix: make the chevron more easily clickable and rotate better * fix: apply suggested fix for incorrect cookie behavior * fix: make sidebar viewable * fix: run prettier * chore: restore layout * fix: make more like designs * fix: make thing good * fix: perfect * fix: fix sidebar colors * fix: fix cookie awaiting * fix: fix padding of avatar * fix: ignore eslint warning * fix: tweak sidebar colors ever so slightly * feat: expand sidebar on clicking submenu in icon mode * fix: fix type errors * fix: prettier pass * fix: fix icon * fix: make login switcher more accessible and easy to reach by tests * fix: make login test use different emails making them easier to run in isolation * fix: fix some hydration/control errors so login tests can run in dev mode (otherwise error message obscures loginSwitcher) * feat: change all slate to gray * feat: distinguish between accent (hover) and active states * feat: change all slate to gray in core * fix: fix accessibility error * feat: add specific auth checks for sidebar * fix: eslint * fix: increase timeout for pub capabilities test * fix: change odd useeffect * fix: fix spacing and shadow issues * fix: make last element of sidebar group clickable in collapsed mode * feat: add tooltips in collapsed mode
- Loading branch information
Showing
63 changed files
with
1,831 additions
and
481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,81 @@ | ||
import type { User } from "lucia"; | ||
|
||
import Link from "next/link"; | ||
|
||
import { Avatar, AvatarFallback, AvatarImage } from "ui/avatar"; | ||
import { Button } from "ui/button"; | ||
import { Settings } from "ui/icon"; | ||
import { ChevronsUpDown, UserRoundCog } from "ui/icon"; | ||
import { Popover, PopoverContent, PopoverTrigger } from "ui/popover"; | ||
import { Separator } from "ui/separator"; | ||
import { SidebarMenuButton } from "ui/sidebar"; | ||
|
||
import { getLoginData } from "~/lib/authentication/loginData"; | ||
import LogoutButton from "../../components/LogoutButton"; | ||
|
||
const AvatarThing = ({ user }: { user: User }) => ( | ||
<div className="flex w-full items-center gap-x-2"> | ||
<Avatar className="h-9 w-9 group-data-[collapsible=icon]:-ml-2 group-data-[collapsible=icon]:h-8 group-data-[collapsible=icon]:w-8"> | ||
<AvatarImage src={user.avatar || undefined} /> | ||
<AvatarFallback>{(user.firstName || user.email)[0].toUpperCase()}</AvatarFallback> | ||
</Avatar> | ||
|
||
<div className="flex min-w-0 flex-grow flex-col justify-start text-start group-data-[collapsible=icon]:hidden"> | ||
<p className="truncate text-sm">{user.firstName}</p> | ||
<p className="truncate text-xs text-gray-500">{user.email}</p> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default async function LoginSwitcher() { | ||
const { user } = await getLoginData(); | ||
if (!user) { | ||
return null; | ||
} | ||
return ( | ||
<div className="w-max-[100%] flex flex-col gap-y-2 rounded-lg border border-gray-100 bg-white p-2"> | ||
<div className="flex items-center"> | ||
<Avatar className="mr-2 h-9 w-9"> | ||
<Link className="w-full" href="/settings"> | ||
<AvatarImage src={user.avatar || undefined} /> | ||
<AvatarFallback> | ||
{(user.firstName || user.email)[0].toUpperCase()} | ||
</AvatarFallback> | ||
</Link> | ||
</Avatar> | ||
<div> | ||
<div className="text-xs">{user.firstName}</div> | ||
<div className="text-xs text-gray-400">{user.email}</div> | ||
</div> | ||
</div> | ||
<div className="mt-1 flex flex-row items-center"> | ||
<LogoutButton /> | ||
<Button variant="outline" size="sm" asChild> | ||
<Link className="ml-2 flex items-center gap-1" href="/settings"> | ||
<Settings size="14" /> | ||
Settings | ||
</Link> | ||
</Button> | ||
</div> | ||
<div className="w-max-[100%] borderp-2 flex flex-col gap-y-2 rounded-lg"> | ||
<Popover> | ||
<PopoverTrigger asChild> | ||
<SidebarMenuButton | ||
className="flex h-fit items-center gap-x-2 p-2 py-1" | ||
aria-label="User menu" | ||
data-testid="user-menu-button" | ||
aria-haspopup="true" | ||
> | ||
<AvatarThing user={user} /> | ||
<ChevronsUpDown | ||
size="16" | ||
className="group-data-[collapsible=icon]:hidden" | ||
/> | ||
</SidebarMenuButton> | ||
</PopoverTrigger> | ||
<PopoverContent side="right" className="p-0"> | ||
<div className="flex flex-col items-start"> | ||
<div className="p-2"> | ||
<AvatarThing user={user} /> | ||
</div> | ||
<Separator className="mx-1" /> | ||
<Button | ||
variant="ghost" | ||
size="sm" | ||
asChild | ||
className="w-full justify-start gap-2 rounded-none hover:bg-sidebar-accent hover:text-sidebar-accent-foreground" | ||
> | ||
<Link | ||
className="flex w-full items-center justify-start gap-2" | ||
href="/settings" | ||
> | ||
<UserRoundCog size="14" strokeWidth={1.5} /> | ||
Settings | ||
</Link> | ||
</Button> | ||
<Separator className="mx-1" /> | ||
<LogoutButton | ||
variant="ghost" | ||
className="w-full justify-start rounded-none hover:bg-sidebar-accent hover:text-sidebar-accent-foreground" | ||
/> | ||
</div> | ||
</PopoverContent> | ||
</Popover> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.