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"
|
"use client"
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
|
import Link from "next/link"
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import {
|
import {
|
||||||
IconBuilding,
|
IconBuilding,
|
||||||
@ -76,18 +77,18 @@ export function OrgSwitcher({
|
|||||||
return (
|
return (
|
||||||
<SidebarMenu>
|
<SidebarMenu>
|
||||||
<SidebarMenuItem>
|
<SidebarMenuItem>
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild disabled={!hasOrgs}>
|
|
||||||
<SidebarMenuButton
|
<SidebarMenuButton
|
||||||
size="lg"
|
size="lg"
|
||||||
className={cn(
|
className="gap-0 px-0 hover:bg-transparent active:bg-transparent"
|
||||||
"data-[state=open]:bg-sidebar-accent",
|
asChild={false}
|
||||||
"data-[state=open]:text-sidebar-accent-foreground",
|
>
|
||||||
)}
|
<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
|
<span
|
||||||
aria-label="Compass"
|
className="!size-5 block bg-current"
|
||||||
className="!size-5 shrink-0 block bg-current"
|
|
||||||
style={{
|
style={{
|
||||||
maskImage: "url(/logo-black.png)",
|
maskImage: "url(/logo-black.png)",
|
||||||
maskSize: "contain",
|
maskSize: "contain",
|
||||||
@ -97,15 +98,27 @@ export function OrgSwitcher({
|
|||||||
WebkitMaskRepeat: "no-repeat",
|
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">
|
<span className="truncate text-sm font-semibold">
|
||||||
{displayName}
|
{displayName}
|
||||||
</span>
|
</span>
|
||||||
{hasOrgs && (
|
{hasOrgs && (
|
||||||
<IconSelector
|
<IconSelector
|
||||||
className="ml-auto size-4 shrink-0 opacity-50"
|
className="size-4 shrink-0 opacity-50"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</SidebarMenuButton>
|
</button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent
|
<DropdownMenuContent
|
||||||
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
|
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
|
||||||
@ -141,6 +154,7 @@ export function OrgSwitcher({
|
|||||||
})}
|
})}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
</SidebarMenuButton>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
</SidebarMenu>
|
</SidebarMenu>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user