Refine light-mode sidebar surfaces #4268
Mergedjuliusmarmingemerged 25 commits into
main fromrefs/pull/4268/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx line 428Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -239,0 +331,21 @@331+ if (!threadListV2Enabled) return { items: [], hiddenSettledCount: 0 };332+ return buildThreadListV2Items({333+ threads: threads.filter((thread) => thread.archivedAt === null),334+ environmentId: options.selectedEnvironmentId,335+ searchQuery: props.searchQuery,336+ changeRequestStateByKey,337+ settlementEnvironmentIds,338+ settledLimit: settledVisibleCount,339+ now: `${nowMinute}:00.000Z`,340+ });341+ }, [342+ changeRequestStateByKey,343+ nowMinute,344+ options.selectedEnvironmentId,345+ props.searchQuery,346+ settledVisibleCount,347+ settlementEnvironmentIds,348+ threadListV2Enabled,349+ threads,350+ ]);351+ const listItems = useMemo<readonly SidebarListItem[]>(() => {
- apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx line 366OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -239,0 +346,21 @@346+ settledVisibleCount,347+ settlementEnvironmentIds,348+ threadListV2Enabled,349+ threads,350+ ]);351+ const listItems = useMemo<readonly SidebarListItem[]>(() => {352+ if (!threadListV2Enabled) return listLayout.items;353+ const items: SidebarListItem[] = threadListV2Layout.items.map((item) => ({354+ type: "v2-thread" as const,355+ key: scopedThreadKey(item.thread.environmentId, item.thread.id),356+ item,357+ }));358+ if (threadListV2Layout.hiddenSettledCount > 0) {359+ items.push({360+ type: "v2-show-more",361+ key: "v2-show-more",362+ hiddenCount: threadListV2Layout.hiddenSettledCount,363+ });364+ }365+ return items;366+ }, [listLayout.items, threadListV2Enabled, threadListV2Layout]);apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx line 416Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -239,0 +320,21 @@320+ const serverConfigs = useAtomValue(environmentServerConfigsAtom);321+ const settlementEnvironmentIds = useMemo(() => {322+ const supported = new Set<EnvironmentId>();323+ for (const [environmentId, config] of serverConfigs) {324+ if (config.environment.capabilities.threadSettlement === true) {325+ supported.add(environmentId);326+ }327+ }328+ return supported;329+ }, [serverConfigs]);330+ const threadListV2Layout = useMemo(() => {331+ if (!threadListV2Enabled) return { items: [], hiddenSettledCount: 0 };332+ return buildThreadListV2Items({333+ threads: threads.filter((thread) => thread.archivedAt === null),334+ environmentId: options.selectedEnvironmentId,335+ searchQuery: props.searchQuery,336+ changeRequestStateByKey,337+ settlementEnvironmentIds,338+ settledLimit: settledVisibleCount,339+ now: `${nowMinute}:00.000Z`,340+ });apps/mobile/src/features/home/HomeScreen.tsx line 510Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -535,3 +543,4 @@535543 projectCwdByKey,536544 props.onArchiveThread,537545 props.onSelectThread,546+ props.savedConnectionsById,
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- @@ -59,8 +66,20 @@5966 return checked ? ("on" as const) : undefined;6067 }616869+/** Thread List v2 lays the list out in fixed creation order, so the70+ sort/group filter controls would be silently ignored — hide them and71+ key the "customized" icon state off the environment filter alone. */72+function useThreadListV2FilterGate() {73+ const preferencesResult = useAtomValue(mobilePreferencesAtom);74+ return (75+ AsyncResult.isSuccess(preferencesResult) && preferencesResult.value.threadListV2Enabled === true76+ );77+}78+6279 function AndroidHomeHeader(props: HomeHeaderProps) {6380 const insets = useSafeAreaInsets();6481 const iconColor = useThemeColor("--color-icon");6582 const mutedColor = useThemeColor("--color-foreground-muted");66- const hasCustomListOptions = hasCustomHomeListOptions(props);83+ const threadListV2Enabled = useThreadListV2FilterGate();84+ const hasCustomListOptions = threadListV2Enabled85+ ? props.selectedEnvironmentId !== null || props.selectedProjectKey !== null@@ -365,4 +407,5 @@365407 return map;366408 }, [props.projects]);367409368- const [v2ProjectScopeKey, setV2ProjectScopeKey] = useState<string | null>(null);410+ const v2ProjectScopeKey = props.selectedProjectKey;411+ const setV2ProjectScopeKey = props.onProjectChange;
- apps/mobile/src/features/home/HomeScreen.tsx line 735Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -758,3 +805,8 @@758805 const listEmpty = !hasResults ? (759806 hasSearchQuery ? (760807 <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />808+ ) : scopedProject !== null ? (809+ <EmptyState810+ title={`No threads in ${scopedProject.title}`}811+ detail="Choose another project or create a new task."812+ />
- apps/mobile/src/features/home/HomeHeader.tsx line 457Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -368,0 +437,21 @@437+ <NativeHeaderToolbar.Menu title="Project">438+ <NativeHeaderToolbar.Label>Project</NativeHeaderToolbar.Label>439+ <NativeHeaderToolbar.MenuAction440+ isOn={props.selectedProjectKey === null}441+ onPress={() => props.onProjectChange(null)}442+ subtitle="Show threads from every project"443+ >444+ <NativeHeaderToolbar.Label>All projects</NativeHeaderToolbar.Label>445+ </NativeHeaderToolbar.MenuAction>446+ {props.projects.map((project) => (447+ <NativeHeaderToolbar.MenuAction448+ key={project.key}449+ isOn={props.selectedProjectKey === project.key}450+ onPress={() => props.onProjectChange(project.key)}451+ >452+ <NativeHeaderToolbar.Label>{project.label}</NativeHeaderToolbar.Label>453+ </NativeHeaderToolbar.MenuAction>454+ ))}455+ </NativeHeaderToolbar.Menu>456+ ) : null}457+apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx line 250Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -195,0 +230,21 @@230+ projects231+ .filter(232+ (project) =>233+ options.selectedEnvironmentId === null ||234+ project.environmentId === options.selectedEnvironmentId,235+ )236+ .map((project) => ({237+ key: scopedProjectKey(project.environmentId, project.id),238+ label: project.title,239+ })),240+ [options.selectedEnvironmentId, projects],241+ );242+ const selectedProject = useMemo(243+ () =>244+ selectedProjectKey === null245+ ? null246+ : (projects.find(247+ (project) => scopedProjectKey(project.environmentId, project.id) === selectedProjectKey,248+ ) ?? null),249+ [projects, selectedProjectKey],250+ );
- apps/web/src/components/SidebarV2.tsx line 477OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -465,9 +468,10 @@465468 tabIndex={0}466469 data-testid="sidebar-v2-row-card"467470 className={cn(468- // Every card carries a faint tonal fill so threads read as469- // discrete objects; active/selected/hover are brighter tones of470- // the same treatment rather than a different shape.471+ // Light cards are white objects lifted off the zinc rail. The active472+ // thread deliberately gets a blue selection surface and leading rail:473+ // a slightly darker white card was too easy to lose in a light474+ // sidebar. Dark mode keeps its graphite selection treatment.471475 "group/v2-row relative w-full cursor-pointer select-none overflow-hidden rounded-lg text-left transition-colors",472476 props.isActive473- ? "bg-foreground/[0.11] text-foreground dark:bg-white/[0.11]"477+ ? "bg-primary/[0.12] text-foreground shadow-sm ring-1 ring-inset ring-primary/45 before:absolute before:inset-y-2 before:left-0 before:w-1 before:rounded-r-full before:bg-primary dark:bg-white/[0.11] dark:shadow-none dark:ring-0 dark:before:bg-primary"apps/web/src/components/SidebarV2.tsx line 477OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -465,9 +468,10 @@465468 tabIndex={0}466469 data-testid="sidebar-v2-row-card"467470 className={cn(468- // Every card carries a faint tonal fill so threads read as469- // discrete objects; active/selected/hover are brighter tones of470- // the same treatment rather than a different shape.471+ // Light cards are white objects lifted off the zinc rail. The active472+ // thread deliberately gets a blue selection surface and leading rail:473+ // a slightly darker white card was too easy to lose in a light474+ // sidebar. Dark mode keeps its graphite selection treatment.471475 "group/v2-row relative w-full cursor-pointer select-none overflow-hidden rounded-lg text-left transition-colors",472476 props.isActive473- ? "bg-foreground/[0.11] text-foreground dark:bg-white/[0.11]"477+ ? "bg-primary/[0.12] text-foreground shadow-sm ring-1 ring-inset ring-primary/45 before:absolute before:inset-y-2 before:left-0 before:w-1 before:rounded-r-full before:bg-primary dark:bg-white/[0.11] dark:shadow-none dark:ring-0 dark:before:bg-primary"
- @@ -312,10 +315,16 @@312315 [openPrLink, pr],313316 );314317315- const rowClassName = cn(316- "group/v2-row relative w-full cursor-pointer select-none rounded-md text-left",318+ // All Sidebar V2 rows share one surface model. Live threads used to look319+ // like elevated cards while settled threads were plain rows, leaving neither320+ // a useful hierarchy nor a reliable hover cue. Status now lives in the row321+ // content; surface is reserved for interaction (hover, multi-select, route).322+ const rowSurfaceClassName = cn(323+ "group/v2-row relative w-full cursor-pointer select-none overflow-hidden rounded-md text-left outline-none transition-[background-color,color,box-shadow] duration-150",317324 props.isActive318- ? "bg-foreground/[0.11] text-foreground dark:bg-white/[0.11]"325+ ? "bg-accent text-foreground before:absolute before:inset-y-1.5 before:left-0 before:w-1 before:rounded-r-full before:bg-primary"319326 : isSelected320- ? "bg-foreground/[0.07] text-foreground dark:bg-white/[0.07]"321- : "hover:bg-accent/65",327+ ? "bg-muted text-foreground"328+ : shouldRecede329+ ? "text-muted-foreground/75 hover:bg-muted hover:text-foreground"330+ : "bg-transparent text-foreground hover:bg-muted",
- @@ -116,0 +174,21 @@174+ <div className="grid gap-2 text-xs text-muted-foreground">175+ {projectTitle ? (176+ <div className="flex min-w-0 items-start gap-2">177+ <ProjectFavicon178+ environmentId={thread.environmentId}179+ cwd={projectCwd ?? ""}180+ className="size-4 shrink-0"181+ />182+ <div className="min-w-0 flex-1 wrap-break-word text-foreground/90">183+ {projectTitle}184+ </div>185+ </div>186+ ) : null}187+ {environmentLabel ? (188+ <div className="flex min-w-0 items-start gap-2">189+ <ServerIcon className="size-4 shrink-0 stroke-muted-foreground" />190+ <div className="min-w-0 flex-1 wrap-break-word text-foreground/90">191+ {environmentLabel}192+ </div>193+ </div>194+ ) : null}
- apps/web/src/index.css line 501Outdated@@ -484,20 +501 @@484- --input: oklch(0.62 0.03 265 / 28%);485- --sidebar-stage-fade: var(--card);486- background-color: var(--card);487-}488-489-.dark .app-sidebar {490- --background: #000;491- --foreground: #f1f3f7;492- --card: #000;493- --card-foreground: var(--foreground);494- --accent: #191a1d;495- --accent-foreground: #f7f9ff;496- --muted: #0a0a0a;497- --muted-foreground: #a3a3a3;498- --border: rgb(255 255 255 / 14%);499- --input: rgb(255 255 255 / 18%);500- /* The stage-channel header art must ramp to THIS panel's surface, not the501- global chrome background, or the fade shows a seam (same rule as the502- light palette above). */503- --sidebar-stage-fade: var(--card);501+[data-sidebar-version="v2"] {
- @@ -52,3 +56,15 @@5256 readonly initialQuery?: string;5357 }545859+export function enumerateCommandPaletteItems(60+ items: ReadonlyArray<CommandPaletteActionItem>,61+): CommandPaletteActionItem[] {62+ return items.map((item, index) => {63+ const shortcutCommand = THREAD_JUMP_KEYBINDING_COMMANDS[index];64+ if (shortcutCommand) return { ...item, shortcutCommand };65+66+ const { shortcutCommand: _shortcutCommand, ...itemWithoutShortcut } = item;67+ return itemWithoutShortcut;68+ });69+}70+
- @@ -413,13 +421,14 @@421+ width: circleSize,413422 },414423 iconStyle,415424 ]}416425 >417- <SymbolView418- name={props.icon}419- size={ACTION_ICON_SIZE}420- tintColor="#ffffff"421- type="monochrome"422- />426+ <SymbolView name={props.icon} size={iconSize} tintColor="#ffffff" type="monochrome" />423427 </Animated.View>424428 </View>425- <Animated.View style={[{ paddingTop: 2 }, labelStyle]}>429+ <Animated.View430+ style={[431+ { height: 14, justifyContent: "center", paddingTop: props.compact ? 0 : 2 },432+ labelStyle,433+ ]}434+ >
juliusmarminge merged this593289c
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
d68af14d-e868-43be-917b-f7d5fe705cadYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.