mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 08:53:13 +00:00
fix(client): the audit round over the 4.3.1 release
Ride minutes and late marks follow an edited timetable instead of the routing that fetched them; a landing day's join band reads as the ride it is rather than a nine hour drive of no length; the refuel offer is there on the road out of a terminal or a pick-up desk; the phone's stage map draws the ride; the share page numbers its stops the way the planner does; the PDF lists a day the way the day plan lists it, from both shells; a poster-less clip draws its play badge everywhere, not only in the editor; the hero title has room for its descenders and the list card keeps its badge clear; the release notice keeps its close control in reach when it stacks; a link chip's actions are thumb-sized and its delete asks first; the Google retry line and the Google-only switch appear only where Google answers.
This commit is contained in:
@@ -233,12 +233,20 @@
|
||||
}
|
||||
.trek-dash .hero-eyebrow::before { content: ""; width: 28px; height: 1px; background: oklch(1 0 0 / .6); }
|
||||
.trek-dash .hero-title {
|
||||
font-size: 104px; font-weight: 600; line-height: 0.9; letter-spacing: -0.045em; margin: 0;
|
||||
font-size: 104px; font-weight: 600; line-height: 1.12; letter-spacing: -0.045em; margin: 0;
|
||||
text-shadow: 0 1px 12px oklch(0 0 0 / .32), 0 1px 3px oklch(0 0 0 / .4);
|
||||
/* Two lines at most, a word longer than the card broken inside it: the rows above
|
||||
and below have a fixed budget and a third line would run into the badge row. */
|
||||
overflow-wrap: anywhere;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
|
||||
/* The clamp clips at the line boxes and Poppins paints past them (ascender 1.05em,
|
||||
descender 0.35em): at 0.9 every y, g and p on the last line lost its tail and
|
||||
É and Å on the first their accent. The padding makes room for the ink and the
|
||||
margin takes it back, so the title sits where it did. At 1.12 a clipped third
|
||||
line keeps its plain ascenders under that padding; an accented capital on it
|
||||
still leaves a sliver, as it does on dev today, and only a much looser title
|
||||
would hide that. */
|
||||
padding-block: .1em; margin-block: -.1em;
|
||||
}
|
||||
|
||||
/* ----------------- boarding pass ----------------- */
|
||||
@@ -427,6 +435,11 @@
|
||||
.trek-dash .trips.list-view { grid-template-columns: 1fr; gap: 12px; }
|
||||
.trek-dash .trips.list-view .trip-card { display: grid; grid-template-columns: 520px 1fr; gap: 0; height: auto; }
|
||||
.trek-dash .trips.list-view .trip-cover { border-radius: var(--r-lg) 0 0 var(--r-lg); height: 100px; aspect-ratio: unset; }
|
||||
/* The row's cover is 100px and the title hangs from its bottom edge, so every
|
||||
line it gains grows upwards: at 26px a second one starts above the status
|
||||
badge at top 16px and runs through the pill. The row has 484px of text to
|
||||
itself, one line is the whole title either way. */
|
||||
.trek-dash .trips.list-view .trip-name { -webkit-line-clamp: 1; }
|
||||
.trek-dash .trips.list-view .trip-body { display: flex; align-items: center; justify-content: flex-end; padding: 16px 36px; gap: 28px; }
|
||||
/* Date rendered as a peer of the counts, set off by a vertical divider rather than
|
||||
floating alone at the far left. */
|
||||
@@ -481,7 +494,15 @@
|
||||
.trek-dash .trip-action-btn:hover { background: oklch(0.22 0.01 260 / .82); transform: scale(1.06); }
|
||||
.trek-dash .trip-action-btn svg { width: 17px; height: 17px; }
|
||||
.trek-dash .trip-cover-content { position: absolute; left: 18px; right: 18px; bottom: 16px; z-index: 1; color: #fff; }
|
||||
.trek-dash .trip-name { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0; text-shadow: 0 1px 7px oklch(0 0 0 / .3), 0 1px 2px oklch(0 0 0 / .38); }
|
||||
.trek-dash .trip-name {
|
||||
font-size: 26px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.12; margin: 0;
|
||||
text-shadow: 0 1px 7px oklch(0 0 0 / .3), 0 1px 2px oklch(0 0 0 / .38);
|
||||
/* The cover is a fixed width and clipped, so the same clamp and ink room as
|
||||
.hero-title: one long word used to run off the card edge as a single line. */
|
||||
overflow-wrap: anywhere;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
|
||||
padding-block: .1em; margin-block: -.1em;
|
||||
}
|
||||
.trek-dash .trip-where { margin-top: 4px; font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 6px; }
|
||||
.trek-dash .trip-where svg { width: 12px; height: 12px; opacity: .8; }
|
||||
.trek-dash .trip-body { padding: 18px 20px 20px; }
|
||||
@@ -730,10 +751,9 @@
|
||||
.trek-dash .trips.list-view .trip-card { grid-template-columns: 1fr; min-height: 0; }
|
||||
.trek-dash .trips.list-view .trip-cover { height: 110px; aspect-ratio: unset; border-radius: 0; }
|
||||
.trek-dash .trips.list-view .trip-cover-content { left: 16px; right: 16px; bottom: 11px; }
|
||||
.trek-dash .trips.list-view .trip-name {
|
||||
font-size: 18px; overflow: hidden; text-overflow: ellipsis;
|
||||
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
|
||||
}
|
||||
/* Taller banner (110px), smaller type and the title 11px off the bottom: two
|
||||
lines end below the badge here, so the phone row keeps them. */
|
||||
.trek-dash .trips.list-view .trip-name { font-size: 18px; -webkit-line-clamp: 2; }
|
||||
.trek-dash .trips.list-view .trip-body { display: flex; align-items: center; justify-content: center; padding: 10px 16px; }
|
||||
.trek-dash .trips.list-view .trip-dates { margin-bottom: 0; justify-content: center; font-size: 12.5px; }
|
||||
.trek-dash .trips.list-view .trip-dates .date-num { font-size: 12.5px; }
|
||||
|
||||
@@ -6,10 +6,26 @@ import { describe, it, expect } from 'vitest'
|
||||
// releaseNoticeCss.test.ts pins the notice's stacking.
|
||||
describe('dashboard css', () => {
|
||||
const css = readFileSync(resolve(process.cwd(), 'src/styles/dashboard.css'), 'utf8')
|
||||
const block = (selector: string): string => {
|
||||
const at = css.indexOf(selector)
|
||||
const within = (source: string, selector: string): string => {
|
||||
const at = source.indexOf(selector)
|
||||
expect(at, `${selector} missing from dashboard.css`).toBeGreaterThan(-1)
|
||||
return css.slice(at, css.indexOf('}', at) + 1)
|
||||
return source.slice(at, source.indexOf('}', at) + 1)
|
||||
}
|
||||
const block = (selector: string): string => within(css, selector)
|
||||
const phone = (): string => {
|
||||
const at = css.indexOf('@media (max-width: 720px)')
|
||||
expect(at, 'the phone block').toBeGreaterThan(-1)
|
||||
return css.slice(at, css.indexOf('\n}', at))
|
||||
}
|
||||
// The leading number of a declaration, undefined when the rule does not set it.
|
||||
const number = (rule: string, prop: string): number | undefined => {
|
||||
const found = new RegExp(`(?:^|[;{\\n])\\s*${prop}:\\s*(-?[\\d.]+)`).exec(rule)
|
||||
return found ? Number(found[1]) : undefined
|
||||
}
|
||||
const value = (rule: string, prop: string): number => {
|
||||
const found = number(rule, prop)
|
||||
expect(found, `${prop} missing from ${rule.slice(0, 48)}`).toBeDefined()
|
||||
return found!
|
||||
}
|
||||
|
||||
it('FE-DASH-CSS-001: a hero title that is one long word cannot widen the card', () => {
|
||||
@@ -24,4 +40,72 @@ describe('dashboard css', () => {
|
||||
expect(title).toMatch(/-webkit-line-clamp:\s*2/)
|
||||
expect(title).toMatch(/overflow:\s*hidden/)
|
||||
})
|
||||
|
||||
it('FE-DASH-CSS-002: the clamp clips at the line boxes, so they leave room for the ink', () => {
|
||||
// Poppins paints past its line box (ascender 1.05em, descender 0.35em). With
|
||||
// the clamp's overflow: hidden at line-height 0.9, every y, g and p on the
|
||||
// last line lost its tail and É and Å on the first their accent. The room is
|
||||
// padding the margin takes back, and the line-height has to keep a clipped
|
||||
// third line's plain ascenders below that padding, which 1.12 just does (an
|
||||
// accented capital on that third line still leaves a sliver, as at 0.9).
|
||||
for (const selector of ['.trek-dash .hero-title {', '.trek-dash .trip-name {']) {
|
||||
const rule = block(selector)
|
||||
expect(rule, selector).toMatch(/overflow:\s*hidden/)
|
||||
expect(value(rule, 'line-height'), selector).toBeGreaterThanOrEqual(1.12)
|
||||
const room = /padding-block:\s*0?\.(\d+)em/.exec(rule)?.[1]
|
||||
expect(room, `${selector} pads no room for the ink`).toBeDefined()
|
||||
expect(rule, selector).toMatch(new RegExp(`margin-block:\\s*-0?\\.${room}em`))
|
||||
}
|
||||
})
|
||||
|
||||
it('FE-DASH-CSS-003: a grid or list card breaks a one-word title inside the cover and stops at two lines', () => {
|
||||
// The same title that stretched the hero was cut at the cover edge on every
|
||||
// card: the cover content is absolutely positioned and the cover clips.
|
||||
const name = block('.trek-dash .trip-name {')
|
||||
expect(name).toMatch(/overflow-wrap:\s*anywhere/)
|
||||
expect(name).toMatch(/-webkit-line-clamp:\s*2/)
|
||||
})
|
||||
|
||||
it('FE-DASH-CSS-004: a list row uses every title line that fits above the status badge', () => {
|
||||
// The list cover is a fixed band: the badge is pinned near its top and the
|
||||
// title hangs from its bottom edge, so each line the title gains grows upwards
|
||||
// into the badge. At 26px over a 100px cover the two-line clamp put the first
|
||||
// line at y 23 and ran it through the pill; the phone banner is taller and its
|
||||
// type smaller, so there two fit. jsdom lays nothing out, so the row is
|
||||
// measured from the rules the browser would apply.
|
||||
const inherited = 1.5 // html's line-height; nothing in dashboard.css resets it
|
||||
const badge = block('.trek-dash .trip-status {')
|
||||
const badgeBottom =
|
||||
value(badge, 'top') + 2 * value(badge, 'border') + 2 * value(badge, 'padding') + value(badge, 'font-size') * inherited
|
||||
const name = block('.trek-dash .trip-name {')
|
||||
// What the row ends up with: its own override where it has one, the shared
|
||||
// .trip-name rule otherwise.
|
||||
const shell = (rule: string, prop: string): number => number(rule, prop) ?? value(name, prop)
|
||||
|
||||
const rows = [
|
||||
{
|
||||
label: 'desktop',
|
||||
cover: block('.trek-dash .trips.list-view .trip-cover {'),
|
||||
content: block('.trek-dash .trip-cover-content {'),
|
||||
row: block('.trek-dash .trips.list-view .trip-name {')
|
||||
},
|
||||
{
|
||||
label: 'phone',
|
||||
cover: within(phone(), '.trek-dash .trips.list-view .trip-cover {'),
|
||||
content: within(phone(), '.trek-dash .trips.list-view .trip-cover-content {'),
|
||||
row: within(phone(), '.trek-dash .trips.list-view .trip-name {')
|
||||
}
|
||||
]
|
||||
|
||||
for (const { label, cover, content, row } of rows) {
|
||||
const fontSize = shell(row, 'font-size')
|
||||
const line = fontSize * shell(row, 'line-height')
|
||||
// The clamp pads .1em for the ink and takes it back with a negative margin,
|
||||
// so the box keeps its height but paints that much higher.
|
||||
const ceiling = value(cover, 'height') - value(content, 'bottom') - fontSize * shell(row, 'padding-block')
|
||||
const clamp = shell(row, '-webkit-line-clamp')
|
||||
expect(ceiling - clamp * line, `${label} list title over the badge`).toBeGreaterThanOrEqual(badgeBottom)
|
||||
expect(clamp, `${label} list title leaves a line unused`).toBe(Math.floor((ceiling - badgeBottom) / line))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user