Skip to content

Commit dcabc6c

Browse files
committed
fix(org): hide secondary admin and request columns on a phone, and fail a heading that breaks mid-word
1 parent 7ce11ea commit dcabc6c

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

‎apps/sim/platform/embedded/app/(shell)/settings/_components/sections/admin/admin-section.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import { AddUserModal } from '@/platform/embedded/app/(shell)/settings/_componen
3737
import { toast } from '@/platform/shared/toast'
3838

3939
const USER_COLUMNS = [
40-
{ key: 'name', label: 'Name', kind: 'text' },
40+
{ key: 'name', label: 'Name', kind: 'text', showFrom: 'compact' },
4141
{ key: 'email', label: 'Email', kind: 'text' },
42-
{ key: 'role', label: 'Role', kind: 'status' },
42+
{ key: 'role', label: 'Role', kind: 'status', showFrom: 'compact' },
4343
{ key: 'status', label: 'Status', kind: 'status' },
4444
] as const
4545

‎apps/sim/platform/embedded/app/(shell)/settings/_components/sections/mothership/mothership-section.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ const USER_COLUMNS = [
150150

151151
const REQUEST_COLUMNS = [
152152
{ key: 'id', label: 'Request ID', kind: 'text' },
153-
{ key: 'model', label: 'Model', kind: 'text' },
154-
{ key: 'duration', label: 'Duration', kind: 'text' },
155-
{ key: 'cost', label: 'Cost', kind: 'text' },
156-
{ key: 'tools', label: 'Tools', kind: 'number' },
153+
{ key: 'model', label: 'Model', kind: 'text', showFrom: 'compact' },
154+
{ key: 'duration', label: 'Duration', kind: 'text', showFrom: 'compact' },
155+
{ key: 'cost', label: 'Cost', kind: 'text', showFrom: 'wide' },
156+
{ key: 'tools', label: 'Tools', kind: 'number', showFrom: 'wide' },
157157
{ key: 'status', label: 'Status', kind: 'status' },
158158
{ key: 'time', label: 'Time', kind: 'text' },
159159
] as const

‎apps/sim/scripts/org-redesign-e2e/checks/screenshots.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,27 @@ export async function stateScreenshots() {
151151
)
152152
const open = viewport === PHONE ? (shot.openOnPhone ?? shot.open) : shot.open
153153
await open?.(session.page)
154+
// A heading too narrow for its word breaks mid-word, the failure a role check misses.
155+
const broken = await session.page.getByRole('columnheader').evaluateAll((cells) =>
156+
cells.flatMap((cell) => {
157+
const walker = document.createTreeWalker(cell, NodeFilter.SHOW_TEXT)
158+
const words: string[] = []
159+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
160+
const text = node.textContent ?? ''
161+
for (const match of text.matchAll(/\S+/g)) {
162+
const range = document.createRange()
163+
range.setStart(node, match.index ?? 0)
164+
range.setEnd(node, (match.index ?? 0) + match[0].length)
165+
const lines = new Set(
166+
[...range.getClientRects()].map((rect) => Math.round(rect.top))
167+
)
168+
if (lines.size > 1) words.push(match[0])
169+
}
170+
}
171+
return words
172+
})
173+
)
174+
assert.deepEqual(broken, [], `${shot.name}: column headings break mid-word`)
154175
await sleep(200)
155176
await session.page.screenshot({
156177
path: resolve(artifactDirectory, `state__${shot.name}__${viewport.name}.png`),

0 commit comments

Comments
 (0)