Add sidebar project colors setting#2381
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature (sidebar project colors with interactive color picker) rather than a bug fix or mechanical change. New features with new components and visual behavior warrant human review to validate the design and implementation choices. You can customize Macroscope's approvability policy. Learn more. |
31952ac to
a421492
Compare
|
screenshots pls |
Added to the description. |
a421492 to
ddb5b9f
Compare
Dismissing prior approval to re-evaluate 3de7f17
289c780 to
61b70df
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 61b70df. Configure here.
Adds an opt-in "Sidebar project colors" client setting that tints each visible project group with a muted hue and renders a clickable color dot in the project header for picking a custom color. - New `SidebarProjectColor` literal in `@t3tools/contracts/settings`, plus `sidebarProjectColorizing` toggle and `sidebarProjectColorOverrides` record on `ClientSettings` (and the patch shape). - `sidebarProjectColors.ts` owns the palette → Tailwind class mapping, the FNV-1a auto-color hash, and `buildSidebarProjectColorMap`, which spreads auto-colors across the palette so adjacent projects don't share a hue until the palette is exhausted (with explicit overrides claiming their slot first). - Sidebar renders the row tint on the group `<li>`, hides the vertical guide line under the thread list while colorizing is on, and adds uniform padding to the colored block. - The color dot uses a transparent interior with a saturated hue-matched ring so it visually shows the row's color while only the border carries the identity. Click to open a swatch popover; "Auto" clears the override. - Restore Defaults clears both the toggle and any saved per-project picks. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`autoSidebarProjectColor` and `resolveSidebarProjectColor` weren't used by any production caller — `buildSidebarProjectColorMap` re-implemented the same hash + override-fallback logic inline. Cursor Bugbot flagged the duplication risk. - Remove both exports. - Drop the 5 helper-specific tests (their behaviors are still covered by the builder tests: determinism via "preserves color when later-sorted added", override priority via "records the explicit override", auto fallback via "leaves auto entries with undefined override"). - Replace the spread test with a builder-driven version that asserts the full palette gets used across 24 distinct seeds. - Replace the colliding-seed lookup in the walk-past-overrides test with an `autoColorForSeed` helper that drives the builder with a single project, so the test doesn't depend on the now-removed export. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The per-row reset for "Sidebar project colors" only cleared the toggle, but `changedSettingLabels` also flags the row as changed when overrides exist. That mismatch left orphaned overrides reachable only via a full settings reset. Show the per-row reset whenever either the toggle or the overrides are non-default, and clear both fields together so the row's two pieces of state always reset in lockstep.
The cloud badge for remote-only projects moves from `right-1.5` to `right-7` on `max-sm` and stays visible even on hover, so the color dot's fixed `right-7` position landed on top of it. Shift the dot one slot further left (`max-sm:right-12`) only when a cloud badge is present, so non-remote projects keep the natural position.
61b70df to
d540b27
Compare

Summary
sidebarProjectColorOverrides(record keyed by physical project key, same identity used for grouping overrides). Clicking the color dot opens a swatch popover; "Auto" clears the override.Why
With the default thin-line guide, adjacent project groups visually blend together. Tinting each group with its own muted hue gives a clearer grouping cue, and lets users tag projects they switch between often with distinguishing colors.
Screenshots
Settings toggle (off by default)
Auto assign unique(if available) colors
Manually change the colors from a pre-defined list
UX details
bg-{color}-500/8light /bg-{color}-400/10dark) — same hue as the dot, just heavily muted.p-1padding so it doesn't sit flush against neighbours.Files
packages/contracts/src/settings.ts—SidebarProjectColorliteral + two newClientSettingsfields (and patch entries).apps/web/src/sidebarProjectColors.ts(new) — palette, hash,buildSidebarProjectColorMapwith collision avoidance.apps/web/src/sidebarProjectColors.test.ts(new) — 13 unit tests.apps/web/src/components/Sidebar.tsx—ProjectColorDotcomponent, color identity plumbing, parent-level stable color-select handler.apps/web/src/components/settings/SettingsPanels.tsx— new SettingsRow + restore-defaults wiring.apps/desktop/src/clientPersistence.test.ts,apps/web/src/localApi.test.ts— fixture updates for the two new fields.Test plan
bun fmt/bun lint/bun typecheckpassbun run testforsidebarProjectColors,Sidebar.logic,localApi,clientPersistence🤖 Generated with Claude Code
Note
Medium Risk
Medium risk: touches core sidebar rendering and client settings persistence, which could introduce UI regressions or unexpected re-renders, but changes are local-only and not security-sensitive.
Overview
Adds a new opt-in client setting,
sidebarProjectColorizing, plus persistedsidebarProjectColorOverrides, to tint each sidebar project row and let users pick/clear a per-project color from a palette.Implements stable auto-color assignment with collision avoidance in new
sidebarProjectColors.ts, wires the computed color identities throughSidebar.tsx(row tint/padding, clickable color-dot menu, hides the thread-list border when colorizing is enabled), and updates Settings → General to toggle/reset both the flag and any saved overrides.Updates settings contracts (
SidebarProjectColorliterals + schema/patch fields) and adjusts desktop/web persistence test fixtures; adds unit tests for the color-map builder.Reviewed by Cursor Bugbot for commit d540b27. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add sidebar project color settings with per-project color overrides
sidebarProjectColorizing(boolean) andsidebarProjectColorOverrides(record) toClientSettingsSchemain settings.ts, with defaults of disabled and empty.buildSidebarProjectColorMapin sidebarProjectColors.ts using FNV-1a hashing for stable auto-color assignment and a two-pass algorithm that respects user overrides.ProjectColorDotcomponent to Sidebar.tsx that renders a palette picker per project row, applying tint classes and hiding thread list borders when a color is active.Macroscope summarized d540b27.