Dawnline 0.10.0
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
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
- Portal redesigned from scratch. No header bar: the page opens with the server's name and the person's and fades under the edges. Device cards show the status, the last 7 days (hover a day for its figures) and a Connect or Update button; "Your access" folds into rows: what they can reach (with the names at home), data this month day by day, and when access ends. The page follows the system's light or dark theme - Adding a device: pick the kind (PC, Mobile, Router, Other) and a name, or add it from the device itself with the page's QR code. The set-up sheet then shows the app for that system and the connection, waits for the first connection, says "<device> connected" and closes on its own - Switching apps in the set-up sheet changes only what differs: the old words blur into the new ones, and the menu path is shown for iOS and Android in one line. Names, numbers and statuses that change on the page morph in place - Dialogs open in the middle on a computer, on the same spring as the menu; buttons that wait for the router show a spinner at once - A paused account gets one card that says so; the page's messages are short and no longer send people to the admin. A QR code of the page sits beside the breadcrumb, to open it on another device - Allowed hours are shown in the visitor's own time zone - The portal's Title setting is gone: the page and its tab take the server's name. A title set before is removed on upgrade - The admin names .conf files after the server too, as the portal does (Outline-Home.conf); its device menu says "Download AmneziaWG config" and "Copy AmneziaVPN config", and its QR codes use the portal's round look in the admin's light or dark colours - README rewritten, with screenshots made from a demo cast (scripts/capture-screenshots.mjs --demo)
This commit is contained in:
1 parent
edeb1506fd
commit
4f12ca19e7
94 files changed
+8076
-5009
No files matched your search
@@ -0,0 +1,104 @@
|
||||
// The ⋯ menu: a small panel under (or over) its button, items with an icon,
|
||||
// a highlight that glides after the pointer and takes the item's colour
|
||||
// (orange for Reconnect, red for Remove). One at a time; it closes on a press
|
||||
// outside, on scroll, on Escape and when its button is pressed again.
|
||||
|
||||
import { h, ic } from '../dom';
|
||||
import { EASE_IN, POP, play } from '../motion';
|
||||
|
||||
export interface MenuItem {
|
||||
label: string;
|
||||
icon: string;
|
||||
tone?: 'warn' | 'bad';
|
||||
run: () => unknown;
|
||||
}
|
||||
|
||||
let menuEl: HTMLElement | null = null;
|
||||
/** The button the open menu belongs to: pressing it again closes the menu. */
|
||||
let anchorEl: HTMLElement | null = null;
|
||||
|
||||
export const menuOpen = () => !!menuEl;
|
||||
|
||||
/** `now`: gone at once (Escape, or another menu opening). */
|
||||
export function closeMenu(now = false) {
|
||||
const m = menuEl;
|
||||
if (!m) return;
|
||||
menuEl = null;
|
||||
anchorEl?.setAttribute('aria-expanded', 'false');
|
||||
anchorEl = null;
|
||||
if (now) {
|
||||
m.remove();
|
||||
return;
|
||||
}
|
||||
play(m, [{ opacity: 1 }, { opacity: 0, transform: 'scale(.96)', filter: 'blur(3px)' }], {
|
||||
duration: 120,
|
||||
easing: EASE_IN,
|
||||
fill: 'forwards',
|
||||
}).onfinish = () => m.remove();
|
||||
}
|
||||
|
||||
/** `items`: null is a separator, kept only between items. */
|
||||
export function openMenu(anchor: HTMLElement, all: (MenuItem | null)[]) {
|
||||
if (anchorEl === anchor && menuEl) return closeMenu();
|
||||
closeMenu(true);
|
||||
const items = all.filter((it, i) => it || (i > 0 && all[i - 1] && all.slice(i + 1).some(Boolean)));
|
||||
const hl = h('span', { class: 'menu-hl' });
|
||||
const m = h('div', { class: 'menu', role: 'menu' }, hl);
|
||||
for (const it of items) {
|
||||
if (!it) {
|
||||
m.appendChild(h('div', { class: 'menu-sep' }));
|
||||
continue;
|
||||
}
|
||||
const b = h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
role: 'menuitem',
|
||||
class: `mi ${it.tone ?? ''}`,
|
||||
onclick: () => {
|
||||
closeMenu();
|
||||
it.run();
|
||||
},
|
||||
},
|
||||
ic(it.icon),
|
||||
h('span', {}, it.label),
|
||||
);
|
||||
// The highlight comes in where the pointer is, then glides from item to item.
|
||||
b.addEventListener('pointerenter', () => {
|
||||
hl.className = `menu-hl${hl.style.opacity === '1' ? ' moving' : ''} ${it.tone ?? ''}`;
|
||||
hl.style.transform = `translateY(${b.offsetTop - 6}px)`;
|
||||
hl.style.opacity = '1';
|
||||
});
|
||||
m.appendChild(b);
|
||||
}
|
||||
m.addEventListener('pointerleave', () => (hl.style.opacity = '0'));
|
||||
document.body.appendChild(m);
|
||||
const r = anchor.getBoundingClientRect();
|
||||
const w = m.offsetWidth;
|
||||
const mh = m.offsetHeight;
|
||||
// Under the button, or over it where the screen ends: it grows out of the button either way.
|
||||
const below = r.bottom + 8 + mh < innerHeight - 8;
|
||||
m.style.left = `${Math.max(12, Math.min(r.right - w, innerWidth - w - 12))}px`;
|
||||
m.style.top = `${below ? r.bottom + 8 : r.top - 8 - mh}px`;
|
||||
m.style.transformOrigin = `${below ? 'top' : 'bottom'} right`;
|
||||
play(
|
||||
m,
|
||||
[
|
||||
{ opacity: 0, transform: 'scale(.9)', filter: 'blur(4px)' },
|
||||
{ opacity: 1, transform: 'none', filter: 'none' },
|
||||
],
|
||||
{
|
||||
duration: POP.duration,
|
||||
easing: POP.easing,
|
||||
},
|
||||
);
|
||||
menuEl = m;
|
||||
anchorEl = anchor;
|
||||
anchor.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
|
||||
document.addEventListener('pointerdown', (e) => {
|
||||
const t = e.target as Element;
|
||||
if (menuEl && !menuEl.contains(t) && !anchorEl?.contains(t)) closeMenu();
|
||||
});
|
||||
addEventListener('scroll', () => closeMenu(), { passive: true });
|
||||
Reference in new issue
Block a user