Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/components/nav-user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export function NavUser() {
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg">
<Skeleton className="size-8 rounded-lg" />
<div className="grid flex-1 gap-1">
<Skeleton className="size-8 shrink-0 rounded-lg" />
<div className="grid flex-1 gap-1 group-data-[collapsible=icon]:hidden">
<Skeleton className="h-4 rounded" />
<Skeleton className="h-3 rounded" />
</div>
Expand Down Expand Up @@ -99,20 +99,21 @@ export function NavUser() {
<SidebarMenuButton
size="lg"
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
tooltip={userName}
>
<Avatar className="size-8 rounded-lg">
<Avatar className="size-8 shrink-0 rounded-lg">
<AvatarImage src={avatarUrl} alt={userName} />
<AvatarFallback className="rounded-lg">
{getInitials(userName)}
</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<div className="grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden">
<span className="truncate font-medium">{userName}</span>
<span className="truncate text-xs text-sidebar-foreground/65">
{formattedRole || userEmail}
</span>
</div>
<ChevronsUpDown className="ml-auto size-4" />
<ChevronsUpDown className="ml-auto size-4 group-data-[collapsible=icon]:hidden" />
</SidebarMenuButton>
</DropdownMenuTrigger>

Expand Down
54 changes: 35 additions & 19 deletions src/components/team-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import {
SidebarMenuItem,
useSidebar,
} from '@/components/ui/sidebar';
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from '@/components/ui/tooltip';

type OrgItem = {
_id: string;
Expand All @@ -31,7 +36,7 @@ type OrgItem = {
};

export function TeamSwitcher() {
const { isMobile } = useSidebar();
const { isMobile, state } = useSidebar();
const { user } = useAuthUser();
const {
years,
Expand Down Expand Up @@ -77,25 +82,36 @@ export function TeamSwitcher() {
<SidebarMenu>
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuButton
size="lg"
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
<Tooltip>
<TooltipTrigger asChild>
<DropdownMenuTrigger asChild>
<SidebarMenuButton
size="lg"
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
>
<div className="flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
<WandSparkles className="size-4" />
</div>
<div className="grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden">
<span className="truncate font-semibold">
{activeOrg?.name ?? 'WorkloadWizard'}
</span>
<span className="truncate text-xs text-sidebar-foreground/70">
{currentYear?.name ?? (activeOrg?.code ?? 'No year selected')}
</span>
</div>
<ChevronsUpDown className="ml-auto group-data-[collapsible=icon]:hidden" />
</SidebarMenuButton>
</DropdownMenuTrigger>
</TooltipTrigger>
<TooltipContent
side="right"
align="center"
hidden={state !== 'collapsed' || isMobile}
>
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
<WandSparkles className="size-4" />
</div>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">
{activeOrg?.name ?? 'WorkloadWizard'}
</span>
<span className="truncate text-xs text-sidebar-foreground/70">
{currentYear?.name ?? (activeOrg?.code ?? 'No year selected')}
</span>
</div>
<ChevronsUpDown className="ml-auto" />
</SidebarMenuButton>
</DropdownMenuTrigger>
{activeOrg?.name ?? 'WorkloadWizard'}
</TooltipContent>
</Tooltip>

<DropdownMenuContent
className="w-(--radix-dropdown-menu-trigger-width) min-w-64 rounded-lg"
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
if (saved === 'collapsed') {
setOpen(false);
}
}, [isMobile]);

Check warning on line 201 in src/components/ui/sidebar.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook React.useEffect has a missing dependency: 'setOpen'. Either include it or remove the dependency array

// Persist state whenever it changes (desktop only)
React.useEffect(() => {
Expand Down Expand Up @@ -530,7 +530,7 @@
size: {
default: 'min-h-11 text-sm',
sm: 'min-h-9 text-xs',
lg: 'min-h-14 text-sm group-data-[collapsible=icon]:p-0!',
lg: 'min-h-14 text-sm group-data-[collapsible=icon]:size-10! group-data-[collapsible=icon]:p-0! group-data-[collapsible=icon]:justify-center',
},
},
defaultVariants: {
Expand Down
6 changes: 5 additions & 1 deletion src/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const PublicEnvSchema = z.object({
NEXT_PUBLIC_CONVEX_URL: z
.string()
.url('NEXT_PUBLIC_CONVEX_URL must be a URL'),
NEXT_PUBLIC_APP_URL: z.string().url('NEXT_PUBLIC_APP_URL must be a URL'),
NEXT_PUBLIC_APP_URL: z
.string()
.url('NEXT_PUBLIC_APP_URL must be a URL')
.optional()
.default('http://localhost:3000'),
NEXT_PUBLIC_SENTRY_DSN: OptionalUrlSchema,
NODE_ENV: z
.enum(['development', 'test', 'production'])
Expand Down
Loading