Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/DeviceCheck.astro
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const families = ['iPad', 'iPhone', 'iPod touch'].map((f) => [f, shown.filter((d
.key li { display: flex; align-items: center; gap: 8px; }
.key i { width: 10px; height: 10px; }
.key .on { background: var(--blue); } .key .maybe { background: var(--maybe); } .key .off { background: var(--off); }
/* Two columns read top to bottom, then the next: the sorted order stays in reading order. */
/* Two columns, filled row by row in the sorted order. */
.rows { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; border-top: 1px solid var(--border); }
.rows li { border-bottom: 1px solid var(--border); }
.rows li[hidden] { display: none; }
Expand All @@ -92,17 +92,21 @@ const families = ['iPad', 'iPhone', 'iPod touch'].map((f) => [f, shown.filter((d
[aria-expanded='true'] .done { visibility: visible; }
.more :global(.chev) { transition: transform .15s; }
[aria-expanded='true'] :global(.chev) { transform: rotate(180deg); }
@media (max-width: 1100px) { .rows { grid-template-columns: 1fr; } }
@media (max-width: 1240px) { .rows { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
.check-head { flex-direction: column; gap: 20px; margin-bottom: 20px; }
.search-col { width: 100%; }
.controls { margin-bottom: 20px; }
.legend { display: none; }
.rows { grid-template-columns: 1fr; }
.rows a { height: auto; padding: 12px 0; flex-wrap: wrap; row-gap: 8px; }
.rows a { height: auto; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; row-gap: 8px; }
.name small { display: none; }
.rows .feat { gap: 6px; }
}
/* Narrow phones: the name on one line, the features on the next, under the name. */
@media (max-width: 560px) {
.rows .feat { flex-basis: 100%; padding-left: 34px; justify-content: space-between; max-width: 400px; }
}
</style>

<script>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const GLANCE: { key: string; label: string; icon: string; features: strin
{ key: 'wifi', label: 'Wi-Fi', icon: 'wifi', features: ['wifi'] },
{ key: 'bluetooth', label: 'Bluetooth', icon: 'bluetooth', features: ['bluetooth_input'] },
{ key: 'sound', label: 'Sound', icon: 'volume-2', features: ['audio_output'] },
{ key: 'microphone', label: 'Microphone', icon: 'mic', features: ['audio_input'] },
{ key: 'camera', label: 'Camera', icon: 'camera', features: ['camera'] },
{ key: 'charging', label: 'Charging', icon: 'battery-charging', features: ['charging'] },
{ key: 'sleep', label: 'Sleep', icon: 'moon', features: ['suspend', 'resume'] },
{ key: 'rotation', label: 'Rotation', icon: 'rotate-cw', features: ['accelerometer'] },
Expand Down
11 changes: 5 additions & 6 deletions src/lib/og.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ export function deviceCardPath(d: Device): string {
}

export function deviceCard(d: Device): Promise<Buffer> {
const order = ['touch', 'gpu', 'wifi', 'bluetooth', 'sound', 'charging', 'sleep', 'rotation'];
const cells = order.map((key) => GLANCE.find((g) => g.key === key)!).map((g) => {
const cells = GLANCE.map((g) => {
const state = d.glance[g.key];
return h('div', { width: 165, alignItems: 'center', gap: 10 }, [
h('img', {}, undefined, { src: icon(g.icon, STATE_COLOR[state]), width: 26, height: 26 }),
text(g.label, { color: state === 'working' ? C.fg : C.comment, fontSize: 20 }),
return h('div', { width: 136, alignItems: 'center', gap: 8 }, [
h('img', {}, undefined, { src: icon(g.icon, STATE_COLOR[state]), width: 22, height: 22 }),
text(g.label, { color: state === 'working' ? C.fg : C.comment, fontSize: 17 }),
]);
});
const install = d.installState === 'working' ? ['Installs', C.blue] : d.installState === 'untested' ? ['Should install, untested', C.maybe] : ['Not installable yet', C.off];
Expand All @@ -69,7 +68,7 @@ export function deviceCard(d: Device): Promise<Buffer> {
h('div', { position: 'absolute', left: 480, top: 140, width: 680, flexDirection: 'column' }, [
text(d.model, { color: C.bright, fontSize: d.model.length > 14 ? 60 : 76, fontWeight: 600, letterSpacing: -2, lineHeight: 1 }),
text([d.variant, chipLabel(d.chip), `board ${boardLabel(d.profile)}`].filter(Boolean).join(' · '), { color: C.muted, fontSize: 26, marginTop: 8 }),
h('div', { flexWrap: 'wrap', rowGap: 14, marginTop: 44, width: 660 }, cells),
h('div', { flexWrap: 'wrap', rowGap: 14, marginTop: 40, width: 680 }, cells),
h('div', { alignItems: 'center', gap: 10, marginTop: 40 }, [
h('div', { width: 12, height: 12, background: install[1] }), text(install[0], { color: C.bright, fontSize: 24, fontWeight: 600 }),
]),
Expand Down
72 changes: 53 additions & 19 deletions src/pages/devices/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const columns = [{ key: 'installs', label: 'Installs', icon: 'download' }, ...GL
<div class="table" role="table">
<div class="thead" role="row">
<span class="c-dev">Device</span><span class="c-chip">Chip</span>
<span class="c-feat">{columns.map((c) => <span><Icon name={c.icon} size={15} /><em>{c.label}</em></span>)}</span>
<span class="c-feat">{columns.map((c) => <span>{c.label}</span>)}</span>
<span class="c-by">Tested by</span>
</div>
{all.map((d) => (
Expand Down Expand Up @@ -79,8 +79,13 @@ const columns = [{ key: 'installs', label: 'Installs', icon: 'download' }, ...GL
.seg { display: flex; gap: 2px; padding: 4px; border: 1px solid var(--border); background: var(--bg-dark); }
.seg button { background: none; border: 0; padding: 8px 13px; color: var(--muted); font: 14.5px var(--sans); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--bright); font-weight: 600; }
.chips { margin-left: auto; }
.table { border: 1px solid var(--border); background: var(--bg-dark); }
.body .wrap { container-type: inline-size; }
/* The header and the rows share one set of columns (subgrid): each feature column is as wide as
its name in the header, the device column takes the rest. */
.table { border: 1px solid var(--border); background: var(--bg-dark); display: grid; grid-template-columns: 14px minmax(180px, 1fr) 60px repeat(11, minmax(36px, auto)) minmax(120px, 190px) 14px; column-gap: 10px; }
/* The first and last columns are the rows' inner margin, so a row's hover and border still span the table. */
.thead, .tr { grid-column: 1 / -1; padding-left: 0 !important; padding-right: 0 !important; }
.thead > .c-dev, .tr > .c-dev { grid-column-start: 2; }
.thead, .tr { display: flex; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.tr:last-child { border-bottom: 0; }
.tr { position: relative; cursor: pointer; }
Expand All @@ -94,16 +99,20 @@ const columns = [{ key: 'installs', label: 'Installs', icon: 'download' }, ...GL
.tr[hidden] { display: none; }
/* One header style for every column. */
.thead, .thead * { font: 600 13px var(--sans) !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--comment) !important; font-style: normal !important; }
.c-dev { width: 330px; display: flex; align-items: center; gap: 12px; }
.c-dev :global(.icon) { color: var(--muted); width: 20px; }
.c-dev strong { color: var(--bright); font-size: 16.5px; }
.thead, .tr { display: grid; grid-template-columns: subgrid; }
.c-feat { display: contents; }
.c-feat > span { display: flex; justify-content: center; }
.thead .c-feat > span { white-space: nowrap; }
.c-dev { display: flex; align-items: center; gap: 12px; min-width: 0; }
.c-dev :global(.icon) { color: var(--muted); width: 20px; flex: none; }
/* A long variant (12.9-inch, Cellular, 1TB Model) goes under the name instead of widening the column. */
.c-dev .row-link { flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 0; min-width: 0; }
.c-dev strong { color: var(--bright); font-size: 16.5px; white-space: nowrap; }
.c-dev small { color: var(--comment); font-size: 14.5px; }
.c-chip { width: 110px; font: 13.5px var(--mono); color: var(--fg); }
.c-feat { flex: 1; display: flex; gap: 0; }
.c-dev, .c-chip, .c-by { flex-shrink: 0; }
.c-feat > span { width: 54px; display: flex; justify-content: center; }
.thead .c-feat :global(.icon) { display: none; }
.c-by { width: 210px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14.5px; }
.c-chip { font: 13.5px var(--mono); color: var(--fg); }
.c-by { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 14.5px; }
.c-by .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-by :global(.icon) { flex: none; }
.tr:hover strong { color: var(--blue); }
.none { color: var(--muted); padding: 24px 0; }
.key { list-style: none; padding: 0; display: flex; gap: 22px; margin: 0 0 16px; color: var(--muted); font-size: 13.5px; flex-wrap: wrap; }
Expand All @@ -119,14 +128,39 @@ const columns = [{ key: 'installs', label: 'Installs', icon: 'download' }, ...GL
.body { padding-bottom: 56px; }
.search { width: 100%; }
.seg { overflow-x: auto; max-width: 100%; }
.chips { margin-left: 0; }
.tr { padding: 14px 16px; }
}
/* Too narrow for the device, its chip, eleven feature columns and who tested it on one line:
each device takes two, the features under its name. */
/* Not enough room for who tested it: that column goes (it is on each device's page), the rest
stays on one line. The layout follows the table's own width, not the window's. */
@container (max-width: 1080px) {
.table { grid-template-columns: 14px minmax(180px, 1fr) 56px repeat(11, minmax(36px, auto)) 16px 14px; }
.thead .c-by { visibility: hidden; overflow: hidden; white-space: nowrap; }
.c-by .who { display: none; }
}
/* No room for the column names: the header goes and each row packs its icons close, still on
one line. */
@container (max-width: 914px) {
.table { display: block; }
.thead { display: none; }
.tr { flex-wrap: wrap; padding: 14px 16px; row-gap: 10px; }
.c-dev { width: auto; flex: 1; }
.c-chip { width: auto; font-size: 12.5px; }
.c-feat { order: 3; flex-basis: 100%; justify-content: space-between; padding-left: 32px; }
.c-feat > span { width: auto; }
.c-by { width: auto; margin-left: 10px; font-size: 0; }
.tr { grid-template-columns: minmax(170px, 1fr) auto auto 16px; grid-template-areas: 'dev chip feat go'; column-gap: 20px; padding-left: 20px !important; padding-right: 20px !important; }
.tr > .c-dev { grid-column-start: auto; grid-area: dev; }
.c-chip { grid-area: chip; justify-self: end; font-size: 12.5px; }
.c-feat { grid-area: feat; display: flex; gap: 10px; }
.c-by { display: contents; }
.c-by .who { display: none; }
.c-by :global(.icon) { grid-area: go; align-self: center; }
}
/* Too narrow even for that: name, variant and chip on the first line, the icons on the second,
the chevron between both. */
@container (max-width: 610px) {
.tr { grid-template-columns: minmax(0, 1fr) auto 16px; grid-template-areas: 'dev chip go' 'feat feat go'; row-gap: 10px; column-gap: 16px; }
.c-feat { gap: 18px; padding-left: 32px; min-width: 0; }
}
/* Phones: the icons share out what width there is. */
@container (max-width: 470px) {
.c-feat { justify-content: space-between; gap: 0; }
}
</style>

Expand Down
3 changes: 2 additions & 1 deletion src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
* { box-sizing: border-box; margin: 0; }
html { background: var(--bg); scroll-behavior: smooth; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
/* Hidden tooltips near the right edge must not widen the page. */
body { overflow-x: clip; position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
main { flex: 1; }
/* hidden always hides, whatever display a class gives the element. */
[hidden] { display: none !important; }
Expand Down
Loading