Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): align the chat list header with the room header

Yudhi Armyndharis4abd2fc44ebc
diff --git a/dashboard/src/pages/Chats.css b/dashboard/src/pages/Chats.css
index e235d369a..d3fe9ce3b 100644
--- a/dashboard/src/pages/Chats.css
+++ b/dashboard/src/pages/Chats.css
@@ -153,8 +153,11 @@
min-height: 0;
}
+/* As high as the room header beside it. Layout.css gives the dashboard's own .sidebar-header a 72px minimum, which
+ this one, of the same class name, would otherwise take. */
.chats-page .sidebar-header {
height: 64px;
+ min-height: 0;
padding-block: 0;
padding-inline: 1rem 0.75rem;
display: flex;
diff --git a/dashboard/src/pages/Chats.css.test.ts b/dashboard/src/pages/Chats.css.test.ts
index 1e3059695..5dd166932 100644
--- a/dashboard/src/pages/Chats.css.test.ts
+++ b/dashboard/src/pages/Chats.css.test.ts
@@ -34,3 +34,24 @@ test('the active filter pill is heavier than the others, so it does not differ b
'the active pill has the weight of the others',
);
});
+
+// Every rule body whose selector list names the selector, in order.
+const rulesFor = (selector: string): string[] =>
+ [...css.replace(/\/\*[\s\S]*?\*\//g, '').matchAll(/([^{}]+)\{([^{}]*)\}/g)]
+ .filter(m => m[1].split(',').some(s => s.trim() === selector))
+ .map(m => m[2]);
+
+test('the chat list header is as high as the room header, whatever minimum the dashboard header has', () => {
+ const height = (selector: string): string | undefined =>
+ rulesFor(selector)
+ .map(body => /(?:^|;)\s*height:\s*([^;]+)/.exec(body)?.[1].trim())
+ .find(Boolean);
+ assert.equal(height('.chats-page .sidebar-header'), height('.chats-page .room-header'));
+ // Layout.css styles .sidebar-header, the class this header shares, with min-height: 72px.
+ const layout = readFileSync(join(here, '..', 'components', 'Layout.css'), 'utf8');
+ assert.match(layout, /\.sidebar-header\s*\{[^}]*min-height:\s*72px/, 'the dashboard header no longer sets a minimum');
+ assert.ok(
+ rulesFor('.chats-page .sidebar-header').some(body => /min-height:\s*0[;\s]/.test(body)),
+ 'the dashboard minimum stretches the chat list header',
+ );
+});