Skip to content

Share tab badge rendering with vertical tabs#3034

Merged
sawka merged 3 commits intomainfrom
copilot/update-vtab-badge-display
Mar 11, 2026
Merged

Share tab badge rendering with vertical tabs#3034
sawka merged 3 commits intomainfrom
copilot/update-vtab-badge-display

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

Vertical tabs were still using the older single-badge path and did not honor the newer tab:flagcolor metadata. This updates vtab to use the same badge rendering model as tab, including validated flag-color badges.

  • Shared badge renderer

    • Extract TabBadges from tab.tsx into a shared frontend/app/tab/tabbadges.tsx component.
    • Keep the existing horizontal tab behavior unchanged while making the badge stack reusable by vtab.
  • Vertical tab badge parity

    • Replace the legacy badge icon rendering in vtab.tsx with TabBadges.
    • Support both existing badge callers and the newer badges array shape.
    • Add flagColor support in vtab using the same validateCssColor(...) guard as tab.tsx, so invalid colors are ignored rather than rendered.
  • Preview / regression coverage

    • Update the vtabbar preview to show:
      • multiple badges
      • flag-only tabs
      • mixed badge + flag tabs
    • Add focused vtab coverage for valid and invalid flagColor handling.
  • Example

    const rawFlagColor = tab.flagColor;
    let flagColor: string | null = null;
    if (rawFlagColor) {
        try {
            validateCssColor(rawFlagColor);
            flagColor = rawFlagColor;
        } catch {
            flagColor = null;
        }
    }
    
    <TabBadges badges={badges} flagColor={flagColor} />
  • Screenshot


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 11, 2026

Deploying waveterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: ae934b6
Status: ✅  Deploy successful!
Preview URL: https://810ef855.waveterm.pages.dev
Branch Preview URL: https://copilot-update-vtab-badge-di.waveterm.pages.dev

View logs

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copilot AI changed the title [WIP] Update badge display code in vtab component Share tab badge rendering with vertical tabs Mar 11, 2026
@sawka sawka marked this pull request as ready for review March 11, 2026 21:20
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 11, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • frontend/app/tab/tab.tsx - Removed inline TabBadges, imports from new file
  • frontend/app/tab/tabbadges.tsx - New extracted component with className prop
  • frontend/app/tab/vtab.test.tsx - New test file for badge rendering
  • frontend/app/tab/vtab.tsx - Added badges array and flagColor support
  • frontend/preview/previews/vtabbar.preview.tsx - Updated preview

The PR correctly:

  • Extracts TabBadges to a reusable component
  • Adds multiple badges support (badges[]) while maintaining backward compatibility with single badge
  • Adds flagColor with CSS color validation
  • Includes test coverage for new features

@sawka sawka merged commit 2cf8c26 into main Mar 11, 2026
7 checks passed
@sawka sawka deleted the copilot/update-vtab-badge-display branch March 11, 2026 23:03
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