feat(desktop): add project color customization to v2 sidebar

AV
5mo ago
+125-24

Summary

Ports the project-color feature from the v1 sidebar to the v2 dashboard sidebar (inspired by the project-color-sidebar branch). Users can right-click a project in the v2 sidebar and pick a color from a Set Color submenu; the chosen color tints the project thumbnail's border (and background/text for the letter fallback).

Color is stored client-side only in the existing v2-project-local-meta zustand store (persisted locally) — no server/DB changes, matching the v1 behavior.

Changes

  • v2-project-local-meta store: add color to ProjectMeta + setProjectColor action.
  • v2 sidebar: new "Set Color" submenu (ColorSelector, menu variant) in the project context menu; thread projectColor through the section → row / collapsed content → ProjectThumbnail.
  • ProjectThumbnail (v2): render custom hex color on border + letter fallback.
  • Cleanup: extracted the duplicated hexToRgba / isCustomProjectColor helpers into shared/constants/project-colors.ts and refactored both the v1 and v2 thumbnails to consume them (removes a pre-existing copy).

Test Plan

  • Right-click a project in the v2 sidebar → Set Color → pick a color; thumbnail border/letter tints accordingly.
  • Color persists across app reloads.
  • Selecting the default option clears the custom color.
  • Collapsed sidebar thumbnail reflects the color.
  • bun run lint clean, typecheck passes, existing colors + v1 thumbnail tests pass.

Open in Stage

Summary by cubic

Adds project color customization to the v2 dashboard sidebar. Right‑click a project to Set Color (includes Default to reset); thumbnails tint accordingly and choices persist locally with no server changes.

  • New Features

    • Add “Set Color” submenu in the project context menu using ColorSelector (menu variant) with includeDefault.
    • Thread projectColor through collapsed and expanded views to ProjectThumbnail; apply color to border and letter fallback.
    • Persist per‑project color in v2-project-local-meta via setProjectColor (clearing sets PROJECT_COLOR_DEFAULT).
  • Refactors

    • Make project color non‑nullable in v2-project-local-meta, defaulting to PROJECT_COLOR_DEFAULT.
    • Move hexToRgba and isCustomProjectColor to shared/constants/project-colors.ts; v1 and v2 thumbnails use them.

Summary by CodeRabbit

  • New Features
    • Project color customization: "Set Color" added to project context menus with a color selector (includes a Default option).
    • Colors persist locally and are applied to project thumbnails in both collapsed and expanded sidebar views.
    • Thumbnails now render custom colors (border, background, text) for consistent visuals and improved contrast.
    • Color choices are reflected immediately across sidebar and thumbnail displays.