Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

fix(view): the phone tab bar starts under 480px, not at it [N26]

Corey Olson99259ad5f030
diff --git a/src/cockpit.js b/src/cockpit.js
index 07816dd6..1f6c8feb 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -119,7 +119,7 @@ main { padding: 16px 18px 28px; }
main { padding: 12px 10px 24px; }
.two, .two.narrow { grid-template-columns: minmax(0, 1fr); }
}
-@media (max-width: 480px) {
+@media (width < 480px) {
.tabs { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; }
.tab { display: grid; grid-template-rows: auto 13px; justify-items: center; align-content: center; padding: 7px 2px 5px; font-size: 13.5px; }
.tab b { margin: 0; line-height: 13px; }
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index 35b26d88..bd4d68d4 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -355,13 +355,14 @@ test('the tabs fit one row on a phone [N26]', async () => {
try {
const html = await (await fetch(view.link)).text();
const style = html.slice(html.indexOf('<style>'), html.indexOf('</style>'));
- const phone = /@media \(max-width: 480px\) \{\n([^@]*?)\n\}/.exec(style)?.[1] ?? '';
+ const phone = /@media \(width < 480px\) \{\n([^@]*?)\n\}/.exec(style)?.[1] ?? '';
+ assert.doesNotMatch(style, /max-width: 480px/, 'at 480px itself the tabs keep their row');
assert.match(phone, /\.tabs \{ flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax\(0, 1fr\);/, 'under 480px the tabs share the bar in equal columns');
assert.match(phone, /\.tab \{ display: grid; grid-template-rows: auto 13px; justify-items: center;/, 'each tab stacks its label over its count');
assert.match(phone, /\.tab b \{ margin: 0;/);
assert.match(style, /\n\.tabs \{ display: flex; flex-wrap: wrap; gap: 2px; \}\n/, 'wider, the tabs keep the row they have');
- const tabs = [...html.matchAll(/<button class="tab" data-tab="([a-z]+)" type="button">([A-Za-z]+)(<b id="count-[a-z]+"><\/b>)?<\/button>/g)];
- assert.deepEqual(tabs.map((match) => match[2]), ['Items', 'Shouts', 'Spec', 'Doctrine', 'Activity'], 'five tabs, each a label and then its count');
+ const tabs = [...html.matchAll(/<button class="tab" data-tab="([a-z]+)" type="button">([A-Za-z]+)(<b id="count-([a-z]+)"><\/b>)?<\/button>/g)];
+ assert.deepEqual(tabs.map((match) => [match[2], match[4] === match[1]]), [['Items', true], ['Shouts', true], ['Spec', true], ['Doctrine', true], ['Activity', false]], 'five tabs: a label, then its count where it has one');
} finally {
await view.stop();
}