fix(ui): make compass logo link to dashboard home (#96)
The logo in the org switcher is now a separate clickable link to /dashboard (fullscreen chat). The org name + chevron still opens the workspace dropdown independently. Co-authored-by: Nicholai <nicholaivogelfilms@gmail.com>
This commit is contained in:
parent
2b95ae8f15
commit
d7a3218ea0
@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import Link from "next/link"
|
||||
import { useRouter } from "next/navigation"
|
||||
import {
|
||||
IconBuilding,
|
||||
@ -76,18 +77,18 @@ export function OrgSwitcher({
|
||||
return (
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild disabled={!hasOrgs}>
|
||||
<SidebarMenuButton
|
||||
size="lg"
|
||||
className={cn(
|
||||
"data-[state=open]:bg-sidebar-accent",
|
||||
"data-[state=open]:text-sidebar-accent-foreground",
|
||||
)}
|
||||
className="gap-0 px-0 hover:bg-transparent active:bg-transparent"
|
||||
asChild={false}
|
||||
>
|
||||
<Link
|
||||
href="/dashboard"
|
||||
className="flex shrink-0 items-center justify-center size-8 rounded-md hover:bg-sidebar-accent transition-colors"
|
||||
aria-label="Compass home"
|
||||
>
|
||||
<span
|
||||
aria-label="Compass"
|
||||
className="!size-5 shrink-0 block bg-current"
|
||||
className="!size-5 block bg-current"
|
||||
style={{
|
||||
maskImage: "url(/logo-black.png)",
|
||||
maskSize: "contain",
|
||||
@ -97,15 +98,27 @@ export function OrgSwitcher({
|
||||
WebkitMaskRepeat: "no-repeat",
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild disabled={!hasOrgs}>
|
||||
<button
|
||||
className={cn(
|
||||
"flex min-w-0 flex-1 items-center gap-1 rounded-md px-2 py-1 text-left",
|
||||
"hover:bg-sidebar-accent transition-colors",
|
||||
"data-[state=open]:bg-sidebar-accent",
|
||||
"data-[state=open]:text-sidebar-accent-foreground",
|
||||
!hasOrgs && "cursor-default hover:bg-transparent",
|
||||
)}
|
||||
>
|
||||
<span className="truncate text-sm font-semibold">
|
||||
{displayName}
|
||||
</span>
|
||||
{hasOrgs && (
|
||||
<IconSelector
|
||||
className="ml-auto size-4 shrink-0 opacity-50"
|
||||
className="size-4 shrink-0 opacity-50"
|
||||
/>
|
||||
)}
|
||||
</SidebarMenuButton>
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
|
||||
@ -141,6 +154,7 @@ export function OrgSwitcher({
|
||||
})}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
</SidebarMenu>
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user