mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-05 16:02:03 +00:00
fix(settings): give the custom geodata URL fields their full width on phones
At 320-360px the six URL fields in Geodata > Custom URLs shared their row with the up/down move buttons, leaving each field only about 100-165px wide next to a full label. Let the field wrap onto its own row below 600px, so the input takes the full row and the move buttons drop to a row of their own beneath it, instead of squeezing the field down to a sliver.
This commit is contained in:
1 parent
84d64ff1d3
commit
3ec769af7e
3 files changed
+32
No files matched your search
@@ -247,6 +247,30 @@ test('URLs written from the config file carry a note until the page stores its o
|
||||
expect((await api.runtimeSettings()).geodata!.geosite.urls).toEqual(full.urls.geosite);
|
||||
});
|
||||
|
||||
for (const width of [320, 360])
|
||||
test(`at ${width}px the custom URL field spans the dialog, and the move buttons sit below it`, async ({page}) => {
|
||||
await page.setViewportSize({width, height: 800});
|
||||
await mockBackend(page);
|
||||
await page.goto('/#/settings');
|
||||
await pick(page, 'settings.geodataSource', t('settings.geodataCustom'));
|
||||
const dialog = page.getByRole('dialog', {name: t('settings.geodataCustomUrls')});
|
||||
const first = dialog.getByLabel(t('settings.geodataUrlLabel', {kind: 'geosite', n: '1'}), {exact: true});
|
||||
const {toolbarWidth, wrapWidth, buttonsBelowInput} = await first.evaluate(input => {
|
||||
const toolbar = input.closest('.rp-toolbar')!;
|
||||
const wrap = input.closest('.rp-input')!;
|
||||
const wrapBox = wrap.getBoundingClientRect();
|
||||
const buttons = [...toolbar.querySelectorAll('button')];
|
||||
return {
|
||||
toolbarWidth: toolbar.getBoundingClientRect().width,
|
||||
wrapWidth: wrapBox.width,
|
||||
buttonsBelowInput: buttons.every(b => b.getBoundingClientRect().top >= wrapBox.bottom - 1)
|
||||
};
|
||||
});
|
||||
// The field fills its own row; the move buttons no longer share it, so they cannot squeeze the field to a sliver.
|
||||
expect(wrapWidth).toBeCloseTo(toolbarWidth, 0);
|
||||
expect(buttonsBelowInput).toBe(true);
|
||||
});
|
||||
|
||||
test('without configurable sources the page keeps the plain geodata table in the actions card', async ({page}) => {
|
||||
const {capabilities} = await mockBackend(page);
|
||||
delete capabilities.resources.geodata.configurable_sources;
|
||||
|
||||
@@ -130,6 +130,7 @@ export function GeodataSettingsCard() {
|
||||
<TextField
|
||||
key={field.id}
|
||||
type="url"
|
||||
className="rp-url-field"
|
||||
spellCheck={false}
|
||||
autoComplete="off"
|
||||
label={field.label}
|
||||
|
||||
@@ -235,6 +235,13 @@
|
||||
.rp-icon.rp-up {
|
||||
rotate: 180deg;
|
||||
}
|
||||
/* On a phone the custom URL field takes its row alone, full width under the label; the move buttons wrap onto their
|
||||
own row below it instead of squeezing the field down to a sliver beside them. */
|
||||
@media (max-width: 599.98px) {
|
||||
.rp-url-field .rp-input {
|
||||
min-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Configuration page: diagnostics and unmodelled subscription lines wrap instead of overflowing the card. */
|
||||
.rp-config-diagnostics .rp-light {
|
||||
|
||||
Reference in new issue
Block a user