Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): wrap the Number Checker header, tabs and buttons

Yudhi Armyndharis975dbc6f5193
diff --git a/dashboard/src/pages/NumberChecker.css b/dashboard/src/pages/NumberChecker.css
index 344e182ec..afcca1d6e 100644
--- a/dashboard/src/pages/NumberChecker.css
+++ b/dashboard/src/pages/NumberChecker.css
@@ -10,6 +10,11 @@
margin-bottom: 2rem;
}
+/* A long title and the badge beside it (de, es, tr) take two rows on a narrow screen instead of running past it. */
+.number-checker .page-header__title-group {
+ flex-wrap: wrap;
+}
+
.number-checker .nc-alert {
display: flex;
align-items: center;
@@ -65,6 +70,7 @@
.number-checker /* Tabs */
.nc-tabs {
display: flex;
+ flex-wrap: wrap;
gap: 0.5rem;
border-bottom: 1px solid var(--border);
margin-bottom: 1.5rem;
@@ -567,6 +573,8 @@
.number-checker .nc-format-pill {
display: inline-flex;
+ flex-wrap: wrap;
+ max-width: 100%;
align-items: center;
gap: 0.35rem;
font-size: 0.78rem;
diff --git a/dashboard/src/pages/NumberChecker.css.test.ts b/dashboard/src/pages/NumberChecker.css.test.ts
index acd3aea63..c3586e96d 100644
--- a/dashboard/src/pages/NumberChecker.css.test.ts
+++ b/dashboard/src/pages/NumberChecker.css.test.ts
@@ -19,3 +19,21 @@ test('the table container scrolls sideways', () => {
assert.ok(rule, 'no rule for the table container');
assert.match(rule[1], /overflow-x:\s*auto/);
});
+
+// Long labels in the other languages ("Massenpruefung", a Telugu export button) do not fit one row at 320 to 390 px.
+for (const [what, selector] of [
+ ['the mode tab strip', '\\.nc-tabs'],
+ ['the page header title row, so its badge drops below the title', '\\.page-header__title-group'],
+ ['the format preview pill', '\\.nc-format-pill'],
+] as const) {
+ test(`${what} wraps instead of running past the screen`, () => {
+ const rules = [...css.matchAll(new RegExp(`\\.number-checker[^{]*${selector}\\s*\\{([^}]*)\\}`, 'g'))].map(
+ m => m[1],
+ );
+ assert.ok(rules.length > 0, `no rule for ${what}`);
+ assert.ok(
+ rules.some(rule => /flex-wrap:\s*wrap/.test(rule)),
+ `${what} does not wrap`,
+ );
+ });
+}
diff --git a/dashboard/src/pages/NumberChecker.test.ts b/dashboard/src/pages/NumberChecker.test.ts
index fc22acc3d..37eab53de 100644
--- a/dashboard/src/pages/NumberChecker.test.ts
+++ b/dashboard/src/pages/NumberChecker.test.ts
@@ -486,6 +486,18 @@ test('NumberChecker: a finished single check is announced through a status regio
assert.match(region.textContent ?? '', /\+6581234567.*Registered on WhatsApp/);
});
+test('NumberChecker: the Start and Export buttons wrap onto another row instead of running past a narrow screen', async () => {
+ stubLookups(registered);
+ const { container } = renderComponent();
+ rtl.fireEvent.change(await openBulkTab(), { target: { value: '911111111111' } });
+ startBatch();
+ await rtl.screen.findByText('+911111111111');
+ const row = rtl.screen.getByRole('button', { name: /Export Results/i }).parentElement as HTMLElement;
+ assert.equal(row.style.display, 'flex');
+ assert.equal(row.style.flexWrap, 'wrap');
+ assert.equal(row.contains(container.querySelector('.nc-btn-primary')), true);
+});
+
test('NumberChecker: viewers cannot start single or bulk lookups, including with Enter', async () => {
const lookups: string[] = [];
globalThis.fetch = ((input: RequestInfo | URL) => {
diff --git a/dashboard/src/pages/NumberChecker.tsx b/dashboard/src/pages/NumberChecker.tsx
index 93251a3a7..7834d15ba 100644
--- a/dashboard/src/pages/NumberChecker.tsx
+++ b/dashboard/src/pages/NumberChecker.tsx
@@ -833,7 +833,7 @@ export function NumberChecker() {
</div>
</div>
- <div style={{ display: 'flex', gap: '0.75rem', marginBottom: '1.5rem' }}>
+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.75rem', marginBottom: '1.5rem' }}>
{!isCheckingBatch ? (
<button
className="nc-btn nc-btn-primary"