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.

feat(view): the tabs fit one row on a phone [N26]

Corey Olsona88694b5420d
diff --git a/src/cockpit.js b/src/cockpit.js
index dd986ab9..07816dd6 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -119,6 +119,11 @@ main { padding: 16px 18px 28px; }
main { padding: 12px 10px 24px; }
.two, .two.narrow { grid-template-columns: minmax(0, 1fr); }
}
+@media (max-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; }
+}
.primary { display: grid; gap: 12px; min-width: 0; }
.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; }
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index b1502df3..35b26d88 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -350,6 +350,22 @@ test('the sidebar lists every project and what needs the person [N26]', async ()
}
});
+test('the tabs fit one row on a phone [N26]', async () => {
+ const view = await startView(machine());
+ 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] ?? '';
+ 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');
+ } finally {
+ await view.stop();
+ }
+});
/**
* The products the sidebar shows: name, rows met, how full the bar is, and the item counts with the
* state each dot is coloured for.