-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Frontend): add name to user store
- Loading branch information
Showing
3 changed files
with
30 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,48 +10,52 @@ import { | |
DropdownMenuShortcut, | ||
DropdownMenuTrigger, | ||
} from '@/components/ui/dropdown-menu' | ||
import { useUserStore } from '@/store/user-store' | ||
import { Link } from 'react-router-dom' | ||
|
||
export function UserNav() { | ||
const firstName = useUserStore.getState().user?.firstName | ||
const lastName = useUserStore.getState().user?.lastName | ||
const email = useUserStore.getState().user?.email | ||
|
||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button variant='ghost' className='relative h-8 w-8 rounded-full'> | ||
<Avatar className='h-8 w-8'> | ||
<AvatarImage src='/avatars/01.png' alt='@shadcn' /> | ||
<AvatarFallback>SN</AvatarFallback> | ||
<AvatarFallback> | ||
{firstName?.[0]} | ||
{lastName?.[0]} | ||
</AvatarFallback> | ||
</Avatar> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent className='w-56' align='end' forceMount> | ||
<DropdownMenuLabel className='font-normal'> | ||
<div className='flex flex-col space-y-1'> | ||
<p className='text-sm font-medium leading-none'>satnaing</p> | ||
<p className='text-sm font-medium leading-none'> | ||
{firstName} {lastName} | ||
</p> | ||
<p className='text-xs leading-none text-muted-foreground'> | ||
[email protected] | ||
{email} | ||
</p> | ||
</div> | ||
</DropdownMenuLabel> | ||
<DropdownMenuSeparator /> | ||
<DropdownMenuGroup> | ||
<DropdownMenuItem> | ||
Profile | ||
<DropdownMenuShortcut>⇧⌘P</DropdownMenuShortcut> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem> | ||
Billing | ||
<DropdownMenuShortcut>⌘B</DropdownMenuShortcut> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem> | ||
Settings | ||
<DropdownMenuShortcut>⌘S</DropdownMenuShortcut> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem>New Team</DropdownMenuItem> | ||
<Link to={'/settings'}> | ||
<DropdownMenuItem>Profile</DropdownMenuItem> | ||
</Link> | ||
<Link to={'/settings'}> | ||
<DropdownMenuItem>Settings</DropdownMenuItem> | ||
</Link> | ||
</DropdownMenuGroup> | ||
<DropdownMenuSeparator /> | ||
<DropdownMenuItem> | ||
Log out | ||
<DropdownMenuShortcut>⇧⌘Q</DropdownMenuShortcut> | ||
</DropdownMenuItem> | ||
|
||
<Link to={'/sign-out'}> | ||
<DropdownMenuItem>Logout </DropdownMenuItem> | ||
</Link> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
) | ||
|
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