@@ -61,14 +61,7 @@ import {
6161} from "@t3tools/contracts" ;
6262import type { OlderSettledScope } from "@t3tools/client-runtime/state/threads" ;
6363
64- import {
65- CheckIcon ,
66- ChevronDownIcon ,
67- FolderIcon ,
68- ListFilterIcon ,
69- PlusIcon ,
70- SettingsIcon ,
71- } from "lucide-react" ;
64+ import { ChevronDownIcon , FolderIcon , ListFilterIcon , PlusIcon , SettingsIcon } from "lucide-react" ;
7265import {
7366 useEffect ,
7467 useLayoutEffect ,
@@ -861,15 +854,26 @@ function useSidebarLookups() {
861854 } ;
862855}
863856
864- function ProjectScopeRowIcon ( props : { isSelected : boolean ; children : ReactNode } ) {
857+ /**
858+ * Two fixed slots so hover never widens a row; the gear takes the machine's slot on hover.
859+ * Touch has no hover, so it shows the machine and gear together.
860+ */
861+ function ProjectScopeRowTrailing ( props : {
862+ machine : ReactNode ;
863+ pin : ReactNode ;
864+ settings : ReactNode ;
865+ } ) {
865866 return (
866- < span className = "relative flex shrink-0" >
867- { props . children }
868- { props . isSelected ? (
869- < span className = "pointer-events-none absolute -right-1 -bottom-1 grid size-3 place-items-center rounded-full bg-primary ring-2 ring-popover" >
870- < CheckIcon className = "size-2 text-primary-foreground" strokeWidth = { 4 } aria-hidden />
867+ < span className = "flex shrink-0 items-center" >
868+ { props . pin ?? < span className = "size-7 sm:size-6" /> }
869+ < span className = "flex pointer-fine:grid" >
870+ < span className = "flex size-7 items-center justify-center empty:pointer-coarse:hidden sm:size-6 pointer-fine:col-start-1 pointer-fine:row-start-1 pointer-fine:in-data-highlighted:invisible" >
871+ { props . machine }
872+ </ span >
873+ < span className = "flex pointer-fine:invisible pointer-fine:col-start-1 pointer-fine:row-start-1 pointer-fine:in-data-highlighted:visible" >
874+ { props . settings }
871875 </ span >
872- ) : null }
876+ </ span >
873877 </ span >
874878 ) ;
875879}
@@ -3124,51 +3128,62 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31243128 hideIndicator
31253129 value = { item }
31263130 aria-selected = { isSelected }
3127- // The icon badge marks selection; Base UI's single value would shade one row .
3128- data-selected = { undefined }
3131+ // Base UI marks only its single value; this list can select several .
3132+ data-selected = { isSelected ? "" : undefined }
31293133 onContextMenu = { ( event ) => {
31303134 if ( project ) handleProjectSettings ( event , project ) ;
31313135 } }
31323136 >
3133- < ProjectScopeRowIcon isSelected = { isSelected } >
3134- { project ? (
3135- < ProjectFavicon project = { project } className = "size-4 shrink-0" />
3136- ) : (
3137- < FolderIcon className = "size-4 shrink-0" />
3138- ) }
3139- </ ProjectScopeRowIcon >
3137+ { project ? (
3138+ < ProjectFavicon project = { project } className = "size-4 shrink-0" />
3139+ ) : (
3140+ < FolderIcon className = "size-4 shrink-0" />
3141+ ) }
31403142 < span className = "min-w-0 flex-1 truncate text-sm" > { item . label } </ span >
3141- { project && showProjectEnvironments ? (
3142- < ProjectEnvironmentBadge
3143- group = { project }
3144- primaryEnvironmentId = { primaryEnvironmentId }
3145- machineByEnvironmentId = { environmentMachineById }
3146- />
3147- ) : null }
3148- { project && canPinProject ( project ) ? (
3149- < ProjectPinButton
3150- name = { project . displayName }
3151- pinned = { project . pinned }
3152- shortcutLabel = { shortcutLabelForCommand ( keybindings , "thread.pin" ) }
3153- onToggle = { ( ) => toggleProjectGroupPin ( project ) }
3154- />
3155- ) : null }
31563143 { project ? (
3157- < Button
3158- size = "icon-xs"
3159- variant = "ghost-muted"
3160- tabIndex = { - 1 }
3161- aria-hidden = "true"
3162- title = { `Project settings for ${ project . displayName } ` }
3163- className = { canPinProject ( project ) ? undefined : "ml-auto" }
3164- onPointerDown = { ( event ) => event . stopPropagation ( ) }
3165- onClick = { ( event ) => {
3166- void handleProjectSettings ( event , project ) ;
3167- } }
3168- >
3169- < SettingsIcon className = "size-3.5" />
3170- </ Button >
3171- ) : null }
3144+ < ProjectScopeRowTrailing
3145+ machine = {
3146+ showProjectEnvironments ? (
3147+ < ProjectEnvironmentBadge
3148+ group = { project }
3149+ primaryEnvironmentId = { primaryEnvironmentId }
3150+ machineByEnvironmentId = { environmentMachineById }
3151+ />
3152+ ) : null
3153+ }
3154+ pin = {
3155+ canPinProject ( project ) ? (
3156+ < ProjectPinButton
3157+ name = { project . displayName }
3158+ pinned = { project . pinned }
3159+ shortcutLabel = { shortcutLabelForCommand (
3160+ keybindings ,
3161+ "thread.pin" ,
3162+ ) }
3163+ onToggle = { ( ) => toggleProjectGroupPin ( project ) }
3164+ />
3165+ ) : null
3166+ }
3167+ settings = {
3168+ < Button
3169+ size = "icon-xs"
3170+ variant = "ghost-muted"
3171+ tabIndex = { - 1 }
3172+ aria-hidden = "true"
3173+ title = { `Project settings for ${ project . displayName } ` }
3174+ onPointerDown = { ( event ) => event . stopPropagation ( ) }
3175+ onClick = { ( event ) => {
3176+ void handleProjectSettings ( event , project ) ;
3177+ } }
3178+ >
3179+ < SettingsIcon className = "size-3.5" />
3180+ </ Button >
3181+ }
3182+ />
3183+ ) : (
3184+ // Keeps "All projects" as tall as the project rows.
3185+ < span className = "size-7 shrink-0 sm:size-6" />
3186+ ) }
31723187 </ ComboboxItem >
31733188 ) ;
31743189 } }
0 commit comments