Dawnline 0.12.1
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions

- Device cards on a computer keep "↓ 3.2 GB ↑ 557 MB" on one line, clear of
  the week's bars (0.12.0 let them run together in the two columns). A
  narrow card gets slightly smaller numbers and thinner bars, with the bars
  in the middle of the row; resizing the window, the card glides between
  its two shapes
- A device whose settings changed shows one big Reconnect button, the same
  as Connect on a device not set up yet, in place of its week and the
  orange Update pill. It opens the same question as Reconnect in the ⋯ menu
This commit is contained in:
Aemeath committed 2026-10-20 21:54:42 +03:00
1 parent fb73ac3a9f
commit db9657c01c
11 files changed
+145 -101

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "dawnline-web",
"version": "0.12.0",
"version": "0.12.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "dawnline-web",
"version": "0.12.0",
"version": "0.12.1",
"license": "MIT",
"dependencies": {
"qrcode-generator": "1.4.4"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dawnline-web",
"version": "0.12.0",
"version": "0.12.1",
"private": true,
"license": "MIT",
"type": "module",
+4 -12
View File
@@ -640,10 +640,6 @@ msgstr ""
msgid "Its connection stops working at once. You can add it again later."
msgstr ""
#: web/src/portal/page/devices.ts
msgid "Its settings changed: update the connection"
msgstr ""
#: web/src/shared/format.ts
msgid "KB"
msgstr ""
@@ -939,6 +935,10 @@ msgstr ""
msgid "Reconnect"
msgstr ""
#: web/src/portal/page/devices.ts
msgid "Reconnect %s"
msgstr ""
#: web/src/portal/flows/device-actions.ts
msgid "Reconnect %s?"
msgstr ""
@@ -1196,14 +1196,6 @@ msgstr ""
msgid "Unknown service %s."
msgstr ""
#: web/src/portal/page/devices.ts
msgid "Update"
msgstr ""
#: web/src/portal/page/devices.ts
msgid "Update the connection"
msgstr ""
#: web/src/portal/ui/bars.ts
msgid "Uploaded"
msgstr ""
+4 -12
View File
@@ -645,10 +645,6 @@ msgstr "Устройство получит новые ключи. Сейчас
msgid "Its connection stops working at once. You can add it again later."
msgstr "Подключение сразу перестанет работать. Устройство можно будет добавить снова."
#: web/src/portal/page/devices.ts
msgid "Its settings changed: update the connection"
msgstr "Настройки изменились: обновите подключение"
#: web/src/shared/format.ts
msgid "KB"
msgstr "КБ"
@@ -944,6 +940,10 @@ msgstr "QR-код"
msgid "Reconnect"
msgstr "Переподключить"
#: web/src/portal/page/devices.ts
msgid "Reconnect %s"
msgstr "Переподключить %s"
#: web/src/portal/flows/device-actions.ts
msgid "Reconnect %s?"
msgstr "Переподключить «%s»?"
@@ -1201,14 +1201,6 @@ msgstr "Неизвестный сервер."
msgid "Unknown service %s."
msgstr "Неизвестный сервис %s."
#: web/src/portal/page/devices.ts
msgid "Update"
msgstr "Обновить"
#: web/src/portal/page/devices.ts
msgid "Update the connection"
msgstr "Обновить подключение"
#: web/src/portal/ui/bars.ts
msgid "Uploaded"
msgstr "Отправлено"
+51 -35
View File
@@ -25,7 +25,7 @@ export const reachableFromHome = (p: Person, d: Device) => p.access !== 'interne
/** The status line: its class and words (short, on one line; the full wording shows on hover). */
function statusOf(d: Device, p: Person): [string, string] {
if (d.disabled) return ['', _('Disabled')];
// The Update pill beside it says what to do.
// The Reconnect button under it says what to do.
if (d.config_stale && d.handshake) return ['warn-t', _('Settings changed')];
// Over the data limit or outside the hours the tunnel stays up but passes nothing: the app says
// "connected", so say here why nothing works.
@@ -65,42 +65,25 @@ function dayName(back: number): string {
}
/** Last 7 days down and up over their bars; a day under the pointer puts its own numbers in their place. */
function usage(d: Device, stale: boolean): HTMLElement {
function usage(d: Device): HTMLElement {
const week = sumDays(d.spark);
const lbl = h('span', { class: 'use-lbl' }, _('Last 7 days'));
const val = upDown(d.id);
val.set(week);
let side: HTMLElement;
if (stale)
side = h(
'button',
{
type: 'button',
class: 'upd-pill',
'aria-label': _('Update the connection'),
title: _('Its settings changed: update the connection'),
onclick: () => reconnect(d),
},
ic('refresh'),
h('span', {}, _('Update')),
);
else {
const chart = bars(d.spark, 'bars-week', 34);
side = chart.el;
chart.cols.forEach((col, i) => {
const back = d.spark.length - 1 - i;
// What the pointer reads off the bars changes at once: no morph while it moves.
col.addEventListener('pointerenter', () => {
setText(lbl, dayName(back));
val.set(d.spark[i]);
});
col.addEventListener('pointerleave', () => {
setText(lbl, _('Last 7 days'));
val.set(week);
});
const chart = bars(d.spark, 'bars-week', 34);
chart.cols.forEach((col, i) => {
const back = d.spark.length - 1 - i;
// What the pointer reads off the bars changes at once: no morph while it moves.
col.addEventListener('pointerenter', () => {
setText(lbl, dayName(back));
val.set(d.spark[i]);
});
}
return h('div', { class: 'dev-use' }, h('div', { class: 'use-txt' }, lbl, h('span', { class: 'use-val' }, val.el)), side);
col.addEventListener('pointerleave', () => {
setText(lbl, _('Last 7 days'));
val.set(week);
});
});
return h('div', { class: 'dev-use' }, h('div', { class: 'use-txt' }, lbl, h('span', { class: 'use-val' }, val.el)), chart.el);
}
function card(d: Device, st: State): HTMLElement {
@@ -149,7 +132,8 @@ function card(d: Device, st: State): HTMLElement {
),
more,
),
// Stopped by the admin: a device never set up has nothing to show.
// Stopped by the admin: a device never set up has nothing to show. Its settings changed: Reconnect in
// place of its week (new keys, then set it up again), as a device not set up yet shows Connect.
setUp && locked
? null
: setUp
@@ -164,7 +148,19 @@ function card(d: Device, st: State): HTMLElement {
ic('qr'),
h('span', {}, _('Connect')),
)
: usage(d, stale),
: stale
? h(
'button',
{
type: 'button',
class: 'btn tint block setup-btn',
'aria-label': fmt(_('Reconnect %s'), d.name),
onclick: () => reconnect(d),
},
ic('refresh'),
h('span', {}, _('Reconnect')),
)
: usage(d),
);
}
@@ -189,15 +185,35 @@ const addCard = () =>
/** The section, built once; `fill` puts the cards in. */
export function devicesSection(): HTMLElement {
const grid = h('div', { class: 'dgrid' });
snapOnJump(grid);
return h(
'section',
{ class: 'devices', id: 'devices', 'aria-label': _('Your devices') },
h('div', { class: 'sec-head' }, h('h2', {}, _('Your devices')), h('span', { class: 'aside num' })),
h('div', { class: 'dgrid' }),
grid,
h('p', { class: 'note-s limit', hidden: true }),
);
}
/**
* A card whose width jumps (the grid changed its columns: a window across 560 or 960 px, a phone turned)
* takes its new shape with the layout, at once: gliding there from the old one, its numbers would not fit
* for a moment and wrap. A threshold crossed while the window is resized a little at a time still glides
* (devices.css). The class goes on before the frame is painted, so the glide that began never shows.
*/
function snapOnJump(grid: HTMLElement) {
let was = 0;
new ResizeObserver(() => {
const w = grid.querySelector('.dev')?.getBoundingClientRect().width ?? 0;
if (Math.abs(w - was) > 16) {
grid.classList.add('snap');
requestAnimationFrame(() => requestAnimationFrame(() => grid.classList.remove('snap')));
}
was = w;
}).observe(grid);
}
/** The cards for this state, moving from where they were. */
export function fillDevices(section: HTMLElement, st: State, o: RepaintOpts = {}) {
const p = st.person;
+30 -3
View File
@@ -12,6 +12,7 @@
}
.bars-week {
--gap: 4px;
transition: margin var(--fit);
}
.bars .col {
display: flex;
@@ -38,7 +39,19 @@
.bars-week i {
width: 6px;
border-radius: 3px;
transition-duration: 150ms;
transition:
background-color 150ms,
width var(--fit),
border-radius var(--fit);
}
/* A card turning compact (devices.css) thins the week's bars and their gaps: they glide there. */
.bars-week .col {
transition: padding var(--fit);
}
.bars-week .axis {
transition:
left var(--fit),
right var(--fit);
}
.bars .dn {
background: color-mix(in srgb, var(--text) 24%, transparent);
@@ -77,14 +90,16 @@
/* ↓ down ↑ up: the arrows are the line icon turned; the upload one step quieter. */
.ud {
display: inline-flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
white-space: nowrap;
column-gap: 10px;
transition: column-gap var(--fit);
}
.ud > span {
display: inline-flex;
align-items: center;
gap: 2px;
white-space: nowrap;
}
.ud .i {
width: 0.8em;
@@ -102,3 +117,15 @@
transform: rotate(-90deg);
color: var(--text-3);
}
@media (prefers-reduced-motion: reduce) {
.bars-week,
.bars-week .col,
.bars-week .axis,
.ud {
transition: none;
}
.bars-week i {
transition: background-color 150ms;
}
}
+45 -28
View File
@@ -1,5 +1,5 @@
/* "Your devices": the grid, a card per device (its glass icon, name and one-line status, ⋯; the week
as a number and bars, the Update pill, or Connect), the card that adds one, the first device. */
as down and up over bars, or Connect or Reconnect), the card that adds one, the first device. */
.dgrid {
display: grid;
@@ -19,6 +19,9 @@
flex-direction: column;
gap: 8px;
min-width: 0;
container: card / inline-size;
/* How a card glides between its full and compact shapes (a window resized across 330 or 270 px). */
--fit: var(--spring-smooth-dur, 524ms) var(--spring-smooth, ease);
}
.dev.is-here {
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent);
@@ -75,14 +78,16 @@
border-radius: var(--r-row);
padding: 12px 14px 12px 16px;
display: flex;
align-items: flex-end;
align-items: center;
justify-content: space-between;
gap: 12px;
gap: 16px;
min-height: 66px;
}
/* The words take what the bars leave, never more. */
.use-txt {
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
.use-lbl {
@@ -96,36 +101,37 @@
line-height: 24px;
font-weight: 500;
letter-spacing: -0.02em;
transition:
font-size var(--fit),
line-height var(--fit);
}
.dev .setup-btn {
margin-top: auto;
}
.upd-pill {
display: inline-flex;
align-items: center;
align-self: center;
gap: 6px;
height: 32px;
padding: 0 12px 0 10px;
border-radius: 999px;
flex: none;
background: color-mix(in srgb, var(--warn) 14%, transparent);
color: var(--warn);
font-size: 13px;
font-weight: 600;
transition:
background-color 150ms,
transform 150ms var(--ease-out);
/* A card under 330 px (a computer's two columns; the query reads inside its 8 px padding) keeps down and up on
one line by being compact: smaller numbers, thinner bars. A phone's card stays as it is. */
@container card (max-width: 313px) {
.use-val {
font-size: 15px;
line-height: 22px;
}
.bars-week {
--gap: 3px;
}
.bars-week i {
width: 4px;
border-radius: 2px;
}
}
.upd-pill:hover {
background: color-mix(in srgb, var(--warn) 22%, transparent);
}
.upd-pill:active {
transform: scale(0.94);
}
.upd-pill .i {
width: 14px;
height: 14px;
/* The narrowest (under 270 px): a step smaller again, so a day under the pointer fits as well as the week. */
@container card (max-width: 253px) {
.use-val {
font-size: 14px;
line-height: 22px;
}
.use-val .ud {
column-gap: 8px;
}
}
.dev.add {
align-items: center;
@@ -178,3 +184,14 @@
.dev.first .btn {
max-width: 320px;
}
/* A jump of the cards' width: the new shape at once, with the layout (page/devices.ts). */
.dgrid.snap .dev * {
transition: none;
}
@media (prefers-reduced-motion: reduce) {
.use-val {
transition: none;
}
}