Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): let webhook filter rows wrap on phones
Yudhi Armyndharis53d7377fb69b
diff --git a/dashboard/src/components/FilterBuilder.css b/dashboard/src/components/FilterBuilder.cssindex 0300f66fc..87b25b9fc 100644--- a/dashboard/src/components/FilterBuilder.css+++ b/dashboard/src/components/FilterBuilder.css@@ -93,6 +93,23 @@stroke: var(--error);}+/* On a phone the field and the operator share the first row, and the value and the remove button the second,+ instead of what the fixed bases above leave of one row. The 3.5rem is the 40px button, a gap and slack. */+@media (max-width: 600px) {+ .filter-row {+ flex-wrap: wrap;+ }++ .filter-field,+ .filter-operator {+ flex: 1 1 6rem;+ }++ .filter-value {+ flex: 1 1 calc(100% - 3.5rem);+ }+}+.filter-add {align-self: flex-start;display: inline-flex;diff --git a/dashboard/src/components/FilterBuilder.responsive.test.ts b/dashboard/src/components/FilterBuilder.responsive.test.tsnew file mode 100644index 000000000..8270c7586--- /dev/null+++ b/dashboard/src/components/FilterBuilder.responsive.test.ts@@ -0,0 +1,26 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import { decl, readRules } from '../test-helpers/css-rules.ts';++// A filter row never wrapped: the field and operator keep fixed bases, so in a phone-width dialog the value input+// was squeezed to 20 px (0 px at 360) and the remove button pushed out of the row. Below 600px the field and the+// operator share the first row, and the value and the remove button the second, in the order they have in the page.+const rules = readRules(new URL('./FilterBuilder.css', import.meta.url));+const narrow = rules.filter(r => r.media === '@media (max-width: 600px)');+const body = (selector: string): string => narrow.find(r => r.selectors.includes(selector))?.body ?? '';++test('a filter row wraps on a phone', () => {+ assert.equal(decl(body('.filter-row'), 'flex-wrap'), 'wrap');+});++test('the filter value shares a row with the remove button on a phone, without reordering', () => {+ assert.equal(decl(body('.filter-value'), 'flex'), '1 1 calc(100% - 3.5rem)');+ // order would move the value before the remove button on screen and leave the keyboard order behind.+ assert.equal(decl(body('.filter-value'), 'order'), undefined);+});++test('the field and the operator share the first row', () => {+ for (const selector of ['.filter-field', '.filter-operator']) {+ assert.equal(decl(body(selector), 'flex'), '1 1 6rem', selector);+ }+});