Skip to content

fix: replace hand-rolled badges with DS::Pill in admin users view#1988

Open
Kelvinchen03 wants to merge 1 commit into
we-promise:mainfrom
Kelvinchen03:fix/ds-pill-admin-users-badges
Open

fix: replace hand-rolled badges with DS::Pill in admin users view#1988
Kelvinchen03 wants to merge 1 commit into
we-promise:mainfrom
Kelvinchen03:fix/ds-pill-admin-users-badges

Conversation

@Kelvinchen03
Copy link
Copy Markdown

@Kelvinchen03 Kelvinchen03 commented May 25, 2026

Summary

This PR fixes DS Drift Patrol violation #1978 by replacing 5 hand-rolled badge <span> elements in app/views/admin/users/index.html.erb with the standard DS::Pill component.

Changes Made

Location Before After
Subscription status (active) Custom span with bg-success/10 text-success DS::Pill with tone: :success
Subscription status (inactive) Custom span with bg-surface text-secondary DS::Pill with tone: :neutral
Guest role description Custom span with bg-surface text-primary DS::Pill with tone: :neutral
Member role description Custom span with bg-surface text-primary DS::Pill with tone: :neutral
Admin role description Custom span with bg-surface text-primary DS::Pill with tone: :neutral
Super Admin role description Custom span with bg-success/10 text-success DS::Pill with tone: :success

Why This Change?

Related Issues

Fixes #1978

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation (if needed)
  • My changes generate no new warnings
  • This change resolves the DS Drift Patrol violation

Summary by CodeRabbit

  • Style
    • Standardized the appearance of subscription status and user role badges in the admin users view for improved visual consistency.

Review Change Stack

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. and removed not-gittensor labels May 25, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

This PR migrates inline badge markup in the admin users index view to the DS::Pill component. The subscription status badge and role description labels are replaced with semantic tone mappings: active status and super_admin role use :success tone, while others use :neutral.

Changes

Badge Migration to DS::Pill

Layer / File(s) Summary
Replace subscription status and role badges with DS::Pill
app/views/admin/users/index.html.erb
Subscription status badge (line 77) now renders via DS::Pill with tone mapped from sub.active?. Role description labels for guest/member/admin/super_admin (lines 191–203) are replaced with DS::Pill, assigning :neutral tone for most roles and :success tone for super_admin.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

Possibly related PRs

  • we-promise/sure#1939: Parallel migration of badge markup to DS::Pill in transactions views.
  • we-promise/sure#1955: Previous changes to the same file and badge styling in subscription status and role sections.
  • we-promise/sure#1902: Introduces the semantic tone and badge-mode enhancements to DS::Pill that this PR directly depends on.

Suggested labels

contributor:verified, pr:verified

Suggested reviewers

  • jjmata

Poem

🐰 A pill for each badge, a semantic delight,
Guest, member, admin—now all rendered right!
Success shines green, neutral stands calm,
DS::Pill brings order, a refactoring balm. ✨

🚥 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 PR title clearly and concisely describes the main change: replacing hand-rolled badge markup with the DS::Pill component in the admin users view.
Linked Issues check ✅ Passed The PR successfully replaces all five hand-rolled badge spans with DS::Pill components, mapping semantic colors to appropriate tones (success for active/super_admin, neutral for inactive/other roles), directly addressing issue #1978.
Out of Scope Changes check ✅ Passed All changes in the PR are scoped to replacing hand-rolled badges with DS::Pill in the admin users index view, directly aligned with the linked issue #1978 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@superagent-security superagent-security Bot added the pr:verified PR passed security analysis. label May 25, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90ae95a2fe

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

<%= sub.active? ? "bg-success/10 text-success" : "bg-surface text-secondary" %>">
<%= sub.status.humanize %>
</span>
<%= render DS::Pill.new(label: sub.status.humanize, tone: sub.active? ? :success : :neutral) %>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render pills in badge mode for role/status labels

DS::Pill defaults to marker mode (marker: true) with a visible dot (show_dot: true), but these replacements are for plain badges that previously rendered normal-case text without a dot. As written, labels like subscription status and role names now render as marker chips (uppercase styling + dot), which is a visible regression from the prior UI and inconsistent with existing badge usages that pass marker: false (and often show_dot: false).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/views/admin/users/index.html.erb`:
- Line 77: DS::Pill instances used for status/role badges are rendered with the
default marker=true causing marker/chip styling; update each render of DS::Pill
(e.g., render DS::Pill.new(label: sub.status.humanize, tone: sub.active? ?
:success : :neutral) and the similar role/status pill renders later) to pass
marker: false so they use badge mode (e.g., DS::Pill.new(..., marker: false));
keep other props (label, tone) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a9b2bb68-3ba9-4ea1-841a-1b1af93c205c

📥 Commits

Reviewing files that changed from the base of the PR and between d8a12ad and 90ae95a.

📒 Files selected for processing (1)
  • app/views/admin/users/index.html.erb

<%= sub.active? ? "bg-success/10 text-success" : "bg-surface text-secondary" %>">
<%= sub.status.humanize %>
</span>
<%= render DS::Pill.new(label: sub.status.humanize, tone: sub.active? ? :success : :neutral) %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use badge mode for these pills (marker: false) to avoid marker/chip styling regression.

At Line 77 and Lines 191-203, DS::Pill is rendered with defaults, which means marker: true (uppercase, rounded-md, sub-12px marker chrome). These are status/role badges and should use badge mode.

Proposed patch
-<%= render DS::Pill.new(label: sub.status.humanize, tone: sub.active? ? :success : :neutral) %>
+<%= render DS::Pill.new(label: sub.status.humanize, tone: sub.active? ? :success : :neutral, marker: false, size: :sm) %>

-<%= render DS::Pill.new(label: t(".roles.guest"), tone: :neutral) %>
+<%= render DS::Pill.new(label: t(".roles.guest"), tone: :neutral, marker: false, size: :sm) %>

-<%= render DS::Pill.new(label: t(".roles.member"), tone: :neutral) %>
+<%= render DS::Pill.new(label: t(".roles.member"), tone: :neutral, marker: false, size: :sm) %>

-<%= render DS::Pill.new(label: t(".roles.admin"), tone: :neutral) %>
+<%= render DS::Pill.new(label: t(".roles.admin"), tone: :neutral, marker: false, size: :sm) %>

-<%= render DS::Pill.new(label: t(".roles.super_admin"), tone: :success) %>
+<%= render DS::Pill.new(label: t(".roles.super_admin"), tone: :success, marker: false, size: :sm) %>

Also applies to: 191-191, 195-195, 199-199, 203-203

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/views/admin/users/index.html.erb` at line 77, DS::Pill instances used for
status/role badges are rendered with the default marker=true causing marker/chip
styling; update each render of DS::Pill (e.g., render DS::Pill.new(label:
sub.status.humanize, tone: sub.active? ? :success : :neutral) and the similar
role/status pill renders later) to pass marker: false so they use badge mode
(e.g., DS::Pill.new(..., marker: false)); keep other props (label, tone)
unchanged.

Copy link
Copy Markdown
Collaborator

jjmata commented May 26, 2026

Clean substitution. One small thing: the hand-rolled spans all had shrink-0 to prevent the badge from being squished in a flex row. If DS::Pill doesn't apply shrink-0 by default, the role-description pills (which sit alongside a <p> in a flex items-start gap-3 container) may wrap or compress unexpectedly. Worth a visual check in the role descriptions section.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DS Drift Patrol — week of 2026-05-19 (merged-to-main violations)

2 participants