Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): keep the stacked infrastructure cards in the window

Yudhi Armyndharisbcc48b4b751d
diff --git a/dashboard/src/pages/Infrastructure.css b/dashboard/src/pages/Infrastructure.css
index 953878181..95d8db393 100644
--- a/dashboard/src/pages/Infrastructure.css
+++ b/dashboard/src/pages/Infrastructure.css
@@ -389,7 +389,7 @@
wider); below that they stack. */
@media (max-width: 1200px) {
.infrastructure-page .infra-sections {
- grid-template-columns: 1fr;
+ grid-template-columns: minmax(0, 1fr);
}
}
@@ -479,6 +479,7 @@
.infrastructure-page .stat-values {
gap: 1rem;
+ flex-wrap: wrap;
}
.infrastructure-page .stat-item .value {
@@ -562,6 +563,7 @@
}
.infrastructure-page .data-migration-actions {
display: flex;
+ flex-wrap: wrap;
gap: 0.5rem;
}
.infrastructure-page .data-migration-actions .btn-sm,
diff --git a/dashboard/src/pages/Infrastructure.responsive.test.ts b/dashboard/src/pages/Infrastructure.responsive.test.ts
index 508387d37..1f5cd62a2 100644
--- a/dashboard/src/pages/Infrastructure.responsive.test.ts
+++ b/dashboard/src/pages/Infrastructure.responsive.test.ts
@@ -10,9 +10,27 @@ const rules = readRules(new URL('./Infrastructure.css', import.meta.url));
test('the infrastructure cards stack before the columns overflow', () => {
const stacked = rules.filter(
r =>
- r.selectors.includes('.infrastructure-page .infra-sections') && decl(r.body, 'grid-template-columns') === '1fr',
+ r.selectors.includes('.infrastructure-page .infra-sections') &&
+ decl(r.body, 'grid-template-columns') === 'minmax(0, 1fr)',
);
- assert.equal(stacked.length, 1, 'expected one rule that stacks the cards');
+ assert.equal(stacked.length, 1, 'expected one rule that stacks the cards in a track that can shrink');
const width = Number(/max-width: (\d+)px/.exec(stacked[0].media)?.[1]);
assert.ok(width >= 1200, `the cards stack at ${stacked[0].media || 'every width'}`);
});
+
+// A plain 1fr track never shrinks below the widest content in it, and the three queue counters are a nowrap row: in
+// German on a phone they widened the single card track to 392px, so every card ran past the right edge of a 390px
+// window (84px of page overflow at 320px). The track may shrink, and the counters wrap onto a second line.
+test('the queue counters wrap on a phone', () => {
+ const wrap = rules.filter(
+ r => r.selectors.includes('.infrastructure-page .stat-values') && decl(r.body, 'flex-wrap'),
+ );
+ assert.equal(wrap.length, 1, 'expected one rule that lets the counters wrap');
+ assert.equal(decl(wrap[0].body, 'flex-wrap'), 'wrap');
+});
+
+test('the data export and import buttons wrap in a card that is too narrow for both', () => {
+ const actions = rules.find(r => !r.media && r.selectors.includes('.infrastructure-page .data-migration-actions'));
+ assert.ok(actions, 'no .data-migration-actions rule');
+ assert.equal(decl(actions.body, 'flex-wrap'), 'wrap');
+});