Skip to content

Commit c8d3f80

Browse files
committed
fix: compact mobile node name column
1 parent 116c4d2 commit c8d3f80

8 files changed

Lines changed: 42 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<img src="./logo.svg" alt="SingBox Proxy Manager Logo" width="96" />
66

7-
![Version](https://img.shields.io/badge/version-1.5.3-blue.svg)
7+
![Version](https://img.shields.io/badge/version-1.5.4-blue.svg)
88
![License](https://img.shields.io/badge/license-MIT-green.svg)
99
![SingBox](https://img.shields.io/badge/sing--box-1.12.12-orange.svg)
1010

frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sb-proxy-frontend",
33
"private": true,
4-
"version": "1.5.3",
4+
"version": "1.5.4",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

frontend/scripts/dnd-reorder-regression.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ const run = async () => {
283283
await page.goto(FRONTEND_URL, { waitUntil: 'networkidle2' })
284284
await page.evaluate(() => {
285285
localStorage.setItem('token', 'e2e-token')
286+
localStorage.setItem('language', 'zh')
286287
})
287288
await page.reload({ waitUntil: 'networkidle2' })
288289
await page.waitForSelector('tbody.ant-table-tbody tr[data-row-key="1"]', { timeout: 30000 })
@@ -293,6 +294,15 @@ const run = async () => {
293294
'tbody.ant-table-tbody tr[data-row-key="1"] td',
294295
(cells) => cells.length
295296
)
297+
const desktopNameHeader = await page.evaluate(() => {
298+
const header = Array.from(document.querySelectorAll('thead.ant-table-thead th')).find(
299+
(cell) => cell.textContent?.trim() === '节点名称'
300+
)
301+
return {
302+
text: header?.textContent?.trim() || '',
303+
width: header?.getBoundingClientRect().width || 0,
304+
}
305+
})
296306
const dragHandleScope = await page.evaluate(() => {
297307
const row = document.querySelector('tbody.ant-table-tbody tr[data-row-key="1"]')
298308
const libraryHandles = Array.from(
@@ -349,6 +359,10 @@ const run = async () => {
349359
`Unexpected initial node order: ${JSON.stringify(orderBefore)}`
350360
)
351361
assert(desktopColumnCount === 16, `Desktop columns changed unexpectedly: ${desktopColumnCount}`)
362+
assert(
363+
desktopNameHeader.text === '节点名称' && desktopNameHeader.width >= 100,
364+
`Desktop node-name header changed unexpectedly: ${JSON.stringify(desktopNameHeader)}`
365+
)
352366
assert(dragHandleScope.libraryHandleCount === 20, `Unexpected drag handle count: ${JSON.stringify(dragHandleScope)}`)
353367
assert(dragHandleScope.allLibraryHandlesScoped, `Library drag handles escape the six-dot controls: ${JSON.stringify(dragHandleScope)}`)
354368
assert(!dragHandleScope.rowIsLibraryHandle, `Table row is still a drag handle: ${JSON.stringify(dragHandleScope)}`)
@@ -400,6 +414,9 @@ const run = async () => {
400414
const handle = document.querySelector('[data-testid="node-drag-handle-1"]')
401415
const body = tableContainer?.querySelector('.ant-table-body')
402416
const filterChildren = Array.from(filterControls?.children || [])
417+
const nameHeader = Array.from(
418+
tableContainer?.querySelectorAll('thead.ant-table-thead th') || []
419+
).find((cell) => cell.textContent?.trim() === '名称')
403420

404421
return {
405422
viewportWidth,
@@ -420,6 +437,8 @@ const run = async () => {
420437
),
421438
bodyClientHeight: body?.clientHeight || 0,
422439
bodyScrollHeight: body?.scrollHeight || 0,
440+
nameHeaderText: nameHeader?.textContent?.trim() || '',
441+
nameHeaderWidth: nameHeader?.getBoundingClientRect().width || 0,
423442
}
424443
})
425444

@@ -441,6 +460,10 @@ const run = async () => {
441460
assert(mobileLayout.rowTouchAction !== 'none', `Mobile row blocks native scrolling: ${JSON.stringify(mobileLayout)}`)
442461
assert(mobileLayout.handleTouchAction === 'none', `Mobile drag handle does not own touch dragging: ${JSON.stringify(mobileLayout)}`)
443462
assert(mobileLayout.handleIsLibraryHandle, `Mobile six-dot control is not the library drag handle: ${JSON.stringify(mobileLayout)}`)
463+
assert(
464+
mobileLayout.nameHeaderText === '名称' && mobileLayout.nameHeaderWidth <= 116,
465+
`Chinese mobile node-name header is not compact: ${JSON.stringify(mobileLayout)}`
466+
)
444467
assert(
445468
mobileLayout.bodyScrollHeight > mobileLayout.bodyClientHeight,
446469
`Mobile node list is not vertically scrollable: ${JSON.stringify(mobileLayout)}`
@@ -562,6 +585,9 @@ const run = async () => {
562585
const actionButtons = Array.from(
563586
selectionToolbar?.querySelectorAll('button') || []
564587
)
588+
const nameHeader = Array.from(
589+
table?.querySelectorAll('thead.ant-table-thead th') || []
590+
).find((cell) => cell.textContent?.trim() === 'Name')
565591
return {
566592
viewportWidth,
567593
documentScrollWidth: document.documentElement.scrollWidth,
@@ -574,6 +600,8 @@ const run = async () => {
574600
selectionScrollWidth: selectionToolbar?.scrollWidth || 0,
575601
tableInside: rectInside(table),
576602
tableHeight: table?.getBoundingClientRect().height || 0,
603+
nameHeaderText: nameHeader?.textContent?.trim() || '',
604+
nameHeaderWidth: nameHeader?.getBoundingClientRect().width || 0,
577605
}
578606
})
579607
assert(
@@ -590,6 +618,10 @@ const run = async () => {
590618
`Compact mobile selection toolbar overflows: ${JSON.stringify(compactMobileLayout)}`
591619
)
592620
assert(compactMobileLayout.tableInside && compactMobileLayout.tableHeight > 80, `Compact mobile table is unusable: ${JSON.stringify(compactMobileLayout)}`)
621+
assert(
622+
compactMobileLayout.nameHeaderText === 'Name' && compactMobileLayout.nameHeaderWidth <= 100,
623+
`English compact-mobile node-name header is not compact: ${JSON.stringify(compactMobileLayout)}`
624+
)
593625

594626
await page.evaluate(() => localStorage.removeItem('token'))
595627
await page.reload({ waitUntil: 'networkidle2' })
@@ -638,6 +670,7 @@ const run = async () => {
638670
orderAfterDrag,
639671
reorderPayload: stateAfterDrag.lastReorder,
640672
dragHandleScope,
673+
desktopNameHeader,
641674
mobileLayout,
642675
mobileExpandedControls,
643676
mobileScrollTop,

frontend/src/components/Dashboard.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,11 +1984,11 @@ function Dashboard({ onLogout }) {
19841984
),
19851985
},
19861986
{
1987-
title: t('node_name'),
1987+
title: isMobile ? t('node_name_short') : t('node_name'),
19881988
dataIndex: 'name',
19891989
key: 'name',
19901990
ellipsis: true,
1991-
width: isMobile ? 104 : 110,
1991+
width: isMobile ? 84 : 110,
19921992
},
19931993
{
19941994
title: t('remark'),

frontend/src/i18n/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default {
5151
batch_export: 'Batch Export',
5252
set_auth: 'Set Auth',
5353
node_name: 'Node Name',
54+
node_name_short: 'Name',
5455
remark: 'Remark',
5556
node_record: 'Node Record',
5657
remark_placeholder: 'Optional',

frontend/src/i18n/zh.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default {
5151
batch_export: '批量导出',
5252
set_auth: '批量认证',
5353
node_name: '节点名称',
54+
node_name_short: '名称',
5455
remark: '备注',
5556
node_record: '节点记录',
5657
remark_placeholder: '可留空',

internal/version/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.3
1+
1.5.4

0 commit comments

Comments
 (0)