diff --git a/prototypes/senlinai-acro-react/scripts/visual-check.mjs b/prototypes/senlinai-acro-react/scripts/visual-check.mjs index 457be67..e10c7e2 100644 --- a/prototypes/senlinai-acro-react/scripts/visual-check.mjs +++ b/prototypes/senlinai-acro-react/scripts/visual-check.mjs @@ -25,6 +25,7 @@ await page.goto(`http://127.0.0.1:${port}/`, { waitUntil: 'networkidle' }) await page.screenshot({ path: 'test-results/login-react-acro.png', fullPage: true }) await page.locator('.login-form-panel .arco-btn-primary').click() await page.waitForSelector('.workbench-shell') +await page.waitForTimeout(700) await page.screenshot({ path: 'test-results/workbench-react-acro-light.png', fullPage: true }) await page.locator('.topbar-actions .arco-btn').first().click() await page.screenshot({ path: 'test-results/workbench-react-acro-dark.png', fullPage: true }) @@ -36,10 +37,21 @@ const metrics = await page.evaluate(() => { const dashboard = document.querySelector('.dashboard-button') const project = document.querySelector('.project-button') const create = document.querySelector('.create-project') + const firstBadge = document.querySelector('.project-badge .arco-badge-number') + const railItems = [...document.querySelectorAll('.dashboard-button, .project-button, .create-project')] const rect = (node) => { const box = node?.getBoundingClientRect() - return box ? { width: box.width, height: box.height } : null + return box ? { left: box.left, right: box.right, top: box.top, width: box.width, height: box.height } : null } + const railBox = rail?.getBoundingClientRect() + const itemRects = railItems.map(rect).filter(Boolean) + const horizontalInsets = railBox && project + ? { + left: project.getBoundingClientRect().left - railBox.left, + right: railBox.right - project.getBoundingClientRect().right, + } + : null + const verticalGaps = itemRects.slice(1).map((item, index) => item.top - (itemRects[index].top + itemRects[index].height)) return { statusbarHeight: statusbar?.getBoundingClientRect().height, @@ -48,6 +60,9 @@ const metrics = await page.evaluate(() => { dashboardButton: rect(dashboard), projectButton: rect(project), createProjectButton: rect(create), + firstProjectBadge: rect(firstBadge), + horizontalInsets, + verticalGaps, overflowX: document.documentElement.scrollWidth > document.documentElement.clientWidth, } }) @@ -66,6 +81,19 @@ if (!metrics.projectRailWidth || metrics.projectRailWidth < 88) { failures.push(`expected project rail at least 88px wide, got ${metrics.projectRailWidth}`) } if (!metrics.projectButton) failures.push('missing project button') +if (!metrics.horizontalInsets || Math.abs(metrics.horizontalInsets.left - metrics.horizontalInsets.right) > 1) { + failures.push(`expected equal rail horizontal insets, got ${JSON.stringify(metrics.horizontalInsets)}`) +} +if (metrics.verticalGaps.some((gap) => gap !== 12)) { + failures.push(`expected all project rail vertical gaps to be 12px, got ${JSON.stringify(metrics.verticalGaps)}`) +} +if ( + !metrics.firstProjectBadge || + metrics.firstProjectBadge.right > metrics.projectRailWidth || + metrics.firstProjectBadge.left < 0 +) { + failures.push(`expected first project badge to stay inside the project rail, got ${JSON.stringify(metrics.firstProjectBadge)}`) +} if ( !metrics.dashboardButton || metrics.dashboardButton.width !== metrics.projectButton?.width || diff --git a/prototypes/senlinai-acro-react/src/App.css b/prototypes/senlinai-acro-react/src/App.css index 6563f19..6752b61 100644 --- a/prototypes/senlinai-acro-react/src/App.css +++ b/prototypes/senlinai-acro-react/src/App.css @@ -280,12 +280,25 @@ display: flex; flex-direction: column; align-items: center; - gap: 14px; - padding: 14px 16px; + gap: 12px; + padding: 14px 24px; border-right: 1px solid var(--senlin-border); background: var(--senlin-panel); } +.project-rail .arco-layout-sider-children { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + gap: 12px; +} + +.project-stack, +.project-stack .arco-space-item { + width: 48px; +} + .dashboard-button, .create-project { width: 48px !important; @@ -296,7 +309,6 @@ } .create-project { - margin-top: 6px; font-size: 11px; white-space: normal; } diff --git a/prototypes/senlinai-acro-react/src/App.tsx b/prototypes/senlinai-acro-react/src/App.tsx index 36c5d9f..8a92c79 100644 --- a/prototypes/senlinai-acro-react/src/App.tsx +++ b/prototypes/senlinai-acro-react/src/App.tsx @@ -270,7 +270,7 @@ function Workbench({ +