Skip to content

Extract ActivityCard model colors to lib/constants/model-colors.ts#143

Open
ohong wants to merge 1 commit into
mainfrom
oh-nightly/model-colors-constants
Open

Extract ActivityCard model colors to lib/constants/model-colors.ts#143
ohong wants to merge 1 commit into
mainfrom
oh-nightly/model-colors-constants

Conversation

@ohong

@ohong ohong commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Roadmap item ("UX Polish" → "Model colors outside design system"): ActivityCard.tsx used hardcoded hex colors inline for model chips. Extracted them to apps/web/lib/constants/model-colors.ts as MODEL_COLOR_PATTERNS (ordered pattern→color list) and MODEL_COLOR_FALLBACK_PALETTE (hash-based fallback palette), matching the existing lib/constants/regions.ts convention.

Pure refactor — same colors, same match order, no behavior change.

Changes

  • apps/web/lib/constants/model-colors.ts — new file with the extracted constants.
  • apps/web/components/app/feed/ActivityCard.tsxmodelColor() now iterates MODEL_COLOR_PATTERNS and falls back to MODEL_COLOR_FALLBACK_PALETTE.
  • docs/CHANGELOG.md — entry under Unreleased/Changed.
  • docs/ROADMAP.md — removed the now-completed item.

Test plan

  • bun run lint — clean
  • bun run typecheck — clean
  • bun run test — 646/646 web tests pass, 199/199 CLI tests pass (unaffected)

Generated by Claude Code

Summary by CodeRabbit

  • Refactor
    • Improved how model-specific colors are assigned in activity feeds, keeping the same appearance while making color handling more consistent.
  • Documentation
    • Updated release notes and roadmap entries to reflect the color-handling cleanup.

Pure refactor per the ROADMAP "Model colors outside design system" item —
same colors, same match order, no behavior change.
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
straude Ready Ready Preview, Comment Jul 8, 2026 8:47am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: be0577e3-9f38-4bf2-9abb-9256ef5153ba

📥 Commits

Reviewing files that changed from the base of the PR and between 21ff2f4 and 6c27bf1.

📒 Files selected for processing (4)
  • apps/web/components/app/feed/ActivityCard.tsx
  • apps/web/lib/constants/model-colors.ts
  • docs/CHANGELOG.md
  • docs/ROADMAP.md
💤 Files with no reviewable changes (1)
  • docs/ROADMAP.md

📝 Walkthrough

Walkthrough

Model chip color logic previously hardcoded in ActivityCard's modelColor function has been extracted into a new constants module (model-colors.ts) exporting MODEL_COLOR_PATTERNS and MODEL_COLOR_FALLBACK_PALETTE. ActivityCard now imports and uses these constants. CHANGELOG and ROADMAP docs updated accordingly.

Changes

Model Color Extraction

Layer / File(s) Summary
Model color constants module
apps/web/lib/constants/model-colors.ts
New module exports MODEL_COLOR_FALLBACK_PALETTE and MODEL_COLOR_PATTERNS regex-to-color pairs for known model families.
ActivityCard modelColor refactor
apps/web/components/app/feed/ActivityCard.tsx
Imports new constants and replaces hardcoded regex checks with a loop over MODEL_COLOR_PATTERNS, falling back to a hashed index into MODEL_COLOR_FALLBACK_PALETTE.
Docs updates
docs/CHANGELOG.md, docs/ROADMAP.md
Changelog records the extraction with no visual change; roadmap removes the corresponding deferred item.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • ohong/straude#131: Also modifies ActivityCard's modelColor logic, adding support for a new "Claude Fable" model tier and color.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main refactor: moving ActivityCard model colors into a shared constants module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch oh-nightly/model-colors-constants

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ohong ohong mentioned this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants