66 PlusIcon ,
77 SpinnerGapIcon ,
88 UserIcon ,
9- UsersIcon ,
109} from '@phosphor-icons/react' ;
11- import { useRouter } from 'next/navigation' ;
1210import { useCallback , useState } from 'react' ;
1311import { CreateOrganizationDialog } from '@/components/organizations/create-organization-dialog' ;
1412import { Avatar , AvatarFallback , AvatarImage } from '@/components/ui/avatar' ;
@@ -73,7 +71,7 @@ function OrganizationSelectorTrigger({
7371 return (
7472 < div
7573 className = { cn (
76- 'flex h-16 w-full items-center border-sidebar-border border-b bg-sidebar-accent px-5 py-3 transition-colors' ,
74+ 'flex h-12 w-full items-center border-sidebar-border border-b bg-sidebar-accent px-3 py-3 transition-colors' ,
7775 'hover:bg-sidebar-accent/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring/50' ,
7876 isSettingActiveOrganization && 'cursor-not-allowed opacity-70' ,
7977 isOpen && 'bg-sidebar-accent/60'
@@ -138,20 +136,16 @@ export function OrganizationSelector() {
138136 hasError,
139137 activeOrganizationError,
140138 } = useOrganizations ( ) ;
141- const router = useRouter ( ) ;
142139 const [ isOpen , setIsOpen ] = useState ( false ) ;
143140 const [ showCreateDialog , setShowCreateDialog ] = useState ( false ) ;
144141 const [ query , setQuery ] = useState ( '' ) ;
145142
146- // Handle case where active organization is not found (deleted)
147143 const [ hasHandledMissingOrg , setHasHandledMissingOrg ] = useState ( false ) ;
148144
149- // Check if the error indicates the organization was not found
150145 const isActiveOrgNotFound =
151146 activeOrganizationError ?. message ?. includes ( 'ORGANIZATION_NOT_FOUND' ) ||
152147 activeOrganizationError ?. message ?. includes ( 'Organization not found' ) ;
153148
154- // Auto-recover from deleted active organization
155149 if (
156150 isActiveOrgNotFound &&
157151 ! hasHandledMissingOrg &&
@@ -181,16 +175,11 @@ export function OrganizationSelector() {
181175 setIsOpen ( false ) ;
182176 } , [ ] ) ;
183177
184- const handleManageOrganizations = useCallback ( ( ) => {
185- router . push ( '/organizations' ) ;
186- setIsOpen ( false ) ;
187- } , [ router ] ) ;
188-
189178 const filteredOrganizations = filterOrganizations ( organizations , query ) ;
190179
191180 if ( isLoading ) {
192181 return (
193- < div className = "flex h-16 w-full items-center border-sidebar-border border-b bg-sidebar-accent px-5 py-3" >
182+ < div className = "flex h-12 w-full items-center border-sidebar-border border-b bg-sidebar-accent px-3 py-3" >
194183 < div className = "flex w-full items-center justify-between" >
195184 < div className = "flex items-center gap-3" >
196185 < div className = "rounded-lg bg-sidebar/80 p-1.5 shadow-sm ring-1 ring-sidebar-border/50" >
@@ -209,7 +198,7 @@ export function OrganizationSelector() {
209198
210199 if ( hasError && ! isActiveOrgNotFound ) {
211200 return (
212- < div className = "border-sidebar-border border-b bg-destructive/10 px-5 py-3" >
201+ < div className = "border-sidebar-border border-b bg-destructive/10 px-3 py-3" >
213202 < div className = "flex items-center gap-3" >
214203 < div className = "rounded bg-sidebar/80 p-1.5 shadow-sm ring-1 ring-destructive/50" >
215204 < UserIcon className = "h-5 w-5 text-destructive" weight = "duotone" />
@@ -251,24 +240,23 @@ export function OrganizationSelector() {
251240 />
252241 </ Button >
253242 </ DropdownMenuTrigger >
254- < DropdownMenuContent align = "start" className = "w-72 p-1" sideOffset = { 4 } >
255- { /* Personal Workspace */ }
243+ < DropdownMenuContent
244+ align = "start"
245+ className = "w-72 rounded-none border-sidebar-border bg-sidebar p-0"
246+ sideOffset = { 0 }
247+ >
256248 < DropdownMenuItem
257249 className = { cn (
258- 'flex cursor-pointer items-center gap-3 rounded px-2 py-2 transition-colors' ,
259- 'focus :bg-accent focus :text-accent-foreground' ,
260- ! activeOrganization && 'bg-accent text-accent-foreground'
250+ 'flex cursor-pointer items-center gap-3 px-4 py-2.5 text-sm transition-colors' ,
251+ 'hover :bg-sidebar- accent/60 hover :text-sidebar- accent-foreground text-sidebar-foreground/70 ' ,
252+ ! activeOrganization && 'bg-sidebar- accent text-sidebar- accent-foreground font-medium '
261253 ) }
262254 onClick = { ( ) => handleSelectOrganization ( null ) }
263255 >
264- < Avatar className = "h-6 w-6" >
265- < AvatarFallback className = "bg-muted text-xs" >
266- < UserIcon className = "not-dark:text-primary" weight = "duotone" />
267- </ AvatarFallback >
268- </ Avatar >
256+ < UserIcon className = "h-5 w-5 not-dark:text-primary" weight = "duotone" />
269257 < div className = "flex min-w-0 flex-1 flex-col items-start text-left" >
270258 < span className = "text-left font-medium text-sm" > Personal</ span >
271- < span className = "text-left text-muted -foreground text-xs" >
259+ < span className = "text-left text-sidebar -foreground/70 text-xs" >
272260 Your workspace
273261 </ span >
274262 </ div >
@@ -281,36 +269,36 @@ export function OrganizationSelector() {
281269 </ DropdownMenuItem >
282270
283271 { filteredOrganizations && filteredOrganizations . length > 0 && (
284- < div className = "flex flex-col gap-1 " >
285- < DropdownMenuSeparator className = "my-1" />
272+ < div className = "flex flex-col" >
273+ < DropdownMenuSeparator className = "my-1 bg-sidebar-border " />
286274 { filteredOrganizations . map ( ( org ) => (
287275 < DropdownMenuItem
288276 className = { cn (
289- 'flex cursor-pointer items-center gap-3 rounded px-2 py-2 transition-colors' ,
290- 'focus :bg-accent focus :text-accent-foreground' ,
277+ 'flex cursor-pointer items-center gap-3 px-4 py-2.5 text-sm transition-colors' ,
278+ 'hover :bg-sidebar- accent/60 hover :text-sidebar- accent-foreground text-sidebar-foreground/70 ' ,
291279 activeOrganization ?. id === org . id &&
292- 'bg-accent text-accent-foreground'
280+ 'bg-sidebar- accent text-sidebar- accent-foreground font-medium '
293281 ) }
294282 key = { org . id }
295283 onClick = { ( ) => handleSelectOrganization ( org . id ) }
296284 >
297- < Avatar className = "h-6 w-6 " >
285+ < Avatar className = "h-5 w-5 " >
298286 < AvatarImage alt = { org . name } src = { org . logo || undefined } />
299- < AvatarFallback className = "bg-muted text-xs" >
287+ < AvatarFallback className = "bg-sidebar-primary/30 text-xs" >
300288 { getOrganizationInitials ( org . name ) }
301289 </ AvatarFallback >
302290 </ Avatar >
303291 < div className = "flex min-w-0 flex-1 flex-col items-start text-left" >
304292 < span className = "truncate text-left font-medium text-sm" >
305293 { org . name }
306294 </ span >
307- < span className = "truncate text-left text-muted -foreground text-xs" >
295+ < span className = "truncate text-left text-sidebar -foreground/70 text-xs" >
308296 { org . slug }
309297 </ span >
310298 </ div >
311299 { activeOrganization ?. id === org . id && (
312300 < CheckIcon
313- className = "h-4 w-4 text-primary"
301+ className = "h-4 w-4 not-dark: text-primary"
314302 weight = "duotone"
315303 />
316304 ) }
@@ -320,30 +308,19 @@ export function OrganizationSelector() {
320308 ) }
321309
322310 { filteredOrganizations . length === 0 && (
323- < div className = "px-2 py-2 text-muted -foreground text-xs" >
324- No workspaces match “ { query } ” .
311+ < div className = "px-4 py-2.5 text-sidebar -foreground/60 text-xs" >
312+ No workspaces match " { query } " .
325313 </ div >
326314 ) }
327315
328- < DropdownMenuSeparator className = "my-1" />
316+ < DropdownMenuSeparator className = "my-1 bg-sidebar-border " />
329317 < DropdownMenuItem
330- className = "flex cursor-pointer items-center gap-3 rounded px-2 py-2 transition-colors focus :bg-accent focus :text-accent-foreground"
318+ className = "flex cursor-pointer items-center gap-3 px-4 py-2.5 text-sm transition-colors hover :bg-sidebar- accent/60 hover :text-sidebar- accent-foreground text-sidebar-foreground/70 "
331319 onClick = { handleCreateOrganization }
332320 >
333- < div className = "flex h-6 w-6 items-center justify-center rounded bg-muted" >
334- < PlusIcon className = "not-dark:text-primary" />
335- </ div >
321+ < PlusIcon className = "h-5 w-5 not-dark:text-primary" />
336322 < span className = "font-medium text-sm" > Create Organization</ span >
337323 </ DropdownMenuItem >
338- < DropdownMenuItem
339- className = "flex cursor-pointer items-center gap-3 rounded px-2 py-2 transition-colors focus:bg-accent focus:text-accent-foreground"
340- onClick = { handleManageOrganizations }
341- >
342- < div className = "flex h-6 w-6 items-center justify-center rounded bg-muted" >
343- < UsersIcon className = "not-dark:text-primary" weight = "duotone" />
344- </ div >
345- < span className = "font-medium text-sm" > Manage Organizations</ span >
346- </ DropdownMenuItem >
347324 </ DropdownMenuContent >
348325 </ DropdownMenu >
349326
0 commit comments