Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): wrap long API key names inside the phone cards

Yudhi Armyndharisa31263247a58
diff --git a/dashboard/src/pages/ApiKeys.css b/dashboard/src/pages/ApiKeys.css
index 57dcb60b1..f55f7dc41 100644
--- a/dashboard/src/pages/ApiKeys.css
+++ b/dashboard/src/pages/ApiKeys.css
@@ -535,6 +535,8 @@
font-weight: 600;
display: block;
color: var(--text-primary);
+ white-space: normal;
+ overflow-wrap: anywhere;
}
/* Key cell */
diff --git a/dashboard/src/pages/ApiKeys.responsive.test.ts b/dashboard/src/pages/ApiKeys.responsive.test.ts
new file mode 100644
index 000000000..d3a7aef91
--- /dev/null
+++ b/dashboard/src/pages/ApiKeys.responsive.test.ts
@@ -0,0 +1,18 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { decl, readRules } from '../test-helpers/css-rules.ts';
+
+// On a phone the key table becomes a stack of cards. The name keeps white-space: nowrap from the table layout,
+// so a long name ran out of its card and out of the viewport.
+const rules = readRules(new URL('./ApiKeys.css', import.meta.url));
+
+test('a long key name wraps inside its card on a phone', () => {
+ const card = rules.filter(
+ r =>
+ r.media === '@media (max-width: 768px)' &&
+ r.selectors.includes('.api-keys-page .keys-table tbody tr.table-row td:first-child .name-cell'),
+ );
+ assert.equal(card.length, 1, 'no mobile rule for the name in the card');
+ assert.equal(decl(card[0].body, 'white-space'), 'normal');
+ assert.equal(decl(card[0].body, 'overflow-wrap'), 'anywhere');
+});