[PR #5930] [MERGED] fix(frontend): stabilize speed tags on inbound and client pages #6031

Closed
opened 2026-11-02 04:05:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5930
Author: @H-TTTTT
Created: 7/13/2026
Status: ✅ Merged
Merged: 7/14/2026
Merged by: @MHSanaei

Base: main ← Head: fix/5912-stable-speed-tags


📝 Commits (4)

  • 009b6d2 fix(frontend): add shared stable speed-tag style
  • 0041910 fix(frontend): stabilize InboundSpeedTag and ClientSpeedTag layout
  • 8dcb429 fix(frontend): align speed columns with stable tag width
  • f07b622 fix(frontend): scope stable speed tags to table cells and fit content

📊 Changes

6 files changed (+131 additions, -10 deletions)

View changed files

📝 frontend/src/components/clients/ClientSpeedTag.tsx (+8 -2)
➕ frontend/src/components/utility/speedTagStyle.ts (+21 -0)
📝 frontend/src/pages/clients/ClientsPage.tsx (+6 -3)
📝 frontend/src/pages/inbounds/list/InboundSpeedTag.tsx (+8 -2)
📝 frontend/src/pages/inbounds/list/useInboundColumns.tsx (+4 -3)
➕ frontend/src/test/speed-tag-stable.test.tsx (+84 -0)

📄 Description

Summary

Fixes live Speed-column layout jitter when upload/download rates change length (B/KB/MB digit boundaries).

  • Shared speed-tag style: fixed 148px width, centered content, nowrap, tabular-nums
  • Applied to both InboundSpeedTag and ClientSpeedTag
  • Idle dash cells use the same stable style so active/idle swaps do not reflow
  • Speed column width aligned to 160 on inbound and client tables
  • Focused component tests lock the shared class/style contract for small and large rates

Fixes #5912

Verification

RED → GREEN (TDD)

RED (before applying style to tags):

FAIL  components  src/test/speed-tag-stable.test.tsx (3 failed)
  × ClientSpeedTag keeps the same stable class/style for small and large rates
  × InboundSpeedTag keeps the same stable class/style for small and large rates
  × both tags share the same stable style contract and column width constant
AssertionError: expected false to be true  (classList.contains('speed-tag'))

GREEN (after fix):

✓ components  src/test/speed-tag-stable.test.tsx (3 tests)
  ✓ ClientSpeedTag keeps the same stable class/style for small and large rates
  ✓ InboundSpeedTag keeps the same stable class/style for small and large rates
  ✓ both tags share the same stable style contract and column width constant

Commands

Command Result
npm test -- --project components src/test/speed-tag-stable.test.tsx pass (3/3)
npm run typecheck pass
npm run lint pass
npm run build pass

Visual / width evidence

Full panel UI needs an authenticated backend + live traffic, so widths were measured with a Chrome headless harness using the same shared style as the tags:

Case Text Measured width
idle — 148.00px
small ↑ 512 B/s / ↓ 1023 B/s 148.00px
medium ↑ 1.38 MB/s / ↓ 8.49 MB/s 148.00px
large ↑ 11.77 MB/s / ↓ 95.36 MB/s 148.00px

stable=true, style.width=148px, column width constant 160.

Non-goals

  • No formatter / polling / business-logic changes
  • No redesign of inbound/client pages
  • No new dependencies or DESIGN.md
  • Tooltip, sorting, and client-card placement preserved

Changed files

  • frontend/src/components/utility/speedTagStyle.ts (new)
  • frontend/src/styles/utils.css
  • frontend/src/components/clients/ClientSpeedTag.tsx
  • frontend/src/pages/inbounds/list/InboundSpeedTag.tsx
  • frontend/src/pages/inbounds/list/useInboundColumns.tsx
  • frontend/src/pages/clients/ClientsPage.tsx
  • frontend/src/test/speed-tag-stable.test.tsx (new)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5930 **Author:** [@H-TTTTT](https://github.com/H-TTTTT) **Created:** 7/13/2026 **Status:** ✅ Merged **Merged:** 7/14/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/5912-stable-speed-tags` --- ### 📝 Commits (4) - [`009b6d2`](https://github.com/MHSanaei/3x-ui/commit/009b6d2454966fa348080d34b5d7e2cf827ff9ff) fix(frontend): add shared stable speed-tag style - [`0041910`](https://github.com/MHSanaei/3x-ui/commit/0041910142cd4fe06a51e80ccb27d4d12b1c7201) fix(frontend): stabilize InboundSpeedTag and ClientSpeedTag layout - [`8dcb429`](https://github.com/MHSanaei/3x-ui/commit/8dcb42976427fe29ba36d5eeb8ae1b14b6d6265e) fix(frontend): align speed columns with stable tag width - [`f07b622`](https://github.com/MHSanaei/3x-ui/commit/f07b6225236af468db42c52bcab46981bb35c827) fix(frontend): scope stable speed tags to table cells and fit content ### 📊 Changes **6 files changed** (+131 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/clients/ClientSpeedTag.tsx` (+8 -2) ➕ `frontend/src/components/utility/speedTagStyle.ts` (+21 -0) 📝 `frontend/src/pages/clients/ClientsPage.tsx` (+6 -3) 📝 `frontend/src/pages/inbounds/list/InboundSpeedTag.tsx` (+8 -2) 📝 `frontend/src/pages/inbounds/list/useInboundColumns.tsx` (+4 -3) ➕ `frontend/src/test/speed-tag-stable.test.tsx` (+84 -0) </details> ### 📄 Description ## Summary Fixes live Speed-column layout jitter when upload/download rates change length (B/KB/MB digit boundaries). - Shared `speed-tag` style: fixed **148px** width, centered content, `nowrap`, `tabular-nums` - Applied to both `InboundSpeedTag` and `ClientSpeedTag` - Idle dash cells use the same stable style so active/idle swaps do not reflow - Speed column width aligned to **160** on inbound and client tables - Focused component tests lock the shared class/style contract for small and large rates Fixes #5912 ## Verification ### RED → GREEN (TDD) **RED** (before applying style to tags): ``` FAIL components src/test/speed-tag-stable.test.tsx (3 failed) × ClientSpeedTag keeps the same stable class/style for small and large rates × InboundSpeedTag keeps the same stable class/style for small and large rates × both tags share the same stable style contract and column width constant AssertionError: expected false to be true (classList.contains('speed-tag')) ``` **GREEN** (after fix): ``` ✓ components src/test/speed-tag-stable.test.tsx (3 tests) ✓ ClientSpeedTag keeps the same stable class/style for small and large rates ✓ InboundSpeedTag keeps the same stable class/style for small and large rates ✓ both tags share the same stable style contract and column width constant ``` ### Commands | Command | Result | |---------|--------| | `npm test -- --project components src/test/speed-tag-stable.test.tsx` | pass (3/3) | | `npm run typecheck` | pass | | `npm run lint` | pass | | `npm run build` | pass | ### Visual / width evidence Full panel UI needs an authenticated backend + live traffic, so widths were measured with a Chrome headless harness using the same shared style as the tags: | Case | Text | Measured width | |------|------|----------------| | idle | — | **148.00px** | | small | ↑ 512 B/s / ↓ 1023 B/s | **148.00px** | | medium | ↑ 1.38 MB/s / ↓ 8.49 MB/s | **148.00px** | | large | ↑ 11.77 MB/s / ↓ 95.36 MB/s | **148.00px** | `stable=true`, `style.width=148px`, column width constant `160`. ## Non-goals - No formatter / polling / business-logic changes - No redesign of inbound/client pages - No new dependencies or DESIGN.md - Tooltip, sorting, and client-card placement preserved ## Changed files - `frontend/src/components/utility/speedTagStyle.ts` (new) - `frontend/src/styles/utils.css` - `frontend/src/components/clients/ClientSpeedTag.tsx` - `frontend/src/pages/inbounds/list/InboundSpeedTag.tsx` - `frontend/src/pages/inbounds/list/useInboundColumns.tsx` - `frontend/src/pages/clients/ClientsPage.tsx` - `frontend/src/test/speed-tag-stable.test.tsx` (new) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:05:53 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6031
No description provided.