Skip to content

refactor(tags): build tag on chip and look its colour up - #8689

Open
talissoncosta wants to merge 4 commits into
03-tag-iconsfrom
05-tag-on-chip
Open

talissoncosta wants to merge 4 commits into
03-tag-iconsfrom
05-tag-on-chip

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #8465

3/3, splitting #8613. Stacked on #8687.

A tag's colour was computed from the hex on the record: an 8% tint for the fill, the same hue darkened for the text. Contrast was therefore a function of whichever colour a user picked, and most of the palette failed AA.

A tag now looks its colour up. The stored hex maps onto a Content swatch, and the matching tag-<hue> utility carries the fill and the ink together so the two cannot drift. Every colour a tag can already hold maps onto a swatch, so nothing migrates.

  • Custom tags: a palette tint with near-black ink, every one clearing AA against it, enforced by a test.
  • System tags (Stale, Unhealthy, PR, Issue): the muted surface with a coloured icon, so the state is carried by the icon rather than the fill.

Also here:

  • Chip gains a colour prop. A chip takes its colour from variant or from colour, never both, and a union enforces it: variant is a pairing the design system chose, colour is a hue the data picked. It also gains aria-label and aria-pressed, so a chip with no text is named and a filter chip announces whether it is on.
  • Utils.tagVisible joins tagDisabled, so the unhealthy rule is written once rather than three times. That closes a gap where TagFilter showed unhealthy tags to organisations without Feature Health.
  • Tag moves to its own folder with the helpers under utils. ToggleChip was doing the computing, so it goes with its last consumer.
  • TagType gains GITHUB and GITLAB, mirroring api/projects/tags/models.py.

The tag picker and the panel are deliberately not in this stack: their container is one of the eleven InlineModal sites due to be rebuilt on the floating layer, so reworking them now means doing it twice.

Four commits, each compiling on its own: the helpers, the Chip additions, the
migration, then the environment banner picker, which rendered a Tag to show a
colour and so collapsed its thirteen options onto nine swatches.

How did you test this code?

Typecheck 884 against main's 890, none added. npm run test:unit passes: tagSwatch.test.ts pins every colour a tag can hold to its swatch, tagSwatches.test.ts asserts every tint clears AA. npm run bundle compiles — worth running, since the diff deletes ToggleChip and moves Tag.tsx, and tsc does not resolve .scss imports.

In the app, in light and dark:

  1. Features list: custom tags are a pale tint with dark text and no visible border
  2. System tags sit on the muted surface, each keeping its icon: Stale, Unhealthy, PR Open/Draft/Merged/Closed/Dequeued, Issue Open/Closed
  3. A permanent tag shows the padlock, sized against the label rather than over it
  4. In a feature's tag panel, select and deselect a tag: the checkbox fills with a stronger version of that tag's own colour
  5. The tag row above the panel has no checkboxes, since every tag there is already assigned
  6. Filter the features list by tag, including several at once
  7. Without Feature Health, no unhealthy tag appears in any list
  8. Without Stale Flags, a stale tag is faded once rather than twice and cannot be picked
  9. Environment settings: the banner colour swatches still pick a colour

@talissoncosta
talissoncosta requested a review from a team as a code owner October 6, 2026 14:21
@talissoncosta
talissoncosta requested review from kyle-ssg and removed request for a team October 6, 2026 14:21
@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
flagsmith-frontend-preview Ready Ready Preview Oct 7, 2026 9:39pm UTC
flagsmith-frontend-staging Ready Ready Preview Oct 7, 2026 9:39pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
docs Ignored Ignored Preview Oct 7, 2026 9:39pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 61a7d145-ada9-4186-b26d-4dcd2eb28999

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions github-actions Bot added front-end Issue related to the React Front End Dashboard refactor labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-8689 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-8689 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-8689 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith:pr-8689 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8689 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith-frontend:pr-8689 Finished ✅ Results ✅

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-16 — run #21394 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.4 seconds
commit  00e7bb7
info  🔄 Run: #21394 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #21394 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  38.4 seconds
commit  00e7bb7
info  🔄 Run: #21394 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #21394 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  20 passed
skipped  2 skipped

Details

stats  22 tests across 14 suites
duration  1 minute, 12 seconds
commit  00e7bb7
info  🔄 Run: #21394 (attempt 1)

Skipped tests

firefox › tests/flag-dependencies-test.pw.ts › Flag Dependencies › A flag can be gated behind another, and says so on both sides @oss
firefox › tests/onboarding-tests.pw.ts › Onboarding › New user connects via the single-page onboarding flow @oss

✅ oss · depot-ubuntu-latest-arm-16 — run #21394 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.6 seconds
commit  00e7bb7
info  🔄 Run: #21394 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #21392 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  35.8 seconds
commit  6a4cb00
info  🔄 Run: #21392 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #21392 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  36.8 seconds
commit  6a4cb00
info  🔄 Run: #21392 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #21392 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  31.1 seconds
commit  6a4cb00
info  🔄 Run: #21392 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #21392 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  35.4 seconds
commit  6a4cb00
info  🔄 Run: #21392 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #21390 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  59 seconds
commit  48a0931
info  🔄 Run: #21390 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #21388 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 8 seconds
commit  f9d2f9a
info  🔄 Run: #21388 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #21390 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  32.9 seconds
commit  48a0931
info  🔄 Run: #21390 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #21388 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  54.9 seconds
commit  f9d2f9a
info  🔄 Run: #21388 (attempt 1)

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Visual Regression

20 screenshots compared. See report for details.
View full report

@talissoncosta

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

@github-actions github-actions Bot added refactor and removed refactor labels Oct 7, 2026
@talissoncosta
talissoncosta changed the base branch from 04-chip-colour-and-selected to 03-tag-icons October 7, 2026 01:16
@github-actions github-actions Bot added refactor and removed refactor labels Oct 7, 2026
@github-actions github-actions Bot added refactor and removed refactor labels Oct 7, 2026
@github-actions github-actions Bot added refactor and removed refactor labels Oct 7, 2026
@github-actions github-actions Bot added refactor and removed refactor labels Oct 7, 2026
talissoncosta and others added 4 commits October 7, 2026 15:19
Three things the tag rework needs, with nothing consuming them yet.

tagSwatch maps a stored hex onto a palette swatch, carrying a table of
the colours tags already hold so none of them migrates. systemTag says
whether a tag was applied by us rather than picked. tagChipHtml renders
the same chip as a string, for the tooltip that cannot take JSX.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A 'none' variant, where the colour comes in through className rather than
from the variant table: a tag's colour is a user's decorative choice, not
a semantic role.

The border reads from a custom property so that colour can carry it too.
This stylesheet is injected at runtime, after the token utilities, so a
directly set border would beat whatever a utility puts on the element.

aria-label, for a chip whose content cannot name it, such as a bare
colour swatch. ColorSwatch takes an optional colour for the same reason:
a partial tag may not have one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Tag took the hex stored on the record and computed a fill and a text
colour from it, so contrast was a function of whichever hue a user
picked. It now looks the hex up in the palette and applies the utility
that carries fill and ink together. TagContent loses the same maths, and
ToggleChip, which was doing the computing, goes with its last consumer.

Tag moves to its own folder, and its consumers move to the new signature
here so none is left half-migrated. Utils gains tagVisible beside
tagDisabled: Tag no longer reads feature flags to decide what it may be,
and the unhealthy rule is written once rather than three times.

TagType gains GITHUB and GITLAB, mirroring the API.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The banner colour is not a tag, but the picker rendered one, so its thirteen
colours went through the swatch lookup and collapsed onto nine: four pairs
became indistinguishable, and picking either of a pair looked the same.

It draws a ColorSwatch inside a BareButton instead, so each colour renders as
itself. The tick takes whichever of the ink or the pale tint reads on that
colour, since neither clears 3:1 against all thirteen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
Preview – flagsmith-frontend-staging — 00e7bb76 Deployed Oct 7, 2026 by vercel[bot]
Preview – flagsmith-frontend-preview — 00e7bb76 Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

front-end Issue related to the React Front End Dashboard refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants