mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-29 20:54:00 +01:00
Compare commits
No commits in common. "b1424a5bea375d4a94ec093f93af28c30da6d99b" and "ec8d7621978241aa943049009051fc247934adba" have entirely different histories.
b1424a5bea
...
ec8d762197
@ -7,7 +7,7 @@ Part of the web control API ([DOCS-web-control-api.md](DOCS-web-control-api.md))
|
|||||||
`GET /api/icon-words` → `IconLedger`; `POST` or `PUT /api/icon-words/{icon_id}` with `{word?, glyph?}` → `IconLedger` (200). Writes need Host, Origin and `X-SBE-Token` like every non-GET. TS mirror: `web/src/api/iconWordsContract.ts`.
|
`GET /api/icon-words` → `IconLedger`; `POST` or `PUT /api/icon-words/{icon_id}` with `{word?, glyph?}` → `IconLedger` (200). Writes need Host, Origin and `X-SBE-Token` like every non-GET. TS mirror: `web/src/api/iconWordsContract.ts`.
|
||||||
|
|
||||||
- **Ledger** `web/src/ui/icon_words.json` (a repo file the user commits; `SBE_ICON_WORDS` overrides the path): `{"version":1,"icons":{"<id>":{"word":"<text>"|null,"glyph":"<emoji>"|null}}}`. Absent id = unanswered; no `word` key = only a glyph chosen; `word: null` = skipped (no label); `glyph: null` = default. The server reads it per request and never builds from it (`_web_build` ignores it); writes go to a sibling temp file, then rename.
|
- **Ledger** `web/src/ui/icon_words.json` (a repo file the user commits; `SBE_ICON_WORDS` overrides the path): `{"version":1,"icons":{"<id>":{"word":"<text>"|null,"glyph":"<emoji>"|null}}}`. Absent id = unanswered; no `word` key = only a glyph chosen; `word: null` = skipped (no label); `glyph: null` = default. The server reads it per request and never builds from it (`_web_build` ignores it); writes go to a sibling temp file, then rename.
|
||||||
- **Registry** `web/src/icons/registry.json`: id → default glyph, spoken name, description, 3 suggested words, 3 alternative glyphs (`registry.ts` types it). It lists every icon the UI paints, in picker order: new ids go at the end so answered icons keep their place and the picker opens at the first unanswered one. Ids match `[a-z][a-z0-9_.-]{0,63}`. `web/src/icons/coverage.test.ts` fails on any pictograph or icon symbol typed as a literal in non-test source; draw icons with `glyph(id)`, `iconInline(id)`, `iconMark(id)` or `pill(tone, text, id)`.
|
- **Registry** `web/src/icons/registry.json`: id → default glyph, spoken name, description, 3 suggested words, 3 alternative glyphs (`registry.ts` types it).
|
||||||
- **`word`**: any text; casing kept, whitespace runs collapsed; 1–40 characters, no control characters, else `invalid_params`. `null` skips. **`glyph`**: the default or one of the icon's 3 alternatives (the default is stored as `null`), else `invalid_params`. Unknown id → `not_found`; empty body or unknown key → `invalid_params`.
|
- **`word`**: any text; casing kept, whitespace runs collapsed; 1–40 characters, no control characters, else `invalid_params`. `null` skips. **`glyph`**: the default or one of the icon's 3 alternatives (the default is stored as `null`), else `invalid_params`. Unknown id → `not_found`; empty body or unknown key → `invalid_params`.
|
||||||
- Every served `.html` page carries the ledger as `<script type="application/json" id="sbe-icon-words">` (`<` escaped), so a pick shows on the next page load.
|
- Every served `.html` page carries the ledger as `<script type="application/json" id="sbe-icon-words">` (`<` escaped), so a pick shows on the next page load.
|
||||||
- **Corrupt ledger** (bad JSON or schema): copied to `<ledger>.corrupt` (an older copy is never overwritten) and left in place; every read and write answers `op_failed` (500) naming the copy until someone fixes it. Pages then carry that error body and draw no words.
|
- **Corrupt ledger** (bad JSON or schema): copied to `<ledger>.corrupt` (an older copy is never overwritten) and left in place; every read and write answers `op_failed` (500) naming the copy until someone fixes it. Pages then carry that error body and draw no words.
|
||||||
|
|||||||
@ -1,59 +0,0 @@
|
|||||||
"""The shipped icon registry and the user's ledger against the server's rules."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from steam_backlog_enforcer import _web_icon_words
|
|
||||||
|
|
||||||
LEDGER_FILE = (
|
|
||||||
Path(_web_icon_words.__file__).resolve().parent.parent
|
|
||||||
/ "web"
|
|
||||||
/ "src"
|
|
||||||
/ "ui"
|
|
||||||
/ "icon_words.json"
|
|
||||||
)
|
|
||||||
# The same shape the route accepts for ``/api/icon-words/{icon}``.
|
|
||||||
ICON_ID = re.compile(r"[a-z][a-z0-9_.-]{0,63}")
|
|
||||||
VARIATION_SELECTOR = "️"
|
|
||||||
|
|
||||||
|
|
||||||
def _registry() -> dict[str, dict[str, Any]]:
|
|
||||||
return _web_icon_words.load_registry()
|
|
||||||
|
|
||||||
|
|
||||||
def _look(glyph: str) -> str:
|
|
||||||
"""The glyph without its emoji variation selector."""
|
|
||||||
return glyph.replace(VARIATION_SELECTOR, "")
|
|
||||||
|
|
||||||
|
|
||||||
def test_every_registered_id_fits_the_route() -> None:
|
|
||||||
"""A registered id the route cannot match could never be saved."""
|
|
||||||
registry = _registry()
|
|
||||||
assert len(registry) > 45
|
|
||||||
assert [i for i in registry if not ICON_ID.fullmatch(i)] == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_every_entry_is_complete() -> None:
|
|
||||||
"""Each icon has a description, 3 one-word suggestions and 3 alternatives."""
|
|
||||||
for icon, entry in _registry().items():
|
|
||||||
looks = {_look(entry["glyph"]), *(_look(a) for a in entry["alts"])}
|
|
||||||
assert entry["spoken"], icon
|
|
||||||
assert len(entry["desc"]) > 20, icon
|
|
||||||
assert len({w.lower() for w in entry["words"]}) == 3, icon
|
|
||||||
assert all(re.fullmatch(r"\S+", w) for w in entry["words"]), icon
|
|
||||||
assert len(entry["alts"]) == 3, icon
|
|
||||||
assert len(looks) == 4, icon
|
|
||||||
|
|
||||||
|
|
||||||
def test_the_users_ledger_only_names_registered_icons() -> None:
|
|
||||||
"""Every ledger answer belongs to an icon, and a chosen glyph is one of its own."""
|
|
||||||
registry = _registry()
|
|
||||||
icons = json.loads(LEDGER_FILE.read_text("utf-8"))["icons"]
|
|
||||||
assert [i for i in icons if i not in registry] == []
|
|
||||||
for icon, choice in icons.items():
|
|
||||||
glyph = choice.get("glyph")
|
|
||||||
assert glyph is None or glyph in registry[icon]["alts"], icon
|
|
||||||
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
import type { CommandName, CommandSpec, InstalledGame } from '../api/contract'
|
import type { CommandName, CommandSpec, InstalledGame } from '../api/contract'
|
||||||
import type { IconId } from '../icons/registry'
|
import type { IconId } from '../icons/registry'
|
||||||
|
import { iconFor } from '../icons/render'
|
||||||
|
|
||||||
export type SectionPath =
|
export type SectionPath =
|
||||||
| '/'
|
| '/'
|
||||||
@ -50,6 +51,21 @@ export function commandIcon(name: CommandName): IconId {
|
|||||||
return `cmd.${name}` as const satisfies IconId
|
return `cmd.${name}` as const satisfies IconId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The glyph a command paints, for sites not yet on `glyph(commandIcon(…))`
|
||||||
|
* (they get the chosen alternative glyph, not the word). Live getters, so a
|
||||||
|
* ledger change shows without re-importing.
|
||||||
|
*/
|
||||||
|
export const COMMAND_ICON: Readonly<Record<CommandName, string>> = Object.defineProperties(
|
||||||
|
{},
|
||||||
|
Object.fromEntries(
|
||||||
|
(Object.keys(COMMAND_HOME) as CommandName[]).map((name) => [
|
||||||
|
name,
|
||||||
|
{ enumerable: true, get: () => iconFor(commandIcon(name)).glyph },
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
) as Record<CommandName, string>
|
||||||
|
|
||||||
/** Title-case label for buttons and the palette (`pick-manual` → `Pick manual`). */
|
/** Title-case label for buttons and the palette (`pick-manual` → `Pick manual`). */
|
||||||
export function commandLabel(name: CommandName): string {
|
export function commandLabel(name: CommandName): string {
|
||||||
const s = name.replace(/-/g, ' ')
|
const s = name.replace(/-/g, ' ')
|
||||||
|
|||||||
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import type { CommandName } from '../api/contract'
|
import type { CommandName } from '../api/contract'
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import type { IconId } from '../icons/registry'
|
import { iconMark, iconWord } from '../icons/render'
|
||||||
import { iconInline, iconMark, iconWord } from '../icons/render'
|
|
||||||
import { define, h, jsonAttr } from '../lib/dom'
|
import { define, h, jsonAttr } from '../lib/dom'
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
import { pageHref, runner, type Preset } from '../lib/runner'
|
import { pageHref, runner, type Preset } from '../lib/runner'
|
||||||
@ -55,13 +54,13 @@ export function commandButton({ name, preset, label, tone = 'ghost' }: ButtonPro
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
glyph,
|
glyph,
|
||||||
locked === null ? null : h('span', { class: 'cmd-lock', 'aria-hidden': 'true' }, iconInline('state.locked')),
|
locked === null ? null : h('span', { class: 'cmd-lock', 'aria-hidden': 'true' }, '🔒'),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A card flag (root, countdown): glyph painted, its word spoken. */
|
/** A card flag (root, countdown): glyph painted, its word spoken. */
|
||||||
function flag(id: IconId, spoken: string): HTMLSpanElement {
|
function flag(glyph: string, spoken: string): HTMLSpanElement {
|
||||||
return h('span', { class: 'pill pill-neutral', 'aria-label': spoken, role: 'img' }, iconInline(id))
|
return h('span', { class: 'pill pill-neutral', 'aria-label': spoken, role: 'img' }, glyph)
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommandButtonElement extends LiveElement {
|
export class CommandButtonElement extends LiveElement {
|
||||||
@ -91,8 +90,8 @@ export class CommandCardElement extends LiveElement {
|
|||||||
'h3',
|
'h3',
|
||||||
{ class: 'cmd-name' },
|
{ class: 'cmd-name' },
|
||||||
h('span', { class: 'sr-only' }, commandLabel(p.name)),
|
h('span', { class: 'sr-only' }, commandLabel(p.name)),
|
||||||
spec?.privileged ? flag('cmdflag.root', 'root') : null,
|
spec?.privileged ? flag('🔑', 'root') : null,
|
||||||
spec?.friction?.countdown_seconds ? flag('cmdflag.countdown', 'countdown') : null,
|
spec?.friction?.countdown_seconds ? flag('⏳', 'countdown') : null,
|
||||||
),
|
),
|
||||||
h('p', { class: 'cmd-desc sr-only' }, locked ?? spec?.description ?? '…'),
|
h('p', { class: 'cmd-desc sr-only' }, locked ?? spec?.description ?? '…'),
|
||||||
commandButton(p),
|
commandButton(p),
|
||||||
|
|||||||
@ -1,109 +0,0 @@
|
|||||||
// Pass-2 icon wiring for the command UI: the user's word shows right of the
|
|
||||||
// icon, a chosen alternative glyph replaces the default, and the spoken
|
|
||||||
// names (aria-label, .sr-only) stay as they were.
|
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
||||||
import { makeSpec, makePending } from '../test/fixtures'
|
|
||||||
import { mount, stubApi } from '../test/harness'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { must } from '../test/events'
|
|
||||||
import { painted } from '../test/painted'
|
|
||||||
import { visibleWords } from '../test/visibleWords'
|
|
||||||
import { NAV } from '../shell/nav'
|
|
||||||
import './commandButton'
|
|
||||||
import { CommandPaletteElement } from './palette'
|
|
||||||
import { PendingCountdown } from './pendingCountdown'
|
|
||||||
import { commandFlags, fillHint, lockedNotice, terminalFallback } from './runnerParts'
|
|
||||||
|
|
||||||
describe('command button and card', () => {
|
|
||||||
it('draws the lock badge with its word and glyph, aria unchanged', async () => {
|
|
||||||
useIcons({ 'state.locked': { word: 'closed', glyph: '🔐' } })
|
|
||||||
stubApi({ 'GET /api/commands': [makeSpec('scan', { locked_reason: 'A pick is active' })] })
|
|
||||||
const el = mount('<command-button name="scan"></command-button>')
|
|
||||||
await vi.waitFor(() => { expect(el.querySelector('.cmd-lock')).not.toBeNull() })
|
|
||||||
const lock = must(el.querySelector('.cmd-lock'))
|
|
||||||
expect(lock.textContent).toBe('🔐Closed')
|
|
||||||
expect(lock.querySelector('.icon-word')).toHaveAttribute('data-icon-word', 'state.locked')
|
|
||||||
expect(el.querySelector('button')).toHaveAttribute('aria-label', 'Run scan')
|
|
||||||
expect(el.querySelector('button')).toHaveAttribute('aria-description', 'A pick is active')
|
|
||||||
expect(visibleWords(el)).toEqual([])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('draws the root and countdown flags of a card by id', async () => {
|
|
||||||
useIcons({ 'cmdflag.root': { word: 'admin' }, 'cmdflag.countdown': { glyph: '⏲️' } })
|
|
||||||
stubApi({ 'GET /api/commands': [makeSpec('gaming-reset', { privileged: true, friction: { phrase_template: 'x', countdown_seconds: 300 } })] })
|
|
||||||
const el = mount('<command-card name="gaming-reset"></command-card>')
|
|
||||||
await vi.waitFor(() => { expect(el.querySelector('.cmd-name .pill')).not.toBeNull() })
|
|
||||||
const flags = [...el.querySelectorAll('.cmd-name .pill')]
|
|
||||||
expect(flags.map((f) => f.getAttribute('aria-label'))).toEqual(['root', 'countdown'])
|
|
||||||
expect(flags[0]?.textContent).toBe('🔑Admin')
|
|
||||||
expect(flags[1]?.textContent).toBe('⏲️')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('command palette', () => {
|
|
||||||
it('shows the search icon and its word in the placeholder, hint icons by id', async () => {
|
|
||||||
useIcons({ 'cmdpal.search': { word: 'find' }, 'cmdpal.open': { word: 'page', glyph: '🔗' }, 'cmdpal.go': { word: 'jump' } })
|
|
||||||
stubApi({ 'GET /api/commands': [makeSpec('status', { kind: 'view', description: 'Show status.' })] })
|
|
||||||
const el = new CommandPaletteElement()
|
|
||||||
document.body.append(el)
|
|
||||||
el.open()
|
|
||||||
await vi.waitFor(() => { expect(document.querySelectorAll('[role=option]').length).toBeGreaterThan(NAV.length + 1) })
|
|
||||||
expect(document.querySelector<HTMLInputElement>('[role=combobox]')).toHaveAttribute('placeholder', '🔍 Find')
|
|
||||||
const hints = [...document.querySelectorAll('.palette-hint')]
|
|
||||||
expect(hints[0]?.textContent).toContain('🔗Page')
|
|
||||||
expect(hints[0]?.querySelector('.sr-only')?.textContent).toBe('open /')
|
|
||||||
expect(hints.at(-1)?.textContent).toContain('🧭Jump')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('run dialog parts', () => {
|
|
||||||
it('draws the command flags by id', () => {
|
|
||||||
useIcons({ 'cmdflag.readonly': { word: 'safe' }, 'cmdflag.cancellable': { glyph: '🛑' } })
|
|
||||||
const flags = commandFlags(makeSpec('scan', { mutating: false, cancellable: true }))
|
|
||||||
const [, readonly, cancellable] = flags
|
|
||||||
expect(painted(readonly)).toBe('👁️Safe')
|
|
||||||
expect(readonly?.querySelector('.sr-only')?.textContent).toBe('Read-only')
|
|
||||||
expect(painted(cancellable)).toBe('🛑')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('paints the lock mark in the warning notice and keeps the spoken reason', () => {
|
|
||||||
useIcons({ 'state.locked': { word: 'sealed' } })
|
|
||||||
const el = lockedNotice('Daemon is down')
|
|
||||||
expect(el).toHaveAttribute('aria-label', 'Locked: Daemon is down')
|
|
||||||
expect(el.textContent).toBe('🔒Sealed')
|
|
||||||
expect(el.querySelector('.notice-icon')).toHaveAttribute('data-icon', 'state.locked')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('draws the fill hint and the terminal fallback by id', () => {
|
|
||||||
useIcons({ 'runner.fill': { word: 'above' }, 'runner.terminal': { glyph: '🐚' } })
|
|
||||||
expect(fillHint(['app_id']).textContent).toContain('⬆️Above')
|
|
||||||
const [line] = terminalFallback('sudo ./run.sh gaming-unblock')
|
|
||||||
expect(line).toHaveAttribute('aria-label', 'Run it from a terminal instead:')
|
|
||||||
expect(line.textContent).toBe('🐚')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('pending countdown', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
vi.useFakeTimers({ now: Date.parse('2026-10-10T10:00:00Z') })
|
|
||||||
})
|
|
||||||
const made: PendingCountdown[] = []
|
|
||||||
afterEach(() => {
|
|
||||||
for (const c of made.splice(0)) c.dispose()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('draws the lock beside the clock and the heartbeat, words and glyphs from the ledger', () => {
|
|
||||||
useIcons({ 'state.locked': { word: 'locked' }, 'pending.beat': { word: 'pulse', glyph: '💗' } })
|
|
||||||
const cbs = { onCommitted: vi.fn(), onCancel: vi.fn(), onRearm: vi.fn() }
|
|
||||||
const countdown = new PendingCountdown(makePending({ ready_at: '2026-10-10T10:00:30Z' }), cbs)
|
|
||||||
made.push(countdown)
|
|
||||||
document.body.append(countdown.el)
|
|
||||||
const clock = must(countdown.el.querySelector('.countdown-clock'))
|
|
||||||
expect(clock.textContent).toContain('🔒Locked')
|
|
||||||
expect(clock.querySelector('.sr-only')?.textContent).toBe('until commit unlocks')
|
|
||||||
expect(countdown.el.textContent).toContain('💗Pulse 0s')
|
|
||||||
expect(countdown.el.querySelector('button')).toHaveAttribute('aria-label', 'Cancel countdown')
|
|
||||||
expect(countdown.el.querySelector('button')?.textContent).toBe('✖️')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -4,8 +4,6 @@
|
|||||||
// via aria-activedescendant.
|
// via aria-activedescendant.
|
||||||
|
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { iconText } from '../icons/iconText'
|
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { define, h } from '../lib/dom'
|
import { define, h } from '../lib/dom'
|
||||||
import { uid } from '../lib/ids'
|
import { uid } from '../lib/ids'
|
||||||
import { pageHref, runner } from '../lib/runner'
|
import { pageHref, runner } from '../lib/runner'
|
||||||
@ -19,9 +17,10 @@ interface Entry {
|
|||||||
title: string
|
title: string
|
||||||
detail: string
|
detail: string
|
||||||
hint: string
|
hint: string
|
||||||
icon: IconId
|
/** A registered icon id (painted with the user's word) or a raw glyph. */
|
||||||
/** Painted in place of the hint: run, open the page, or navigate. */
|
icon: string
|
||||||
hintIcon: IconId
|
/** Painted in place of the hint: ▶️ run, ↗️ open, 🧭 navigate. */
|
||||||
|
hintIcon: string
|
||||||
locked: string | null
|
locked: string | null
|
||||||
act: () => void
|
act: () => void
|
||||||
}
|
}
|
||||||
@ -50,7 +49,7 @@ export class CommandPaletteElement extends HTMLElement {
|
|||||||
'aria-expanded': 'true',
|
'aria-expanded': 'true',
|
||||||
'aria-controls': `${this.listId}-list`,
|
'aria-controls': `${this.listId}-list`,
|
||||||
'aria-label': 'Search commands',
|
'aria-label': 'Search commands',
|
||||||
placeholder: iconText('cmdpal.search'),
|
placeholder: '🔍',
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
})
|
})
|
||||||
this.list = h('ul', { id: `${this.listId}-list`, role: 'listbox', class: 'palette-list', 'aria-label': 'Commands' })
|
this.list = h('ul', { id: `${this.listId}-list`, role: 'listbox', class: 'palette-list', 'aria-label': 'Commands' })
|
||||||
@ -113,13 +112,13 @@ export class CommandPaletteElement extends HTMLElement {
|
|||||||
|
|
||||||
private entries(): Entry[] {
|
private entries(): Entry[] {
|
||||||
return [
|
return [
|
||||||
...(q.commands.state.data ?? []).map((c): Entry => ({
|
...(q.commands.state.data ?? []).map((c) => ({
|
||||||
key: c.name,
|
key: c.name,
|
||||||
title: commandLabel(c.name),
|
title: commandLabel(c.name),
|
||||||
detail: c.description,
|
detail: c.description,
|
||||||
hint: c.kind === 'job' ? (c.friction ? 'run · confirm' : 'run') : `open ${COMMAND_HOME[c.name]}`,
|
hint: c.kind === 'job' ? (c.friction ? 'run · confirm' : 'run') : `open ${COMMAND_HOME[c.name]}`,
|
||||||
icon: commandIcon(c.name),
|
icon: commandIcon(c.name),
|
||||||
hintIcon: c.kind === 'job' ? (c.friction ? 'cmdpal.run-phrase' : 'runner.run') : 'cmdpal.open',
|
hintIcon: c.kind === 'job' ? (c.friction ? '▶️⌨️' : '▶️') : '↗️',
|
||||||
locked: c.locked_reason,
|
locked: c.locked_reason,
|
||||||
act: () => {
|
act: () => {
|
||||||
if (c.kind === 'job') runner.run(c.name)
|
if (c.kind === 'job') runner.run(c.name)
|
||||||
@ -129,13 +128,13 @@ export class CommandPaletteElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
...[...NAV, ...PALETTE_PAGES].map((n): Entry => ({
|
...[...NAV, ...PALETTE_PAGES].map((n) => ({
|
||||||
key: `nav:${n.to}`,
|
key: `nav:${n.to}`,
|
||||||
title: `Go to ${n.label}`,
|
title: `Go to ${n.label}`,
|
||||||
detail: n.blurb,
|
detail: n.blurb,
|
||||||
hint: 'navigate',
|
hint: 'navigate',
|
||||||
icon: n.icon,
|
icon: n.icon,
|
||||||
hintIcon: 'cmdpal.go',
|
hintIcon: '🧭',
|
||||||
locked: null,
|
locked: null,
|
||||||
act: () => {
|
act: () => {
|
||||||
this.close()
|
this.close()
|
||||||
@ -158,7 +157,7 @@ export class CommandPaletteElement extends HTMLElement {
|
|||||||
'li',
|
'li',
|
||||||
{ id: `${this.listId}-${i}`, role: 'option', 'aria-selected': String(i === this.active), class: i === this.active ? 'palette-item active' : 'palette-item' },
|
{ id: `${this.listId}-${i}`, role: 'option', 'aria-selected': String(i === this.active), class: i === this.active ? 'palette-item active' : 'palette-item' },
|
||||||
// Textgate: glyphs painted; title, detail and hint spoken only.
|
// Textgate: glyphs painted; title, detail and hint spoken only.
|
||||||
h('span', { class: 'palette-title' }, glyph(e.icon, e.title), e.locked ? pill('warning', 'locked', 'state.locked') : null),
|
h('span', { class: 'palette-title' }, glyph(e.icon, e.title), e.locked ? pill('warning', 'locked', '🔒') : null),
|
||||||
h('span', { class: 'palette-detail sr-only' }, e.locked ?? e.detail),
|
h('span', { class: 'palette-detail sr-only' }, e.locked ?? e.detail),
|
||||||
h('span', { class: 'palette-hint' }, glyph(e.hintIcon, e.hint)),
|
h('span', { class: 'palette-hint' }, glyph(e.hintIcon, e.hint)),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,32 +3,34 @@
|
|||||||
// never re-creates an input.
|
// never re-creates an input.
|
||||||
|
|
||||||
import type { ParamSpec } from '../api/contract'
|
import type { ParamSpec } from '../api/contract'
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { h } from '../lib/dom'
|
import { h } from '../lib/dom'
|
||||||
import { uid } from '../lib/ids'
|
import { uid } from '../lib/ids'
|
||||||
import { glyph } from '../ui/build'
|
|
||||||
import { paramError, type GameOption, type ParamValues } from './params'
|
import { paramError, type GameOption, type ParamValues } from './params'
|
||||||
|
|
||||||
/** Painted icon per parameter (textgate); the catalog label is spoken only. */
|
/** Painted glyph per parameter (textgate); the catalog label is spoken only. */
|
||||||
const PARAM_ICON: Record<string, IconId> = {
|
const PARAM_ICON: Record<string, string> = {
|
||||||
app_id: 'params.app_id',
|
app_id: '🎮',
|
||||||
backup_id: 'params.backup_id',
|
backup_id: '🗄️',
|
||||||
days: 'params.days',
|
days: '📅',
|
||||||
minutes: 'params.minutes',
|
minutes: '⏱️',
|
||||||
reason: 'params.reason',
|
reason: '💬',
|
||||||
replace: 'params.replace',
|
replace: '🔁',
|
||||||
demo: 'params.demo',
|
demo: '🧪',
|
||||||
}
|
}
|
||||||
|
|
||||||
function paramGlyph(spec: ParamSpec): HTMLSpanElement {
|
function paramGlyph(spec: ParamSpec): HTMLSpanElement {
|
||||||
return glyph(PARAM_ICON[spec.name] ?? 'params.other', spec.label)
|
return h(
|
||||||
|
'span',
|
||||||
|
{},
|
||||||
|
h('span', { 'aria-hidden': 'true' }, PARAM_ICON[spec.name] ?? '✏️'),
|
||||||
|
h('span', { class: 'sr-only' }, spec.label),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Field help: optional painted mark, sentence spoken only. */
|
/** Field help: optional painted mark, sentence spoken only. */
|
||||||
function spokenHelp(el: HTMLElement, mark: IconId | null, sentence: string): void {
|
function spokenHelp(el: HTMLElement, mark: string | null, sentence: string): void {
|
||||||
el.replaceChildren(
|
el.replaceChildren(
|
||||||
mark ? iconInline(mark) : '',
|
mark ? h('span', { 'aria-hidden': 'true' }, mark) : '',
|
||||||
sentence ? h('span', { class: 'sr-only' }, sentence) : '',
|
sentence ? h('span', { class: 'sr-only' }, sentence) : '',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -135,9 +137,9 @@ export class ParamsForm {
|
|||||||
input.setAttribute('aria-invalid', String(bad))
|
input.setAttribute('aria-invalid', String(bad))
|
||||||
help.className = bad ? 'field-help text-danger' : 'field-help'
|
help.className = bad ? 'field-help text-danger' : 'field-help'
|
||||||
const game = spec.type === 'app_id' ? this.games.find((g) => g.app_id === Number(raw)) : undefined
|
const game = spec.type === 'app_id' ? this.games.find((g) => g.app_id === Number(raw)) : undefined
|
||||||
// Textgate: an error paints the warn mark, a matched game paints its name
|
// Textgate: an error paints ⚠️, a matched game paints its name (content);
|
||||||
// (content); the error sentence and the field help are spoken only.
|
// the error sentence and the field help are spoken only.
|
||||||
if (bad) spokenHelp(help, 'state.warn', err)
|
if (bad) spokenHelp(help, '⚠️', err)
|
||||||
else if (game) help.replaceChildren(game.name)
|
else if (game) help.replaceChildren(game.name)
|
||||||
else spokenHelp(help, null, spec.help ?? (spec.type === 'app_id' ? 'Type an app id or pick a game from the list.' : ''))
|
else spokenHelp(help, null, spec.help ?? (spec.type === 'app_id' ? 'Type an app id or pick a game from the list.' : ''))
|
||||||
if (datalist && datalist.childElementCount !== this.games.length) {
|
if (datalist && datalist.childElementCount !== this.games.length) {
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
import { api, ApiFailure } from '../api/client'
|
import { api, ApiFailure } from '../api/client'
|
||||||
import type { Job, PendingAction } from '../api/jobContract'
|
import type { Job, PendingAction } from '../api/jobContract'
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { progressBar } from '../jobs/progress'
|
import { progressBar } from '../jobs/progress'
|
||||||
import { Action } from '../lib/action'
|
import { Action } from '../lib/action'
|
||||||
import { h } from '../lib/dom'
|
import { h } from '../lib/dom'
|
||||||
@ -22,9 +21,9 @@ import { PhraseField } from './phraseField'
|
|||||||
*/
|
*/
|
||||||
export const CLOCK_SLACK_MS = 1000
|
export const CLOCK_SLACK_MS = 1000
|
||||||
|
|
||||||
/** Warning plus the leave mark: leaving cancels the countdown; the sentence is spoken only. */
|
/** ⚠️ 🚪: leaving cancels the countdown; the sentence is spoken only. */
|
||||||
function stayNotice(): HTMLDivElement {
|
function stayNotice(): HTMLDivElement {
|
||||||
const el = notice('warning', null, iconInline('pending.leave'))
|
const el = notice('warning', null, h('span', { 'aria-hidden': 'true' }, '🚪✖️'))
|
||||||
el.setAttribute('aria-label', 'Closing this dialog, navigating away or closing the tab cancels the countdown.')
|
el.setAttribute('aria-label', 'Closing this dialog, navigating away or closing the tab cancels the countdown.')
|
||||||
return el
|
return el
|
||||||
}
|
}
|
||||||
@ -110,7 +109,7 @@ export class PendingCountdown {
|
|||||||
this.el.className = 'stack'
|
this.el.className = 'stack'
|
||||||
this.el.replaceChildren(
|
this.el.replaceChildren(
|
||||||
errorNotice(this.beatError),
|
errorNotice(this.beatError),
|
||||||
h('div', { class: 'actions' }, h('button', { type: 'button', class: 'btn btn-primary', autofocus: true, 'aria-label': 'Arm again', onclick: this.cb.onRearm }, iconInline('pending.rearm'))),
|
h('div', { class: 'actions' }, h('button', { type: 'button', class: 'btn btn-primary', autofocus: true, 'aria-label': 'Arm again', onclick: this.cb.onRearm }, '🔁')),
|
||||||
)
|
)
|
||||||
this.el.querySelector<HTMLElement>('[autofocus]')?.focus()
|
this.el.querySelector<HTMLElement>('[autofocus]')?.focus()
|
||||||
return
|
return
|
||||||
@ -121,18 +120,17 @@ export class PendingCountdown {
|
|||||||
const left = Math.max(0, (ready - now) / 1000)
|
const left = Math.max(0, (ready - now) / 1000)
|
||||||
const isReady = left <= 0
|
const isReady = left <= 0
|
||||||
this.parts.num.textContent = clock(left)
|
this.parts.num.textContent = clock(left)
|
||||||
// Textgate: the lock mark painted beside the clock; the heartbeat mark +
|
// Textgate: 🔓/🔒 painted beside the clock; 💓 + seconds since the last
|
||||||
// seconds since the last heartbeat (red broken heart when failing).
|
// heartbeat (red 💔 when failing). Sentences are spoken only.
|
||||||
// Sentences are spoken only.
|
|
||||||
this.parts.caption.replaceChildren(
|
this.parts.caption.replaceChildren(
|
||||||
iconInline(isReady ? 'state.unlocked' : 'state.locked'),
|
h('span', { 'aria-hidden': 'true' }, isReady ? '🔓' : '🔒'),
|
||||||
h('span', { class: 'sr-only' }, isReady ? 'Ready to commit' : 'until commit unlocks'),
|
h('span', { class: 'sr-only' }, isReady ? 'Ready to commit' : 'until commit unlocks'),
|
||||||
)
|
)
|
||||||
this.parts.bar.replaceChildren(progressBar(Math.min(1, (now - armed) / (ready - armed)), 'Countdown', isReady ? 'success' : 'warning'))
|
this.parts.bar.replaceChildren(progressBar(Math.min(1, (now - armed) / (ready - armed)), 'Countdown', isReady ? 'success' : 'warning'))
|
||||||
const sinceBeat = Math.round((now - this.lastBeat) / 1000)
|
const sinceBeat = Math.round((now - this.lastBeat) / 1000)
|
||||||
const failing = this.beatError !== null
|
const failing = this.beatError !== null
|
||||||
this.parts.beat.replaceChildren(
|
this.parts.beat.replaceChildren(
|
||||||
h('span', { 'aria-hidden': 'true', class: failing ? 'text-danger' : '' }, iconInline(failing ? 'pending.beat-lost' : 'pending.beat'), ` ${sinceBeat}s`),
|
h('span', { 'aria-hidden': 'true', class: failing ? 'text-danger' : '' }, `${failing ? '💔' : '💓'} ${sinceBeat}s`),
|
||||||
h(
|
h(
|
||||||
'span',
|
'span',
|
||||||
{ class: 'sr-only' },
|
{ class: 'sr-only' },
|
||||||
@ -156,7 +154,7 @@ export class PendingCountdown {
|
|||||||
h(
|
h(
|
||||||
'button',
|
'button',
|
||||||
{ type: 'button', class: 'btn btn-ghost', autofocus: true, 'aria-label': this.cancel.pending ? 'Cancelling…' : 'Cancel countdown', onclick: () => void this.doCancel() },
|
{ type: 'button', class: 'btn btn-ghost', autofocus: true, 'aria-label': this.cancel.pending ? 'Cancelling…' : 'Cancel countdown', onclick: () => void this.doCancel() },
|
||||||
iconInline(this.cancel.pending ? 'state.wait' : 'action.cancel'),
|
this.cancel.pending ? '⏳' : '✖️',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -178,7 +176,7 @@ export class PendingCountdown {
|
|||||||
{ class: 'stack' },
|
{ class: 'stack' },
|
||||||
this.phrase.el,
|
this.phrase.el,
|
||||||
errorSlot,
|
errorSlot,
|
||||||
h('div', { class: 'actions' }, submitBtn, h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => void this.doCancel() }, iconInline('action.cancel'))),
|
h('div', { class: 'actions' }, submitBtn, h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => void this.doCancel() }, '✖️')),
|
||||||
)
|
)
|
||||||
form.addEventListener('submit', (e) => {
|
form.addEventListener('submit', (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -190,7 +188,7 @@ export class PendingCountdown {
|
|||||||
}
|
}
|
||||||
const { submit, errors } = this.commitForm as { submit: HTMLButtonElement; errors: HTMLDivElement }
|
const { submit, errors } = this.commitForm as { submit: HTMLButtonElement; errors: HTMLDivElement }
|
||||||
submit.disabled = !phraseMatches(this.pending.phrase, this.phrase.value) || this.commit.pending
|
submit.disabled = !phraseMatches(this.pending.phrase, this.phrase.value) || this.commit.pending
|
||||||
submit.replaceChildren(iconInline(this.commit.pending ? 'state.wait' : 'action.confirm'))
|
submit.textContent = this.commit.pending ? '⏳' : '✔️'
|
||||||
submit.setAttribute('aria-label', this.commit.pending ? 'Committing…' : 'Commit')
|
submit.setAttribute('aria-label', this.commit.pending ? 'Committing…' : 'Commit')
|
||||||
errors.replaceChildren(...(this.commit.error ? [errorNotice(this.commit.error)] : []))
|
errors.replaceChildren(...(this.commit.error ? [errorNotice(this.commit.error)] : []))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,8 @@
|
|||||||
// is the friction. The server re-checks; this field only helps get it right.
|
// is the friction. The server re-checks; this field only helps get it right.
|
||||||
// The input is built once, so typing never loses focus or caret position.
|
// The input is built once, so typing never loses focus or caret position.
|
||||||
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { h } from '../lib/dom'
|
import { h } from '../lib/dom'
|
||||||
import { uid } from '../lib/ids'
|
import { uid } from '../lib/ids'
|
||||||
import { glyph } from '../ui/build'
|
|
||||||
import { phraseMatches } from './catalog'
|
import { phraseMatches } from './catalog'
|
||||||
|
|
||||||
export interface PhraseFieldOptions {
|
export interface PhraseFieldOptions {
|
||||||
@ -50,7 +48,7 @@ export class PhraseField {
|
|||||||
this.el = h(
|
this.el = h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'phrase' },
|
{ class: 'phrase' },
|
||||||
h('label', { for: id, class: 'field-label' }, glyph('phrase.field', label)),
|
h('label', { for: id, class: 'field-label' }, h('span', { 'aria-hidden': 'true' }, '⌨️'), h('span', { class: 'sr-only' }, label)),
|
||||||
this.target,
|
this.target,
|
||||||
this.input,
|
this.input,
|
||||||
h('p', { class: 'sr-only' }, `Phrase: ${phrase}`),
|
h('p', { class: 'sr-only' }, `Phrase: ${phrase}`),
|
||||||
@ -73,12 +71,12 @@ export class PhraseField {
|
|||||||
this.input.className = `input mono ${ok ? 'input-ok' : prefixOk ? '' : 'input-bad'}`.trim()
|
this.input.className = `input mono ${ok ? 'input-ok' : prefixOk ? '' : 'input-bad'}`.trim()
|
||||||
this.input.setAttribute('aria-invalid', String(!prefixOk))
|
this.input.setAttribute('aria-invalid', String(!prefixOk))
|
||||||
this.status.className = `field-help ${ok ? 'text-success' : prefixOk ? '' : 'text-danger'}`.trim()
|
this.status.className = `field-help ${ok ? 'text-success' : prefixOk ? '' : 'text-danger'}`.trim()
|
||||||
// Textgate: yes mark / count / no mark painted; the sentence is spoken only.
|
// Textgate: ✅ / count / ❌ painted; the sentence is spoken only.
|
||||||
const [mark, spoken] = ok
|
const [mark, spoken] = ok
|
||||||
? [iconInline('state.yes'), 'Matches.']
|
? ['✅', 'Matches.']
|
||||||
: prefixOk
|
: prefixOk
|
||||||
? [`${typed.length}/${this.phrase.length}`, `${typed.length} of ${this.phrase.length} characters`]
|
? [`${typed.length}/${this.phrase.length}`, `${typed.length} of ${this.phrase.length} characters`]
|
||||||
: [iconInline('state.no'), 'Does not match — check case and spacing.']
|
: ['❌', 'Does not match — check case and spacing.']
|
||||||
this.status.replaceChildren(h('span', { 'aria-hidden': 'true' }, mark), h('span', { class: 'sr-only' }, spoken))
|
this.status.replaceChildren(h('span', { 'aria-hidden': 'true' }, mark), h('span', { class: 'sr-only' }, spoken))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { api } from '../api/client'
|
import { api } from '../api/client'
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { iconInline, iconMark, iconWord } from '../icons/render'
|
import { iconMark, iconWord } from '../icons/render'
|
||||||
import { define, h, hx } from '../lib/dom'
|
import { define, h, hx } from '../lib/dom'
|
||||||
import { runner, jobHref, type RunRequest } from '../lib/runner'
|
import { runner, jobHref, type RunRequest } from '../lib/runner'
|
||||||
import { errorNotice, loading, notice } from '../ui/build'
|
import { errorNotice, loading, notice } from '../ui/build'
|
||||||
@ -117,8 +117,8 @@ export class RunnerDialogElement extends HTMLElement {
|
|||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'actions' },
|
{ class: 'actions' },
|
||||||
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Close (job keeps running)', onclick: () => { this.close() } }, iconInline('action.cancel')),
|
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Close (job keeps running)', onclick: () => { this.close() } }, '✖️'),
|
||||||
h('a', { href: jobHref(next.id), class: 'btn btn-ghost', 'aria-label': 'Open in Jobs' }, iconInline('nav.jobs')),
|
h('a', { href: jobHref(next.id), class: 'btn btn-ghost', 'aria-label': 'Open in Jobs' }, '⚙️'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -5,11 +5,11 @@
|
|||||||
import { ApiFailure, startJob } from '../api/client'
|
import { ApiFailure, startJob } from '../api/client'
|
||||||
import type { CommandName, CommandSpec } from '../api/contract'
|
import type { CommandName, CommandSpec } from '../api/contract'
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { iconInline, iconMark, iconWord } from '../icons/render'
|
import { iconMark, iconWord } from '../icons/render'
|
||||||
import { Action } from '../lib/action'
|
import { Action } from '../lib/action'
|
||||||
import { h } from '../lib/dom'
|
import { h } from '../lib/dom'
|
||||||
import type { Preset } from '../lib/runner'
|
import type { Preset } from '../lib/runner'
|
||||||
import { errorNotice } from '../ui/build'
|
import { commandLine, errorNotice, notice, pill } from '../ui/build'
|
||||||
import { commandIcon, fillPhrase, phraseMatches } from './catalog'
|
import { commandIcon, fillPhrase, phraseMatches } from './catalog'
|
||||||
import { enforcePreset } from './enforcePreset'
|
import { enforcePreset } from './enforcePreset'
|
||||||
import { gameLookup } from './gameLookup'
|
import { gameLookup } from './gameLookup'
|
||||||
@ -17,13 +17,29 @@ import { initialValues, paramError, toParams, type ParamValues } from './params'
|
|||||||
import { ParamsForm } from './paramsForm'
|
import { ParamsForm } from './paramsForm'
|
||||||
import { PendingCountdown } from './pendingCountdown'
|
import { PendingCountdown } from './pendingCountdown'
|
||||||
import { PhraseField } from './phraseField'
|
import { PhraseField } from './phraseField'
|
||||||
import { commandFlags, fillHint, lockedNotice, terminalFallback } from './runnerParts'
|
|
||||||
|
|
||||||
/** Recovery commands the UI offers when the root daemon is down. */
|
/** Recovery commands the UI offers when the root daemon is down. */
|
||||||
const FALLBACK: Partial<Record<CommandName, string>> = {
|
const FALLBACK: Partial<Record<CommandName, string>> = {
|
||||||
'gaming-unblock': 'sudo ./run.sh gaming-unblock',
|
'gaming-unblock': 'sudo ./run.sh gaming-unblock',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** ⏳ plus the minutes (a number, so painted); the word is spoken only. */
|
||||||
|
function countdownPill(seconds: number): HTMLSpanElement {
|
||||||
|
const minutes = Math.round(seconds / 60)
|
||||||
|
const el = pill('warning', `${minutes} min countdown`, '⏳')
|
||||||
|
el.append(h('span', { class: 'pill-num', 'aria-hidden': 'true' }, `${minutes}′`))
|
||||||
|
return el
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 🔒 warning notice; the server's lock reason is spoken only. */
|
||||||
|
function lockedNotice(reason: string): HTMLDivElement {
|
||||||
|
const el = notice('warning', null)
|
||||||
|
el.querySelector('.notice-icon')?.replaceChildren('🔒')
|
||||||
|
el.setAttribute('aria-label', `Locked: ${reason}`)
|
||||||
|
return el
|
||||||
|
}
|
||||||
|
|
||||||
export type NextPhase = { k: 'pending'; countdown: PendingCountdown } | { k: 'job'; id: string } | { k: 'form'; runner: Runner }
|
export type NextPhase = { k: 'pending'; countdown: PendingCountdown } | { k: 'job'; id: string } | { k: 'form'; runner: Runner }
|
||||||
|
|
||||||
export interface RunnerCallbacks {
|
export interface RunnerCallbacks {
|
||||||
@ -69,6 +85,7 @@ export class Runner {
|
|||||||
this.start = new Action(startJob, () => {
|
this.start = new Action(startJob, () => {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
})
|
})
|
||||||
|
const countdown = spec.friction?.countdown_seconds
|
||||||
this.submitBtn = h('button', {
|
this.submitBtn = h('button', {
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
class: 'btn btn-primary',
|
class: 'btn btn-primary',
|
||||||
@ -83,7 +100,10 @@ export class Runner {
|
|||||||
'div',
|
'div',
|
||||||
{ class: 'tags' },
|
{ class: 'tags' },
|
||||||
h('span', { class: 'runner-mark' }, iconMark(commandIcon(spec.name), 'runner-glyph'), iconWord(commandIcon(spec.name))),
|
h('span', { class: 'runner-mark' }, iconMark(commandIcon(spec.name), 'runner-glyph'), iconWord(commandIcon(spec.name))),
|
||||||
commandFlags(spec),
|
spec.privileged ? pill('neutral', 'Runs as root via the daemon', '🔑') : null,
|
||||||
|
spec.mutating ? pill('neutral', 'Changes state', '✏️') : pill('neutral', 'Read-only', '👁️'),
|
||||||
|
spec.cancellable ? pill('neutral', 'Cancellable', '⏹️') : null,
|
||||||
|
countdown ? countdownPill(countdown) : null,
|
||||||
),
|
),
|
||||||
spec.locked_reason !== null ? lockedNotice(spec.locked_reason) : null,
|
spec.locked_reason !== null ? lockedNotice(spec.locked_reason) : null,
|
||||||
this.form.nodes,
|
this.form.nodes,
|
||||||
@ -93,7 +113,7 @@ export class Runner {
|
|||||||
'div',
|
'div',
|
||||||
{ class: 'actions' },
|
{ class: 'actions' },
|
||||||
this.submitBtn,
|
this.submitBtn,
|
||||||
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => { cb.onClose() } }, iconInline('action.cancel')),
|
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => { cb.onClose() } }, '✖️'),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
this.el.addEventListener('submit', (e) => {
|
this.el.addEventListener('submit', (e) => {
|
||||||
@ -139,7 +159,10 @@ export class Runner {
|
|||||||
if (key !== this.phraseKey) {
|
if (key !== this.phraseKey) {
|
||||||
this.phraseKey = key
|
this.phraseKey = key
|
||||||
if (phrase && phrase.missing.length > 0) {
|
if (phrase && phrase.missing.length > 0) {
|
||||||
this.phraseSlot.replaceChildren(fillHint(phrase.missing))
|
// ℹ️ ⬆️: fill the fields above first; the sentence is spoken only.
|
||||||
|
const hint = notice('info', null, h('span', { 'aria-hidden': 'true' }, '⬆️'))
|
||||||
|
hint.setAttribute('aria-label', `Fill in the fields above to see the exact phrase (${phrase.missing.join(', ')}).`)
|
||||||
|
this.phraseSlot.replaceChildren(hint)
|
||||||
} else if (phrase && !locked) {
|
} else if (phrase && !locked) {
|
||||||
this.typed = ''
|
this.typed = ''
|
||||||
const field = new PhraseField({
|
const field = new PhraseField({
|
||||||
@ -164,7 +187,7 @@ export class Runner {
|
|||||||
errorNotice(
|
errorNotice(
|
||||||
err,
|
err,
|
||||||
failure?.code === 'daemon_unreachable' && fallback
|
failure?.code === 'daemon_unreachable' && fallback
|
||||||
? terminalFallback(fallback)
|
? [h('p', { class: 'm0', 'aria-label': 'Run it from a terminal instead:' }, h('span', { 'aria-hidden': 'true' }, '💻')), commandLine(fallback)]
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@ -173,8 +196,8 @@ export class Runner {
|
|||||||
const countdown = this.spec.friction?.countdown_seconds
|
const countdown = this.spec.friction?.countdown_seconds
|
||||||
this.submitBtn.className = phrase ? 'btn btn-danger' : 'btn btn-primary'
|
this.submitBtn.className = phrase ? 'btn btn-danger' : 'btn btn-primary'
|
||||||
this.submitBtn.disabled = !this.canSubmit() || this.start.pending
|
this.submitBtn.disabled = !this.canSubmit() || this.start.pending
|
||||||
// Icon painted, label spoken: busy while starting, arm countdown, or run.
|
// Glyph painted, label spoken: ⏳ starting, ⏲️ arm countdown, ▶️ run.
|
||||||
this.submitBtn.replaceChildren(iconInline(this.start.pending ? 'state.wait' : countdown ? 'runner.arm' : 'runner.run'))
|
this.submitBtn.textContent = this.start.pending ? '⏳' : countdown ? '⏲️' : '▶️'
|
||||||
this.submitBtn.setAttribute('aria-label', this.start.pending ? 'Starting…' : countdown ? 'Arm countdown' : `Run ${this.spec.name}`)
|
this.submitBtn.setAttribute('aria-label', this.start.pending ? 'Starting…' : countdown ? 'Arm countdown' : `Run ${this.spec.name}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
// The small painted parts of the runner form: the command's flags, the lock
|
|
||||||
// notice, the "fill the fields" hint and the terminal fallback. Every icon is
|
|
||||||
// a registered id, so the user's word and glyph apply; each sentence is
|
|
||||||
// spoken only (aria-label / pill text).
|
|
||||||
|
|
||||||
import type { CommandSpec } from '../api/contract'
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { h } from '../lib/dom'
|
|
||||||
import { commandLine, notice, pill } from '../ui/build'
|
|
||||||
|
|
||||||
/** The countdown flag plus the minutes (a number, so painted); the word is spoken only. */
|
|
||||||
function countdownPill(seconds: number): HTMLSpanElement {
|
|
||||||
const minutes = Math.round(seconds / 60)
|
|
||||||
const el = pill('warning', `${minutes} min countdown`, 'cmdflag.countdown')
|
|
||||||
el.append(h('span', { class: 'pill-num', 'aria-hidden': 'true' }, `${minutes}′`))
|
|
||||||
return el
|
|
||||||
}
|
|
||||||
|
|
||||||
/** What the command is: root, state-changing or read-only, cancellable, countdown. */
|
|
||||||
export function commandFlags(spec: CommandSpec): (HTMLSpanElement | null)[] {
|
|
||||||
const countdown = spec.friction?.countdown_seconds
|
|
||||||
return [
|
|
||||||
spec.privileged ? pill('neutral', 'Runs as root via the daemon', 'cmdflag.root') : null,
|
|
||||||
spec.mutating ? pill('neutral', 'Changes state', 'cmdflag.mutating') : pill('neutral', 'Read-only', 'cmdflag.readonly'),
|
|
||||||
spec.cancellable ? pill('neutral', 'Cancellable', 'cmdflag.cancellable') : null,
|
|
||||||
countdown ? countdownPill(countdown) : null,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Warning notice painted with the lock mark; the server's lock reason is spoken only. */
|
|
||||||
export function lockedNotice(reason: string): HTMLDivElement {
|
|
||||||
const el = notice('warning', null)
|
|
||||||
const mark = iconInline('state.locked', 'notice-icon')
|
|
||||||
if (mark.classList.contains('icon-inline')) mark.classList.add('notice-mark')
|
|
||||||
el.firstElementChild?.replaceWith(mark)
|
|
||||||
el.setAttribute('aria-label', `Locked: ${reason}`)
|
|
||||||
return el
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Info notice: fill the fields above first; the sentence is spoken only. */
|
|
||||||
export function fillHint(missing: readonly string[]): HTMLDivElement {
|
|
||||||
const hint = notice('info', null, iconInline('runner.fill'))
|
|
||||||
hint.setAttribute('aria-label', `Fill in the fields above to see the exact phrase (${missing.join(', ')}).`)
|
|
||||||
return hint
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The terminal command to run when the daemon cannot be reached. */
|
|
||||||
export function terminalFallback(command: string): HTMLElement[] {
|
|
||||||
return [h('p', { class: 'm0', 'aria-label': 'Run it from a terminal instead:' }, iconInline('runner.terminal')), commandLine(command)]
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
// Completeness gate for the icon words: every icon the UI paints comes from
|
|
||||||
// the registry (icons/registry.json), so the /words picker covers the whole
|
|
||||||
// UI. This scans the source, not a rendered page: a pictograph or an icon
|
|
||||||
// symbol typed as a literal in any non-test file is an unregistered icon.
|
|
||||||
// Comments are ignored; the picker's own controls and the palette's key
|
|
||||||
// hints are the only allowed literals, named below.
|
|
||||||
|
|
||||||
import { readdirSync, readFileSync } from 'node:fs'
|
|
||||||
import { join, relative } from 'node:path'
|
|
||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
import { ICONS } from './registry'
|
|
||||||
|
|
||||||
const SRC = join(import.meta.dirname, '..')
|
|
||||||
|
|
||||||
/** Pictographs, plus the symbol icons the UI paints (Σ ∅ ↺ ✕ ↵ ▲ ▼ ∞ and arrows). */
|
|
||||||
const ICON_LITERAL = /\p{Extended_Pictographic}|[Σ∅↺✕↵▲▼∞←→↑↓]|'×'|\u{FE0F}/u
|
|
||||||
|
|
||||||
/** The /words picker's own controls and keyboard hints: text, not UI icons. */
|
|
||||||
const ALLOWED = ["'← back'", "'forward →'", "'↑↓ · ⏎ · ⎋'", "'↑↓ to move · Enter to run · Esc to close'","{ class: 'm0' }, '✅')"]
|
|
||||||
|
|
||||||
function sourceFiles(dir: string): string[] {
|
|
||||||
return readdirSync(dir, { recursive: true, encoding: 'utf8' })
|
|
||||||
.map((f) => join(dir, f))
|
|
||||||
.filter((f) => /\.(ts|astro)$/.test(f) && !f.endsWith('.test.ts') && !f.includes(`${join(SRC, 'test')}/`))
|
|
||||||
}
|
|
||||||
|
|
||||||
function code(text: string): string {
|
|
||||||
const noBlocks = text.replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, ' ')).replace(/<!--[\s\S]*?-->/g, (m) => m.replace(/[^\n]/g, ' '))
|
|
||||||
return noBlocks.replace(/(^|\s)\/\/.*$/gm, '$1')
|
|
||||||
}
|
|
||||||
|
|
||||||
/** `file:line` of every line that paints an icon literal. */
|
|
||||||
function unregistered(): string[] {
|
|
||||||
const hits: string[] = []
|
|
||||||
for (const file of sourceFiles(SRC)) {
|
|
||||||
const lines = code(readFileSync(file, 'utf8')).split('\n')
|
|
||||||
lines.forEach((line, i) => {
|
|
||||||
const bare = ALLOWED.reduce((s, a) => s.split(a).join(''), line)
|
|
||||||
if (ICON_LITERAL.test(bare)) hits.push(`${relative(SRC, file)}:${i + 1}`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return hits
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('icon words cover the whole UI', () => {
|
|
||||||
it('no source file paints an icon outside the registry', () => {
|
|
||||||
const hits = unregistered()
|
|
||||||
expect(hits, `${hits.length} unregistered icon sites`).toEqual([])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the first 45 registry entries are the answered pass-1 icons, so the picker opens after them', () => {
|
|
||||||
const ids = ICONS.map((e) => e.id)
|
|
||||||
expect(ids.slice(0, 45).filter((id) => /^(nav|palette|cmd|job\.state|notice)\./.test(id))).toHaveLength(45)
|
|
||||||
expect(ids[44]).toBe('notice.danger')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
// An icon as plain text, for the places that cannot hold markup: an input's
|
|
||||||
// placeholder or an <option>. The glyph (the user's alternative applied),
|
|
||||||
// then his word right of it when he chose one.
|
|
||||||
|
|
||||||
import type { IconId } from './registry'
|
|
||||||
import { iconFor } from './render'
|
|
||||||
|
|
||||||
export function iconText(id: IconId): string {
|
|
||||||
const { glyph, word } = iconFor(id)
|
|
||||||
return word ? `${glyph} ${word}` : glyph
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
// iconInline: the painted-only icon (no spoken text) used inside said(...),
|
|
||||||
// buttons and labels, plus the shared builders that now take ids.
|
|
||||||
|
|
||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { copyButton, empty, pill } from '../ui/build'
|
|
||||||
import { setWordsHidden } from './ledger'
|
|
||||||
import { iconInline } from './render'
|
|
||||||
|
|
||||||
describe('iconInline', () => {
|
|
||||||
it('is the glyph mark alone when there is no word', () => {
|
|
||||||
const el = iconInline('state.wait', 'x')
|
|
||||||
expect(el.textContent).toBe('⏳')
|
|
||||||
expect(el).toHaveAttribute('aria-hidden', 'true')
|
|
||||||
expect(el).toHaveAttribute('data-icon', 'state.wait')
|
|
||||||
expect(el).toHaveClass('x')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('paints the chosen alternative glyph', () => {
|
|
||||||
useIcons({ 'state.wait': { word: null, glyph: '⌛' } })
|
|
||||||
expect(iconInline('state.wait').textContent).toBe('⌛')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('puts the word right of the icon in one row, both aria-hidden', () => {
|
|
||||||
useIcons({ 'state.wait': { word: 'busy' } })
|
|
||||||
const el = iconInline('state.wait')
|
|
||||||
expect(el).toHaveClass('icon-inline', 'has-word')
|
|
||||||
const [icon, word] = [...el.children]
|
|
||||||
expect(icon.textContent).toBe('⏳')
|
|
||||||
expect(word).toHaveClass('icon-word')
|
|
||||||
expect(word).toHaveAttribute('aria-hidden', 'true')
|
|
||||||
expect(word.textContent).toBe('Busy')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('draws no word while words are hidden', () => {
|
|
||||||
useIcons({ 'state.wait': { word: 'busy' } })
|
|
||||||
setWordsHidden(true)
|
|
||||||
expect(iconInline('state.wait').querySelector('.icon-word')).toBeNull()
|
|
||||||
setWordsHidden(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('builders that take ids', () => {
|
|
||||||
it('empty paints the empty icon and its word, the sentence stays spoken', () => {
|
|
||||||
useIcons({ 'state.empty': { word: 'nothing' } })
|
|
||||||
const el = empty('No games')
|
|
||||||
expect(el.querySelector('.empty-icon')?.textContent).toBe('📭')
|
|
||||||
expect(el.querySelector('.icon-word')?.textContent).toBe('Nothing')
|
|
||||||
expect(el.querySelector('.sr-only')?.textContent).toBe('No games')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('pill paints its icon, word and spoken text', () => {
|
|
||||||
useIcons({ 'state.warn': { word: 'attention', glyph: '🟠' } })
|
|
||||||
const el = pill('warning', 'locked', 'state.warn')
|
|
||||||
expect(el.className).toBe('pill pill-warning')
|
|
||||||
expect(el.querySelector('.pill-icon')?.textContent).toBe('🟠')
|
|
||||||
expect(el.querySelector('.icon-word')?.textContent).toBe('Attention')
|
|
||||||
expect(el.querySelector('.sr-only')?.textContent).toBe('locked')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('copyButton paints its icon and word, then the done icon after a copy', async () => {
|
|
||||||
useIcons({ 'copy.command': { word: 'copy' }, 'copy.done': { word: 'copied', glyph: '🎉' } })
|
|
||||||
Object.defineProperty(navigator, 'clipboard', { value: { writeText: () => Promise.resolve() }, configurable: true })
|
|
||||||
const btn = copyButton('sudo x')
|
|
||||||
expect(btn.textContent).toBe('📋Copy')
|
|
||||||
btn.click()
|
|
||||||
await Promise.resolve()
|
|
||||||
await Promise.resolve()
|
|
||||||
expect(btn.textContent).toBe('🎉Copied')
|
|
||||||
expect(btn).toHaveAttribute('aria-label', 'Copied')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -45,224 +45,6 @@
|
|||||||
"notice.info": { "glyph": "ℹ️", "spoken": "Information", "desc": "Mark on an information notice: a neutral fact or a hint.", "words": ["info", "note", "hint"], "alts": ["💡", "🔷", "📢"] },
|
"notice.info": { "glyph": "ℹ️", "spoken": "Information", "desc": "Mark on an information notice: a neutral fact or a hint.", "words": ["info", "note", "hint"], "alts": ["💡", "🔷", "📢"] },
|
||||||
"notice.success": { "glyph": "✅", "spoken": "Success", "desc": "Mark on a success notice: the action worked.", "words": ["success", "ok", "done"], "alts": ["✔️", "🎉", "👍"] },
|
"notice.success": { "glyph": "✅", "spoken": "Success", "desc": "Mark on a success notice: the action worked.", "words": ["success", "ok", "done"], "alts": ["✔️", "🎉", "👍"] },
|
||||||
"notice.warning": { "glyph": "⚠️", "spoken": "Warning", "desc": "Mark on a warning notice: something needs your attention, but nothing failed.", "words": ["warning", "caution", "careful"], "alts": ["🟡", "🔶", "❗"] },
|
"notice.warning": { "glyph": "⚠️", "spoken": "Warning", "desc": "Mark on a warning notice: something needs your attention, but nothing failed.", "words": ["warning", "caution", "careful"], "alts": ["🟡", "🔶", "❗"] },
|
||||||
"notice.danger": { "glyph": "⛔", "spoken": "Error", "desc": "Mark on an error notice: something failed or was refused. The server's message follows it.", "words": ["error", "danger", "problem"], "alts": ["🛑", "‼️", "🔴"] },
|
"notice.danger": { "glyph": "⛔", "spoken": "Error", "desc": "Mark on an error notice: something failed or was refused. The server's message follows it.", "words": ["error", "danger", "problem"], "alts": ["🛑", "‼️", "🔴"] }
|
||||||
"state.yes": { "glyph": "✅", "spoken": "Yes", "desc": "Marks a yes in a row: the thing is on, present, current or matching.", "words": ["yes", "on", "present"], "alts": ["🟢", "👍", "🆗"] },
|
|
||||||
"state.no": { "glyph": "❌", "spoken": "No", "desc": "Marks a no in a row: the thing is missing, off or does not match.", "words": ["no", "missing", "wrong"], "alts": ["🙅", "🔴", "👎"] },
|
|
||||||
"state.off": { "glyph": "➖", "spoken": "Off", "desc": "Marks an empty value in a row: off, none or not set.", "words": ["none", "off", "blank"], "alts": ["⚪", "⬜", "🕳️"] },
|
|
||||||
"state.warn": { "glyph": "⚠️", "spoken": "Needs attention", "desc": "Marks a row or label that needs attention: stale, unavailable or not ready. Nothing has failed yet.", "words": ["attention", "stale", "caution"], "alts": ["🟠", "❗", "🚧"] },
|
|
||||||
"state.wait": { "glyph": "⏳", "spoken": "Busy", "desc": "Shows that a button or row is busy: saving, sending, restarting or counting down.", "words": ["busy", "waiting", "working"], "alts": ["⌛", "💤", "🌀"] },
|
|
||||||
"state.empty": { "glyph": "📭", "spoken": "Nothing here", "desc": "Empty state: there is nothing to show yet, such as no data or no games.", "words": ["empty", "nothing", "vacant"], "alts": ["📪", "🕸️", "🫙"] },
|
|
||||||
"state.unknown": { "glyph": "❔", "spoken": "Unknown", "desc": "Unknown value: the data is missing or its kind is not recognised. It also shows a play style that is not known yet.", "words": ["unknown", "unclear", "mystery"], "alts": ["❓", "🤷", "🫥"] },
|
|
||||||
"state.locked": { "glyph": "🔒", "spoken": "Locked", "desc": "Locked: the command or action cannot run right now. The reason is read aloud.", "words": ["locked", "closed", "sealed"], "alts": ["🔐", "🚧", "⛓️"] },
|
|
||||||
"state.unlocked": { "glyph": "🔓", "spoken": "Unlocked", "desc": "Unlocked: the action is open and free to use.", "words": ["unlocked", "open", "free"], "alts": ["🗝️", "🚪", "🔑"] },
|
|
||||||
"action.cancel": { "glyph": "✖️", "spoken": "Cancel", "desc": "Button that cancels or closes the open form, dialog or countdown without doing anything.", "words": ["cancel", "close", "dismiss"], "alts": ["❌", "↩️", "🚪"] },
|
|
||||||
"action.confirm": { "glyph": "✔️", "spoken": "Confirm", "desc": "Button that confirms: it saves the form or sends the answer.", "words": ["confirm", "save", "accept"], "alts": ["✅", "💾", "👍"] },
|
|
||||||
"action.open": { "glyph": "➡️", "spoken": "Open", "desc": "Link on a card that opens the page behind it, such as the details or the full list.", "words": ["open", "details", "more"], "alts": ["↗️", "🔗", "⏩"] },
|
|
||||||
"copy.command": { "glyph": "📋", "spoken": "Copy command", "desc": "Button that copies a shell command to the clipboard. It is the way out when the UI cannot act itself.", "words": ["copy", "clipboard", "duplicate"], "alts": ["📎", "📄", "🗒️"] },
|
|
||||||
"copy.done": { "glyph": "✅", "spoken": "Copied", "desc": "Replaces the copy button for two seconds after the copy worked.", "words": ["copied", "done", "saved"], "alts": ["✔️", "👌", "🎉"] },
|
|
||||||
"dash.ago": { "glyph": "🕓", "spoken": "Ago", "desc": "Shown before a time span that says how long ago something happened, such as a recent job or the live verdict.", "words": ["ago", "age", "since"], "alts": ["🕰️", "⏰", "📆"] },
|
|
||||||
"dash.finished": { "glyph": "🏆", "spoken": "Games finished", "desc": "Marks the number of games you finished with every achievement. It labels the dashboard row and the base of your pace estimate.", "words": ["finished", "trophies", "completed"], "alts": ["🥇", "🎖️", "🏁"] },
|
|
||||||
"dash.store": { "glyph": "🛒", "spoken": "Store", "desc": "Row label on the dashboard: whether the Steam store is blocked right now.", "words": ["store", "shop", "market"], "alts": ["🏪", "🛍️", "🧾"] },
|
|
||||||
"dash.store-blocked": { "glyph": "🔒", "spoken": "Store blocked", "desc": "Value of the store row on the dashboard: the Steam store is blocked.", "words": ["blocked", "closed", "shut"], "alts": ["🚫", "🔐", "🚧"] },
|
|
||||||
"dash.store-open": { "glyph": "🔓", "spoken": "Store unblocked", "desc": "Value of the store row on the dashboard: the Steam store is unblocked for now. It blocks itself again later.", "words": ["open", "unblocked", "free"], "alts": ["🟢", "🚪", "🗝️"] },
|
|
||||||
"dash.games": { "glyph": "🗂️", "spoken": "Installed games", "desc": "Row label on the dashboard: how many games are installed on this PC.", "words": ["games", "library", "count"], "alts": ["🎮", "📦", "🗃️"] },
|
|
||||||
"dash.total-block": { "glyph": "⛔", "spoken": "Total block", "desc": "Row label on the dashboard: the total gaming block. While it is active the row counts down the time left.", "words": ["block", "ban", "lockdown"], "alts": ["🚷", "🧱", "📵"] },
|
|
||||||
"picks.manual": { "glyph": "📌", "spoken": "Manual picks", "desc": "Marks your manual picks, the games you locked in by hand. It heads the picks card and labels the dashboard row.", "words": ["manual", "pinned", "chosen"], "alts": ["📍", "🧷", "🖐️"] },
|
|
||||||
"assigned.game": { "glyph": "🎯", "spoken": "Assigned game", "desc": "Marks the game assigned to you. It heads the assignment card, tags the game in the library and sits beside the live verdict.", "words": ["assigned", "target", "current"], "alts": ["🏹", "🥅", "⭐"] },
|
|
||||||
"dash.block-left": { "glyph": "⏳", "spoken": "Time left", "desc": "Time left on the total gaming block, shown as a countdown.", "words": ["left", "remaining", "countdown"], "alts": ["⌛", "⏲️", "🕰️"] },
|
|
||||||
"dash.budget": { "glyph": "⏱️", "spoken": "Gaming today", "desc": "Heading of the budget card on the dashboard. It shows how much gaming time is left today.", "words": ["budget", "timer", "allowance"], "alts": ["⏲️", "🕹️", "🪙"] },
|
|
||||||
"dash.blocked-today": { "glyph": "⛔", "spoken": "Blocked for today", "desc": "Shown on the budget card when gaming is blocked for the rest of the day.", "words": ["blocked", "banned", "stopped"], "alts": ["🚫", "🛑", "🔴"] },
|
|
||||||
"dash.not-billing": { "glyph": "⏸️", "spoken": "Nothing billing", "desc": "Shown while no game is running, so no gaming time is used. It marks the budget line and the live verdict.", "words": ["idle", "paused", "resting"], "alts": ["⏯️", "💤", "🟦"] },
|
|
||||||
"dash.billing": { "glyph": "▶️", "spoken": "Billing now", "desc": "Shown while a game is running and its time counts against today's budget. It marks the budget line and the live verdict.", "words": ["playing", "billing", "counting"], "alts": ["⏺️", "🔴", "🎮"] },
|
|
||||||
"dash.fast-failed": { "glyph": "⛔", "spoken": "Fast install failed", "desc": "A fast install failed. The daemon's own message follows it.", "words": ["failed", "error", "broken"], "alts": ["💥", "❌", "🔴"] },
|
|
||||||
"dash.steam-took-over": { "glyph": "↪️", "spoken": "Steam took over", "desc": "Note under a failed fast install: Steam's own download took over.", "words": ["fallback", "handover", "detour"], "alts": ["↩️", "🔀", "🔁"] },
|
|
||||||
"dash.fast-install": { "glyph": "⚡", "spoken": "Fast install", "desc": "A fast install is running. It heads the fast install card and marks each running download.", "words": ["fast", "turbo", "quick"], "alts": ["🚀", "💨", "⏩"] },
|
|
||||||
"dash.elapsed": { "glyph": "⏳", "spoken": "Elapsed", "desc": "Time a fast install has been running so far.", "words": ["elapsed", "running", "duration"], "alts": ["⌛", "🕐", "⏱️"] },
|
|
||||||
"dash.recent-jobs": { "glyph": "⚙️", "spoken": "Recent jobs", "desc": "Heading of the recent jobs card on the dashboard. It lists the last five jobs with their state.", "words": ["jobs", "recent", "history"], "alts": ["🛠️", "📜", "🗒️"] },
|
|
||||||
"dash.outlook": { "glyph": "📚", "spoken": "Backlog outlook", "desc": "Heading of the backlog outlook card on the dashboard: the planner summary at the default filters.", "words": ["backlog", "outlook", "forecast"], "alts": ["📖", "🔮", "🗓️"] },
|
|
||||||
"picks.age": { "glyph": "🕐", "spoken": "Picked days ago", "desc": "Marks how many days ago a manual pick was made. The app id follows it.", "words": ["picked", "age", "days"], "alts": ["📆", "🕰️", "⏳"] },
|
|
||||||
"picks.kept": { "glyph": "📌", "spoken": "Kept", "desc": "Marks a pick that was released but kept: the game stays installed and playable.", "words": ["kept", "released", "spared"], "alts": ["📎", "💚", "🔖"] },
|
|
||||||
"store.blocked": { "glyph": "🛒🔒", "spoken": "Store blocked", "desc": "Notice on the store page: the Steam store is blocked. Unblocking takes a typed phrase and lasts at most 30 minutes.", "words": ["blocked", "closed", "sealed"], "alts": ["🚫", "🔐", "🛑"] },
|
|
||||||
"store.open": { "glyph": "🛒🔓", "spoken": "Store unblocked", "desc": "Notice on the store page: the Steam store is open right now. It blocks itself again after the timer runs out.", "words": ["open", "unblocked", "live"], "alts": ["🏪", "🟢", "🚪"] },
|
|
||||||
"setup.help": { "glyph": "🔗", "spoken": "Where to get it", "desc": "Link next to a setup field that opens the page where you get the value.", "words": ["link", "source", "help"], "alts": ["🌍", "🧭", "📎"] },
|
|
||||||
"setup.key-stored": { "glyph": "🔒", "spoken": "Key stored", "desc": "Shown when the Steam API key is already stored, in the setup field and the system row. The key stays hidden, and typing a new key replaces it.", "words": ["stored", "saved", "secret"], "alts": ["🔐", "🗝️", "🛡️"] },
|
|
||||||
"setup.api-key": { "glyph": "🔑", "spoken": "Steam Web API key", "desc": "Marks the Steam Web API key: the field on the setup page where you paste it, and the system row that shows if one is stored.", "words": ["key", "token", "secret"], "alts": ["🗝️", "🔐", "🪪"] },
|
|
||||||
"setup.steam-id": { "glyph": "🆔", "spoken": "SteamID64", "desc": "Marks the SteamID: the field on the setup page for your 17-digit profile number, and the system row that shows it.", "words": ["id", "profile", "account"], "alts": ["🪪", "👤", "🔢"] },
|
|
||||||
"libpage.all": { "glyph": "🗂️", "spoken": "All games", "desc": "Switch on the library page that shows every game you own as a cover grid.", "words": ["all", "covers", "owned"], "alts": ["🖼️", "🧩", "🗃️"] },
|
|
||||||
"libpage.game": { "glyph": "🎮", "spoken": "Game", "desc": "Marks a game: the game column of the installed table and the number of installed games.", "words": ["game", "title", "count"], "alts": ["🕹️", "👾", "🃏"] },
|
|
||||||
"libpage.app-id": { "glyph": "#", "spoken": "App id", "desc": "Header of the app id column in the installed table: the Steam number of each game.", "words": ["number", "appid", "index"], "alts": ["🔢", "🆔", "🔖"] },
|
|
||||||
"libpage.size": { "glyph": "💽", "spoken": "Size", "desc": "Size on disk: the size column header and the total of all installed games.", "words": ["size", "space", "disk"], "alts": ["📏", "🧮", "⚖️"] },
|
|
||||||
"libpage.role": { "glyph": "🏷️", "spoken": "Role", "desc": "Header of the role column in the installed table: whether a game is assigned, protected or removable.", "words": ["role", "status", "tag"], "alts": ["🔖", "🎭", "🪪"] },
|
|
||||||
"libpage.protected": { "glyph": "🛡️", "spoken": "Protected", "desc": "Tags an installed game that is protected, so uninstall never removes it.", "words": ["protected", "safe", "shielded"], "alts": ["🔰", "🔐", "🧱"] },
|
|
||||||
"libpage.candidate": { "glyph": "🗑️", "spoken": "Uninstall candidate", "desc": "Marks an installed game that is neither assigned nor protected, so uninstall would remove it.", "words": ["removable", "trash", "surplus"], "alts": ["🧹", "♻️", "🪣"] },
|
|
||||||
"jobs.command": { "glyph": "⌨️", "spoken": "Command", "desc": "Header of the command column in the job history.", "words": ["command", "action", "task"], "alts": ["💻", "🔤", "🧰"] },
|
|
||||||
"jobs.state": { "glyph": "🚦", "spoken": "State", "desc": "Header of the state column in the job history: queued, running, finished or failed.", "words": ["state", "status", "outcome"], "alts": ["🟢", "📶", "🚥"] },
|
|
||||||
"jobs.started": { "glyph": "🕐", "spoken": "Started", "desc": "When a job started: the started column of the job history and the created time on a job page.", "words": ["started", "created", "when"], "alts": ["🕒", "📅", "🕰️"] },
|
|
||||||
"jobs.took": { "glyph": "⏱️", "spoken": "Took", "desc": "Header of the duration column in the job history: how long each job ran.", "words": ["took", "duration", "length"], "alts": ["⏲️", "⌛", "📏"] },
|
|
||||||
"jobs.not-found": { "glyph": "❓", "spoken": "Job not found", "desc": "Marks a job page whose id does not exist. The history keeps only the last 50 jobs.", "words": ["missing", "unknown", "gone"], "alts": ["❔", "🔍", "🕳️"] },
|
|
||||||
"jobs.all": { "glyph": "📋", "spoken": "All jobs", "desc": "Link to the job history list, shown on a job page and on a missing job.", "words": ["all", "list", "history"], "alts": ["📜", "🗒️", "📚"] },
|
|
||||||
"jobs.job": { "glyph": "⚙️", "spoken": "Job", "desc": "Heading of a job page while the job loads.", "words": ["job", "task", "work"], "alts": ["🔧", "🛠️", "🧰"] },
|
|
||||||
"jobs.waiting": { "glyph": "⏳", "spoken": "Waiting for you", "desc": "Phase mark on a job page when the job waits for your answer.", "words": ["waiting", "paused", "pending"], "alts": ["⌛", "✋", "💤"] },
|
|
||||||
"jobs.cancel": { "glyph": "✕", "spoken": "Cancel job", "desc": "Button on a running job that asks it to stop. It appears only for jobs that can be cancelled.", "words": ["stop", "cancel", "abort"], "alts": ["🛑", "⏹️", "✖️"] },
|
|
||||||
"jobs.log": { "glyph": "📋", "spoken": "Log", "desc": "Marks the job log: it shows the number of log lines and opens the log.", "words": ["log", "lines", "output"], "alts": ["📜", "📄", "🧾"] },
|
|
||||||
"prompt.question": { "glyph": "❓", "spoken": "Job question", "desc": "Marks a question a job asks you. The job waits until you answer.", "words": ["question", "ask", "prompt"], "alts": ["❔", "💬", "🙋"] },
|
|
||||||
"prompt.own-game": { "glyph": "🗂️", "spoken": "Choose your own game", "desc": "Choice in a job question that lets you pick any game from your library instead of the offered ones.", "words": ["own", "browse", "other"], "alts": ["🔎", "📂", "🎮"] },
|
|
||||||
"prompt.yes": { "glyph": "✔️", "spoken": "Yes", "desc": "Button that answers yes to a job question.", "words": ["yes", "accept", "agree"], "alts": ["✅", "👍", "🆗"] },
|
|
||||||
"prompt.no": { "glyph": "✖️", "spoken": "No", "desc": "Button that answers no to a job question.", "words": ["no", "decline", "refuse"], "alts": ["❌", "👎", "🚫"] },
|
|
||||||
"prompt.answer": { "glyph": "↵", "spoken": "Answer", "desc": "Button that sends your answer to a job question. The Enter key does the same.", "words": ["send", "answer", "submit"], "alts": ["⏎", "📤", "➡️"] },
|
|
||||||
"prompt.back": { "glyph": "↩️", "spoken": "Back to the list", "desc": "Button that returns from the game picker to the previous question of the job.", "words": ["back", "return", "previous"], "alts": ["◀️", "⬅️", "🔙"] },
|
|
||||||
"prompt.games": { "glyph": "🎮", "spoken": "Games to pick from", "desc": "Shows how many games a job offers to pick from in a game question.", "words": ["choices", "games", "options"], "alts": ["🕹️", "🔢", "🧮"] },
|
|
||||||
"prompt.pick": { "glyph": "🎯", "spoken": "Pick this game", "desc": "Button that sends the game you selected as the answer. It shows the game name once you select one.", "words": ["pick", "select", "choose"], "alts": ["🏹", "✅", "📌"] },
|
|
||||||
"jobchip.needs-input": { "glyph": "✋", "spoken": "Needs input", "desc": "Shown on a job chip in the top bar when the job waits for your answer.", "words": ["answer", "halt", "hand"], "alts": ["🙋", "🔔", "🛑"] },
|
|
||||||
"dash.installed": { "glyph": "💾", "spoken": "Installed", "desc": "Marks a game that is installed on this PC. It labels the dashboard row, the library filter and table, and the badge on a game.", "words": ["installed", "disk", "local"], "alts": ["📥", "🗃️", "🖥️"] },
|
|
||||||
"gaming.series.other": { "glyph": "➕", "spoken": "Other games", "desc": "Legend and list entry that groups the many small games of the chart into one segment.", "words": ["other", "rest", "remainder"], "alts": ["🧩", "🗃️", "🔢"] },
|
|
||||||
"gaming.series.unattributed": { "glyph": "❔", "spoken": "Unattributed", "desc": "Legend entry for gaming time that no single game could be charged for.", "words": ["unattributed", "unclaimed", "orphan"], "alts": ["🫥", "🕳️", "👻"] },
|
|
||||||
"gaming.launcher": { "glyph": "🚀", "spoken": "Launcher", "desc": "Marks a game launcher such as a store client. It also labels the rule that counts launcher time against the budget.", "words": ["launcher", "client", "starter"], "alts": ["🛫", "🛸", "🏁"] },
|
|
||||||
"gaming.cutoff.masked": { "glyph": "⛔🔒", "spoken": "Cutoff, launchers masked", "desc": "Badge on a blocked day: the cutoff is engaged and the launchers are masked, so no game can start.", "words": ["cutoff", "masked", "sealed"], "alts": ["🚫🔒", "🛑🔐", "⛓️"] },
|
|
||||||
"gaming.cutoff.unmasked": { "glyph": "⛔🔓", "spoken": "Cutoff, launchers not masked", "desc": "Badge on a blocked day: the cutoff is engaged but no launcher is masked right now. That happens after a total block released the mounts.", "words": ["unmasked", "exposed", "leaking"], "alts": ["🚫🔓", "🛑🔓", "🪟"] },
|
|
||||||
"gaming.warn.none": { "glyph": "🔕", "spoken": "No more warnings", "desc": "Shows that no further warning fires today. The enforcer has already sent the last one.", "words": ["silent", "quiet", "muted"], "alts": ["🤫", "🔇", "💤"] },
|
|
||||||
"gaming.warning": { "glyph": "🔔", "spoken": "Warning", "desc": "The time of the next warning on today's card and the warning times in the rules card. The enforcer warns you when the remaining budget reaches them.", "words": ["warning", "alarm", "bell"], "alts": ["⏰", "📣", "🚨"] },
|
|
||||||
"gaming.day": { "glyph": "📅", "spoken": "Gaming day", "desc": "The date of the gaming day that today's budget belongs to.", "words": ["date", "day", "calendar"], "alts": ["🗓️", "📆", "📖"] },
|
|
||||||
"gaming.day_start": { "glyph": "🌅", "spoken": "Day starts", "desc": "The local time when the gaming day rolls over and the budget refills.", "words": ["sunrise", "rollover", "refill"], "alts": ["🌄", "⏰", "🔁"] },
|
|
||||||
"gaming.by_game": { "glyph": "🎮", "spoken": "Today by game", "desc": "Heading of the list that splits today's billed time by game.", "words": ["games", "split", "breakdown"], "alts": ["🕹️", "🎲", "👾"] },
|
|
||||||
"gaming.right_now": { "glyph": "📡", "spoken": "Right now", "desc": "Heading of the live card with the daemon's latest verdict on what the budget is charging.", "words": ["live", "now", "verdict"], "alts": ["📶", "🛰️", "🔴"] },
|
|
||||||
"gaming.qualifying": { "glyph": "⚙️", "spoken": "Qualifying processes", "desc": "The number of running processes that count as gaming and bill the budget.", "words": ["processes", "counted", "running"], "alts": ["🧮", "🔢", "🧩"] },
|
|
||||||
"gaming.billing_to": { "glyph": "💸", "spoken": "Billing to", "desc": "Names the game or launcher that the budget is charging right now.", "words": ["charging", "spending", "cost"], "alts": ["💰", "🪙", "💳"] },
|
|
||||||
"gaming.billed_last": { "glyph": "⏮️💸", "spoken": "Last billed to", "desc": "Names the game or launcher that was charged last, once nothing qualifies any more.", "words": ["previous", "last", "former"], "alts": ["🧾", "⏪💸", "📜"] },
|
|
||||||
"gaming.history": { "glyph": "📊", "spoken": "Last 14 days", "desc": "Heading of the chart with the billed gaming time of each of the last 14 days.", "words": ["history", "chart", "trend"], "alts": ["📈", "🗓️", "📉"] },
|
|
||||||
"gaming.rules": { "glyph": "📏", "spoken": "Rules in effect", "desc": "Heading of the card that lists the budget rules the enforcer applies right now.", "words": ["rules", "limits", "policy"], "alts": ["📐", "📜", "⚖️"] },
|
|
||||||
"gaming.budget": { "glyph": "⏱️", "spoken": "Daily budget", "desc": "Row label for how much gaming time one day allows.", "words": ["budget", "allowance", "quota"], "alts": ["⏲️", "🪙", "⌛"] },
|
|
||||||
"gaming.enforcement": { "glyph": "🛡️", "spoken": "Enforcement", "desc": "Row label that shows whether the enforcer cuts off gaming when the budget runs out.", "words": ["enforcement", "guard", "cutoff"], "alts": ["⚔️", "🚔", "🧱"] },
|
|
||||||
"gaming.mode": { "glyph": "🧪", "spoken": "Mode", "desc": "Row label for the budget mode, the real one or the demo.", "words": ["mode", "variant", "setting"], "alts": ["🎚️", "🔀", "🧭"] },
|
|
||||||
"gaming.demo": { "glyph": "🧪", "spoken": "Demo budget", "desc": "Marks the short demo budget with its separate state. As a link it switches the page to that demo.", "words": ["demo", "trial", "sandbox"], "alts": ["🔬", "🎬", "🧫"] },
|
|
||||||
"gaming.masked": { "glyph": "🔒", "spoken": "Masked launchers", "desc": "Row label that lists the launchers masked right now, so that they cannot start.", "words": ["masked", "hidden", "sealed"], "alts": ["🎭", "🚫", "🕶️"] },
|
|
||||||
"gaming.production": { "glyph": "🏭", "spoken": "Production budget", "desc": "Link shown on the demo page that switches back to the real daily budget.", "words": ["production", "real", "live"], "alts": ["🏢", "🌍", "🔙"] },
|
|
||||||
"daemon.heading": { "glyph": "🛡️", "spoken": "Enforcer daemon", "desc": "The root daemon that enforces the rules. It heads the daemon card and is the daemon badge in the top bar.", "words": ["daemon", "guard", "root"], "alts": ["🔐", "👮", "🏰"] },
|
|
||||||
"daemon.demo_run": { "glyph": "🧪", "spoken": "Demo run", "desc": "Button that opens the runner for a 60-second demo of the enforcer with a short budget.", "words": ["demo", "trial", "rehearsal"], "alts": ["🎬", "🔬", "🎭"] },
|
|
||||||
"daemon.journal": { "glyph": "📜", "spoken": "Journal", "desc": "Heading of the live tail of the daemon's log.", "words": ["journal", "log", "history"], "alts": ["📓", "🧾", "📰"] },
|
|
||||||
"daemon.state": { "glyph": "📡", "spoken": "State", "desc": "Row label for the daemon's current state.", "words": ["state", "status", "signal"], "alts": ["📶", "🩺", "🚦"] },
|
|
||||||
"daemon.running": { "glyph": "🟢", "spoken": "Running", "desc": "Daemon state: the daemon is up and answers.", "words": ["running", "alive", "up"], "alts": ["💚", "🔋", "👍"] },
|
|
||||||
"daemon.restarting": { "glyph": "🔄", "spoken": "Restarting", "desc": "Daemon state: the daemon is restarting and answers again in a moment.", "words": ["restarting", "cycling", "rebooting"], "alts": ["🔁", "🌀", "🟡"] },
|
|
||||||
"daemon.unreachable": { "glyph": "🔴", "spoken": "Unreachable", "desc": "Daemon state: the daemon does not answer, so the privileged actions are unavailable.", "words": ["unreachable", "down", "dead"], "alts": ["⚫", "💀", "📵"] },
|
|
||||||
"daemon.pid": { "glyph": "#️⃣", "spoken": "PID", "desc": "Row label for the process number of the running daemon.", "words": ["process", "number", "pid"], "alts": ["🔢", "🆔", "🪪"] },
|
|
||||||
"daemon.up_since": { "glyph": "⏱️", "spoken": "Up since", "desc": "Row label for how long the daemon has been running.", "words": ["uptime", "since", "age"], "alts": ["🕰️", "⏲️", "📆"] },
|
|
||||||
"daemon.restart": { "glyph": "🔄", "spoken": "Restart daemon", "desc": "Button that restarts the root daemon. A rate limit allows it only now and then.", "words": ["restart", "reload", "cycle"], "alts": ["🔁", "♻️", "⚡"] },
|
|
||||||
"server.heading": { "glyph": "🌐", "spoken": "Web server", "desc": "The web server that serves this UI. It heads the server card and is the server badge in the top bar.", "words": ["server", "web", "host"], "alts": ["🕸️", "📶", "🔌"] },
|
|
||||||
"server.version": { "glyph": "🏷️", "spoken": "Version", "desc": "Row label for the version of the running web server.", "words": ["version", "build", "release"], "alts": ["🔢", "🔖", "📦"] },
|
|
||||||
"server.started": { "glyph": "🕒", "spoken": "Started", "desc": "Row label for the time the web server process started.", "words": ["started", "launched", "since"], "alts": ["🕐", "⏰", "🚦"] },
|
|
||||||
"server.code": { "glyph": "💾", "spoken": "Code", "desc": "Row label that compares the code on disk with the running server. A warning means the server runs old code.", "words": ["code", "source", "files"], "alts": ["💻", "📝", "🧬"] },
|
|
||||||
"server.restart": { "glyph": "🔄", "spoken": "Restart server", "desc": "Button that restarts the web server, on the server card and in the stale-server banner. The page reloads when the server is back.", "words": ["restart", "reload", "refresh"], "alts": ["🔁", "♻️", "🚀"] },
|
|
||||||
"backup.item": { "glyph": "🗄️", "spoken": "Backup", "desc": "Heading of the card with the saved state backups, and the mark in front of one backup in the restore dialog.", "words": ["backup", "archive", "snapshot"], "alts": ["🗃️", "📦", "💿"] },
|
|
||||||
"backup.reason.reset": { "glyph": "♻️", "spoken": "Before reset", "desc": "Reason mark: the backup was taken right before a reset wiped the state.", "words": ["reset", "wipe", "recycle"], "alts": ["🧹", "🔁", "💣"] },
|
|
||||||
"backup.reason.nightly": { "glyph": "🌙", "spoken": "Nightly", "desc": "Reason mark: the backup was taken by the nightly timer.", "words": ["nightly", "scheduled", "night"], "alts": ["🌛", "🌃", "⭐"] },
|
|
||||||
"backup.reason.other": { "glyph": "🗄️", "spoken": "Other reason", "desc": "Reason mark for a backup whose reason the UI does not know.", "words": ["other", "unlabelled", "misc"], "alts": ["📁", "🧾", "🔖"] },
|
|
||||||
"backup.restore": { "glyph": "⏮️", "spoken": "Restore", "desc": "Button that restores the state from a backup. It first asks for a typed phrase.", "words": ["restore", "rewind", "rollback"], "alts": ["⏪", "↩️", "🔙"] },
|
|
||||||
"syssetup.configured": { "glyph": "⚙️", "spoken": "Configured", "desc": "Row label that shows whether setup is complete.", "words": ["configured", "ready", "complete"], "alts": ["🛠️", "🔩", "🎛️"] },
|
|
||||||
"syssetup.edit": { "glyph": "✏️", "spoken": "Open setup", "desc": "Link that opens the setup page, where the key and the SteamID can be changed.", "words": ["edit", "change", "pencil"], "alts": ["🖊️", "📝", "🧰"] },
|
|
||||||
"gaming.today": { "glyph": "📅", "spoken": "Today", "desc": "Heading of the card with today's budget numbers on the gaming page.", "words": ["today", "day", "budget"], "alts": ["🗓️", "📆", "🌞"] },
|
|
||||||
"basis.rush": { "glyph": "🐇", "spoken": "Rush", "desc": "Rush estimate: how long the games take at a fast completionist pace. It is a choice in the filter panel, a card in the summary and a column in the table.", "words": ["rush", "fast", "sprint"], "alts": ["🐎", "🚀", "🏃"] },
|
|
||||||
"basis.leisure": { "glyph": "🐢", "spoken": "Leisure", "desc": "Leisure estimate: how long the games take at a slow, comfortable pace. It is a choice in the filter panel, a card in the summary and a column in the table.", "words": ["leisure", "slow", "relaxed"], "alts": ["🦥", "🧘", "🛋️"] },
|
|
||||||
"basis.worst": { "glyph": "🐌", "spoken": "Worst case", "desc": "Worst-case estimate: the longest time anyone has recorded for each game. It is a choice in the filter panel, a card in the summary and a column in the table.", "words": ["worst", "longest", "maximum"], "alts": ["🐘", "🧱", "🕰️"] },
|
|
||||||
"basis.pace": { "glyph": "👤", "spoken": "Your pace", "desc": "Your own pace: the estimate built from how fast you finished games before. It marks the pace choice, the pace card and your play-style block.", "words": ["pace", "yours", "personal"], "alts": ["🙋", "🧍", "🪞"] },
|
|
||||||
"style.fast": { "glyph": "⚡", "spoken": "Faster than HLTB rush", "desc": "Play style: you finish games faster than the fast times on HowLongToBeat.", "words": ["fast", "speedy", "quick"], "alts": ["🚀", "💨", "🏎️"] },
|
|
||||||
"style.between": { "glyph": "🐇↔🐢", "spoken": "Between rush and leisure", "desc": "Play style: your pace sits between the rush and leisure times on HowLongToBeat.", "words": ["between", "average", "typical"], "alts": ["⚖️", "🔀", "↔️"] },
|
|
||||||
"style.slow": { "glyph": "🐌", "spoken": "Slower than HLTB leisure", "desc": "Play style: you finish games slower than the slow leisure times on HowLongToBeat.", "words": ["slow", "careful", "thorough"], "alts": ["🦥", "🪨", "🛌"] },
|
|
||||||
"tier.native": { "glyph": "⭐", "spoken": "Native", "desc": "ProtonDB tier native: the game runs on Linux without Proton. It shows in the tier column and the tier filters.", "words": ["native", "linux", "built-in"], "alts": ["🌟", "✨", "🎖️"] },
|
|
||||||
"tier.platinum": { "glyph": "💎", "spoken": "Platinum", "desc": "ProtonDB tier platinum: the game runs perfectly under Proton out of the box. It shows in the tier column and the tier filters.", "words": ["platinum", "perfect", "flawless"], "alts": ["💠", "🔷", "👑"] },
|
|
||||||
"tier.gold": { "glyph": "🥇", "spoken": "Gold", "desc": "ProtonDB tier gold: the game runs perfectly after small tweaks. It shows in the tier column and the tier filters.", "words": ["gold", "great", "tweaked"], "alts": ["🏅", "🟡", "👍"] },
|
|
||||||
"tier.silver": { "glyph": "🥈", "spoken": "Silver", "desc": "ProtonDB tier silver: the game is playable with minor issues. It shows in the tier column and the tier filters.", "words": ["silver", "playable", "minor"], "alts": ["⚪", "🔘", "🪙"] },
|
|
||||||
"tier.bronze": { "glyph": "🥉", "spoken": "Bronze", "desc": "ProtonDB tier bronze: the game runs but with frequent problems. It shows in the tier column and the tier filters.", "words": ["bronze", "rough", "shaky"], "alts": ["🟤", "🔶", "🪵"] },
|
|
||||||
"tier.borked": { "glyph": "💥", "spoken": "Borked", "desc": "ProtonDB tier borked: the game does not run at all. It shows in the tier column and the tier filters.", "words": ["borked", "broken", "unplayable"], "alts": ["💀", "🧨", "☠️"] },
|
|
||||||
"tier.pending": { "glyph": "⏳", "spoken": "Pending", "desc": "ProtonDB tier pending: there are not enough reports to rate the game yet. It shows in the tier column and the tier filters.", "words": ["pending", "unrated", "waiting"], "alts": ["⌛", "🕓", "🔜"] },
|
|
||||||
"keep.kept": { "glyph": "📌", "spoken": "Kept", "desc": "Value of the keep filter: the game stays in the plan. Choosing it shows only the kept games.", "words": ["kept", "pinned", "included"], "alts": ["📍", "🔖", "🧷"] },
|
|
||||||
"keep.excluded": { "glyph": "🚫", "spoken": "Excluded", "desc": "Value of the keep filter: you took the game out of the plan. Choosing it shows only the dropped games.", "words": ["excluded", "dropped", "skipped"], "alts": ["🙅", "🗑️", "✂️"] },
|
|
||||||
"backlog.any": { "glyph": "✱", "spoken": "Any", "desc": "Any value: in a filter it sets no limit and shows every game.", "words": ["any", "all", "everything"], "alts": ["✳️", "🌐", "♾️"] },
|
|
||||||
"backlog.cli": { "glyph": "⌨️", "spoken": "CLI default", "desc": "Stands for the command-line tool's own rule. It marks the playable rule, the default game count and what reset restores.", "words": ["cli", "terminal", "default"], "alts": ["💻", "🖥️", "📟"] },
|
|
||||||
"filter.reset": { "glyph": "↺", "spoken": "Reset to CLI defaults", "desc": "Button in the filter panel that sets every filter back to the CLI defaults.", "words": ["reset", "restore", "defaults"], "alts": ["🔃", "↩️", "🧹"] },
|
|
||||||
"filter.min-tier": { "glyph": "🥇≥", "spoken": "Min tier", "desc": "Choice of the ProtonDB filter: keep games at or above a minimum tier that you pick.", "words": ["minimum", "tier", "threshold"], "alts": ["🥇+", "🪜", "⬆️"] },
|
|
||||||
"filter.started": { "glyph": "▶️", "spoken": "Started", "desc": "Choice of the playtime filter: only games you have already started.", "words": ["started", "played", "begun"], "alts": ["🕹️", "⏯️", "🟢"] },
|
|
||||||
"filter.untouched": { "glyph": "∅", "spoken": "Untouched", "desc": "Choice of the playtime filter: only games with no playtime at all.", "words": ["untouched", "unplayed", "fresh"], "alts": ["🆕", "🧼", "⭕"] },
|
|
||||||
"filter.daily": { "glyph": "⏰", "spoken": "Daily play time", "desc": "Slider for how many hours you play each day. The time estimates divide by it.", "words": ["daily", "hours", "schedule"], "alts": ["🕰️", "⌚", "📆"] },
|
|
||||||
"planner.completions": { "glyph": "#", "spoken": "HLTB completions", "desc": "How many completion times HowLongToBeat holds for a game. It is a table column and the minimum slider in the filter panel.", "words": ["completions", "polled", "count"], "alts": ["🔢", "🧮", "🗳️"] },
|
|
||||||
"filter.min-polled": { "glyph": "💯", "spoken": "Min polled completionist times", "desc": "Slider for the fewest polled completionist times a game needs to count.", "words": ["polled", "completionist", "hundred"], "alts": ["💮", "🧪", "🔟"] },
|
|
||||||
"filter.min-confidence": { "glyph": "Σ", "spoken": "Min confidence sum", "desc": "Slider for the minimum confidence sum, the total weight of the time reports behind an estimate.", "words": ["confidence", "weight", "sum"], "alts": ["🧮", "➕", "🪙"] },
|
|
||||||
"filter.max-time": { "glyph": "⏳", "spoken": "Max time per game", "desc": "Slider for the longest game you accept. Longer games are hidden.", "words": ["cap", "longest", "limit"], "alts": ["⌛", "⏲️", "🛑"] },
|
|
||||||
"filter.no-cap": { "glyph": "∞", "spoken": "No cap", "desc": "Shown in place of the hours when the time cap is off.", "words": ["unlimited", "endless", "uncapped"], "alts": ["♾️", "🌌", "🔓"] },
|
|
||||||
"filter.fallback": { "glyph": "❓", "spoken": "Fallback estimate", "desc": "Slider for the hours guessed for games that have no time data.", "words": ["guess", "fallback", "default"], "alts": ["🎲", "🤔", "📏"] },
|
|
||||||
"filter.basis": { "glyph": "📐", "spoken": "Estimate basis", "desc": "Heading of the estimate-basis choice: rush, leisure, worst case or your pace.", "words": ["basis", "model", "method"], "alts": ["📏", "🧭", "🧮"] },
|
|
||||||
"filter.advanced": { "glyph": "🔬", "spoken": "Advanced confidence", "desc": "Heading of the folded advanced confidence settings. Opening it shows two more sliders.", "words": ["advanced", "expert", "details"], "alts": ["🧪", "🔭", "🛠️"] },
|
|
||||||
"planner.proton": { "glyph": "🐧", "spoken": "ProtonDB", "desc": "ProtonDB: how well a game runs on Linux. It heads the compatibility filter and the table column.", "words": ["proton", "linux", "compatibility"], "alts": ["🍷", "🧩", "💻"] },
|
|
||||||
"filter.proton-missing": { "glyph": "❓", "spoken": "Keep games with no ProtonDB data", "desc": "Checkbox in the compatibility filter: keep games that have no ProtonDB data in the list.", "words": ["unrated", "unknown", "missing"], "alts": ["🤷", "🫥", "🌫️"] },
|
|
||||||
"planner.playtime": { "glyph": "⏱", "spoken": "Playtime", "desc": "Your playtime in a game. It heads the playtime filter and the table column.", "words": ["playtime", "hours", "played"], "alts": ["⌛", "🕒", "📈"] },
|
|
||||||
"planner.no-data": { "glyph": "❓", "spoken": "No HLTB data", "desc": "Badge on a game that has no HowLongToBeat data. The checkbox with the same mark includes such games, using the fallback hours.", "words": ["blank", "unmeasured", "unrated"], "alts": ["🫥", "🕳️", "🚧"] },
|
|
||||||
"filter.target-date": { "glyph": "🏁", "spoken": "Target finish date", "desc": "Target finish date: the filter's date field and the by-date marker in the banner. It turns hours into the daily pace you need.", "words": ["deadline", "target", "finish"], "alts": ["🎌", "🗓️", "🚩"] },
|
|
||||||
"filter.clear-date": { "glyph": "✕", "spoken": "Clear", "desc": "Button that clears the target finish date.", "words": ["clear", "erase", "remove"], "alts": ["✖️", "🧽", "⌫"] },
|
|
||||||
"backlog.sort-asc": { "glyph": "▲", "spoken": "Ascending", "desc": "Marks the table column that is sorted from low to high.", "words": ["ascending", "up", "lowest"], "alts": ["🔼", "⬆️", "📈"] },
|
|
||||||
"backlog.sort-desc": { "glyph": "▼", "spoken": "Descending", "desc": "Marks the table column that is sorted from high to low.", "words": ["descending", "down", "highest"], "alts": ["🔽", "⬇️", "📉"] },
|
|
||||||
"planner.game": { "glyph": "🎮", "spoken": "Game", "desc": "Table column with the game names. Clicking its header sorts by name.", "words": ["game", "title", "name"], "alts": ["🕹️", "🎲", "🔤"] },
|
|
||||||
"planner.completion": { "glyph": "%", "spoken": "Completion", "desc": "Table column with each game's achievement completion in percent.", "words": ["completion", "progress", "percent"], "alts": ["📶", "🧩", "📏"] },
|
|
||||||
"planner.keep": { "glyph": "📌", "spoken": "Keep", "desc": "Table column with the checkbox that keeps a game in the plan or drops it.", "words": ["keep", "include", "toggle"], "alts": ["📍", "☑️", "🔖"] },
|
|
||||||
"summary.to-finish": { "glyph": "🎮", "spoken": "To finish", "desc": "Banner on the backlog page: how many games are left to finish by your target date.", "words": ["remaining", "left", "games"], "alts": ["🕹️", "🎲", "🎯"] },
|
|
||||||
"summary.games-per-day": { "glyph": "🎮", "spoken": "Games per day", "desc": "Unit on the pace card and banner: games finished per day. It follows the number.", "words": ["rate", "speed", "tempo"], "alts": ["🕹️", "🎲", "🏃"] },
|
|
||||||
"backlog.in-scope": { "glyph": "🎮", "spoken": "Games in scope", "desc": "Count of games that pass the filters. It sits beside the big number in the summary and in the stats card.", "words": ["scope", "qualifying", "matching"], "alts": ["🧮", "🎲", "📚"] },
|
|
||||||
"summary.need": { "glyph": "→", "spoken": "You need", "desc": "Arrow in the target banner between the chosen model and the daily time you need.", "words": ["needs", "requires", "equals"], "alts": ["➡️", "⇨", "👉"] },
|
|
||||||
"summary.no-start": { "glyph": "∅", "spoken": "No start date set", "desc": "Shown on the pace card when no start date is set, so there is no finish date.", "words": ["unset", "empty", "undated"], "alts": ["⭕", "🕳️", "🗓️"] },
|
|
||||||
"summary.style": { "glyph": "🎭", "spoken": "Play style", "desc": "Label of the play-style row: how your pace compares with the HowLongToBeat times.", "words": ["style", "manner", "persona"], "alts": ["🧠", "🪞", "🎬"] },
|
|
||||||
"summary.interpolation": { "glyph": "t", "spoken": "Interpolation t", "desc": "Label of the blend value t. It is 0 at rush speed and 1 at leisure speed.", "words": ["blend", "position", "interpolation"], "alts": ["📏", "⚖️", "🔀"] },
|
|
||||||
"summary.estimated-total": { "glyph": "Σ", "spoken": "Estimated total at your pace", "desc": "Label of your estimated total time to finish all games at your pace.", "words": ["total", "estimate", "sum"], "alts": ["🧮", "⏳", "🏔️"] },
|
|
||||||
"summary.match": { "glyph": "✓", "spoken": "Match", "desc": "Shown when the number of games in scope equals the CLI default.", "words": ["match", "equal", "same"], "alts": ["✔️", "🟰", "👌"] },
|
|
||||||
"planner.playing": { "glyph": "▶️", "spoken": "Currently playing", "desc": "On the planner header: the game you are playing right now.", "words": ["playing", "current", "active"], "alts": ["🕹️", "⏯️", "🔵"] },
|
|
||||||
"planner.since": { "glyph": "📅", "spoken": "Since", "desc": "On the planner header: the date the enforcer started counting.", "words": ["since", "started", "begun"], "alts": ["🗓️", "📆", "🕰️"] },
|
|
||||||
"planner.candidates": { "glyph": "🎮", "spoken": "Candidates", "desc": "On the planner header: how many games the planner can pick from.", "words": ["candidates", "pool", "options"], "alts": ["🎲", "📚", "🧮"] },
|
|
||||||
"stats.card": { "glyph": "📊", "spoken": "Estimates", "desc": "Heading of the estimates card on the backlog page. It shows the totals for the default filters.", "words": ["estimates", "totals", "numbers"], "alts": ["📈", "🧮", "🗂️"] },
|
|
||||||
"backlog.filters": { "glyph": "🎚️", "spoken": "Filters", "desc": "Heading of the filter panel on the backlog page. Its sliders and switches narrow the game list.", "words": ["filters", "sliders", "controls"], "alts": ["🎛️", "🧰", "🔘"] },
|
|
||||||
"cmdflag.root": { "glyph": "🔑", "spoken": "Runs as root", "desc": "Flag on a command: it runs as root through the daemon. It shows on the command card and in the run dialog.", "words": ["root", "admin", "privileged"], "alts": ["🗝️", "👑", "🔐"] },
|
|
||||||
"cmdflag.countdown": { "glyph": "⏳", "spoken": "Countdown", "desc": "Flag on a command: it asks for a countdown before it can be committed. In the run dialog it carries the minutes.", "words": ["countdown", "delay", "wait"], "alts": ["⏲️", "🕰️", "⌛"] },
|
|
||||||
"cmdflag.mutating": { "glyph": "✏️", "spoken": "Changes state", "desc": "Flag in the run dialog: this command changes state on your PC or in the enforcer.", "words": ["changes", "writes", "mutates"], "alts": ["📝", "🖊️", "🛠️"] },
|
|
||||||
"cmdflag.readonly": { "glyph": "👁️", "spoken": "Read-only", "desc": "Flag in the run dialog: this command only reads and changes nothing.", "words": ["readonly", "safe", "viewing"], "alts": ["📖", "🧐", "🪞"] },
|
|
||||||
"cmdflag.cancellable": { "glyph": "⏹️", "spoken": "Cancellable", "desc": "Flag in the run dialog: a running job of this command can be stopped.", "words": ["stoppable", "cancel", "abort"], "alts": ["🛑", "✋", "🚦"] },
|
|
||||||
"cmdpal.search": { "glyph": "🔍", "spoken": "Search commands", "desc": "Search field of the command palette. Typing narrows the list of commands and pages.", "words": ["search", "filter", "find"], "alts": ["🔎", "🔦", "🕵️"] },
|
|
||||||
"cmdpal.run-phrase": { "glyph": "▶️⌨️", "spoken": "Run, needs a phrase", "desc": "Hint on a palette entry: choosing it opens the run dialog, where you must type a phrase first.", "words": ["confirm", "phrase", "guarded"], "alts": ["▶️🔐", "🛂", "🚧"] },
|
|
||||||
"cmdpal.open": { "glyph": "↗️", "spoken": "Open page", "desc": "Hint on a palette entry for a command that only views data: choosing it opens the page that shows it.", "words": ["page", "view", "open"], "alts": ["🔗", "🪟", "📄"] },
|
|
||||||
"cmdpal.go": { "glyph": "🧭", "spoken": "Go to", "desc": "Hint on a palette entry for a page: choosing it navigates there.", "words": ["navigate", "go", "jump"], "alts": ["🚀", "🗺️", "📍"] },
|
|
||||||
"runner.run": { "glyph": "▶️", "spoken": "Run", "desc": "Button that runs the command in the run dialog. The palette shows it as the hint on entries that run one.", "words": ["run", "start", "go"], "alts": ["🚀", "⏩", "🟢"] },
|
|
||||||
"runner.arm": { "glyph": "⏲️", "spoken": "Arm countdown", "desc": "Submit button for a command with a countdown: it arms the countdown instead of running at once.", "words": ["arm", "schedule", "delay"], "alts": ["⏰", "🧨", "🔔"] },
|
|
||||||
"runner.fill": { "glyph": "⬆️", "spoken": "Fill the fields above", "desc": "Hint in the run dialog: the exact phrase appears once the fields above are filled in.", "words": ["fill", "above", "complete"], "alts": ["☝️", "📝", "⏫"] },
|
|
||||||
"runner.terminal": { "glyph": "💻", "spoken": "Run from a terminal", "desc": "Shown when the root daemon is unreachable. The command beside it runs the same job from a terminal.", "words": ["terminal", "shell", "console"], "alts": ["⌨️", "🖥️", "🐚"] },
|
|
||||||
"params.app_id": { "glyph": "🎮", "spoken": "Game", "desc": "Field in the run dialog: the game to act on, by app id or by picking its name.", "words": ["game", "app", "title"], "alts": ["🕹️", "👾", "🎲"] },
|
|
||||||
"params.backup_id": { "glyph": "🗄️", "spoken": "Backup", "desc": "Field in the run dialog: which saved state backup to use.", "words": ["backup", "archive", "snapshot"], "alts": ["💾", "📼", "🗃️"] },
|
|
||||||
"params.days": { "glyph": "📅", "spoken": "Days", "desc": "Field in the run dialog: how many days the action lasts.", "words": ["days", "duration", "span"], "alts": ["🗓️", "📆", "🌅"] },
|
|
||||||
"params.minutes": { "glyph": "⏱️", "spoken": "Minutes", "desc": "Field in the run dialog: how many minutes the action lasts.", "words": ["minutes", "timer", "length"], "alts": ["⏲️", "🕐", "⌛"] },
|
|
||||||
"params.reason": { "glyph": "💬", "spoken": "Reason", "desc": "Field in the run dialog: why you do this. The reason is logged.", "words": ["reason", "why", "note"], "alts": ["📝", "🗨️", "🧾"] },
|
|
||||||
"params.replace": { "glyph": "🔁", "spoken": "Replace", "desc": "Switch in the run dialog: replace the current game instead of keeping it.", "words": ["replace", "swap", "override"], "alts": ["🔄", "♻️", "🔀"] },
|
|
||||||
"params.demo": { "glyph": "🧪", "spoken": "Demo", "desc": "Switch in the run dialog: run the short demo budget instead of the real one.", "words": ["demo", "test", "trial"], "alts": ["🎬", "🧫", "🔬"] },
|
|
||||||
"params.other": { "glyph": "✏️", "spoken": "Field", "desc": "Marks any run-dialog field that has no icon of its own.", "words": ["field", "input", "value"], "alts": ["🖊️", "📝", "🔤"] },
|
|
||||||
"phrase.field": { "glyph": "⌨️", "spoken": "Type the phrase", "desc": "Label of the typed-phrase field. You retype the shown sentence, and pasting is blocked.", "words": ["type", "phrase", "retype"], "alts": ["🔤", "✍️", "📜"] },
|
|
||||||
"pending.leave": { "glyph": "🚪✖️", "spoken": "Leaving cancels", "desc": "Warning during a countdown: closing the dialog or leaving the page cancels it.", "words": ["leaving", "stay", "warning"], "alts": ["🚪🚫", "🏃", "⚠️🚪"] },
|
|
||||||
"pending.rearm": { "glyph": "🔁", "spoken": "Arm again", "desc": "Button shown when the countdown lapsed: it starts the command over.", "words": ["rearm", "retry", "again"], "alts": ["🔄", "↩️", "🆕"] },
|
|
||||||
"pending.beat": { "glyph": "💓", "spoken": "Heartbeat", "desc": "Seconds since the last heartbeat that keeps the countdown alive. It turns into a broken heart when beats fail.", "words": ["heartbeat", "pulse", "alive"], "alts": ["💗", "📶", "🫀"] },
|
|
||||||
"pending.beat-lost": { "glyph": "💔", "spoken": "Heartbeat failing", "desc": "Replaces the heartbeat while beats fail. The countdown lapses if they do not recover.", "words": ["failing", "lost", "flatline"], "alts": ["📵", "🥀", "🔌"] },
|
|
||||||
"lib.sort": { "glyph": "↕️", "spoken": "Sort", "desc": "Label of the sort menu in the game browser. The menu orders the grid by name, last played, completion or length.", "words": ["sort", "order", "rank"], "alts": ["🔃", "🔽", "📊"] },
|
|
||||||
"lib.name": { "glyph": "🔤", "spoken": "Name", "desc": "Sort option: games in alphabetical order by name.", "words": ["name", "alphabet", "title"], "alts": ["🔡", "🅰️", "📇"] },
|
|
||||||
"lib.recent": { "glyph": "🕐", "spoken": "Recently played", "desc": "Sort option: the games you played most recently come first.", "words": ["recent", "lately", "latest"], "alts": ["🕓", "📆", "⏪"] },
|
|
||||||
"lib.completion": { "glyph": "🏆", "spoken": "Completion", "desc": "Share of achievements unlocked. It is a sort option and the first part of each game's meta line.", "words": ["completion", "progress", "percent"], "alts": ["🥇", "🎖️", "📈"] },
|
|
||||||
"lib.hltb": { "glyph": "⏱️", "spoken": "Time to beat", "desc": "Hours that How Long To Beat lists for the game. It is a sort option, shortest first, and part of the meta line.", "words": ["hltb", "hours", "length"], "alts": ["⏳", "⌛", "🕰️"] },
|
|
||||||
"lib.played": { "glyph": "▶️", "spoken": "Played", "desc": "Hours you have played the game, shown in its meta line.", "words": ["played", "playtime", "logged"], "alts": ["🎮", "🕹️", "⏯️"] },
|
|
||||||
"lib.hide-completed": { "glyph": "🙈🏆", "spoken": "Hide completed", "desc": "Filter in the game browser: hide the games you have finished.", "words": ["hide", "unfinished", "remaining"], "alts": ["🚫🏆", "🫥", "🧹"] },
|
|
||||||
"lib.pickable": { "glyph": "🎯", "spoken": "Pickable", "desc": "Filter in the game browser: show only the games the enforcer lets you pick.", "words": ["pickable", "eligible", "allowed"], "alts": ["🎟️", "🔓", "👌"] },
|
|
||||||
"lib.count": { "glyph": "🎮", "spoken": "Games shown", "desc": "Count in the game browser: the games shown before the slash, the games in total after it.", "words": ["games", "count", "shown"], "alts": ["🕹️", "👾", "🔢"] },
|
|
||||||
"lib.relevance": { "glyph": "🔍", "spoken": "By relevance", "desc": "Appears beside the count while a search ranks the games by relevance. The sort menu is off then.", "words": ["relevance", "ranked", "matched"], "alts": ["🎯", "📊", "🧲"] },
|
|
||||||
"lib.search": { "glyph": "🔍", "spoken": "Search your games", "desc": "Search field of the game browser. Typing filters the grid and lists suggestions.", "words": ["search", "find", "lookup"], "alts": ["🔎", "🕵️", "🧐"] },
|
|
||||||
"lib.why.complete": { "glyph": "🏆✅", "spoken": "Already complete", "desc": "Reason a game cannot be picked: all its achievements are done.", "words": ["complete", "finished", "maxed"], "alts": ["🥇", "💯", "🎖️"] },
|
|
||||||
"lib.why.noach": { "glyph": "🏆🚫", "spoken": "No achievements", "desc": "Reason a game cannot be picked: it has no achievements to earn.", "words": ["none", "barren", "empty"], "alts": ["🚫", "🪹", "🕳️"] },
|
|
||||||
"lib.why.skipped": { "glyph": "⏭️", "spoken": "Skipped", "desc": "Reason a game cannot be picked: it was skipped until the date shown beside it.", "words": ["skipped", "deferred", "paused"], "alts": ["⏩", "🛌", "📅"] },
|
|
||||||
"lib.why.blocked": { "glyph": "⛔", "spoken": "Not allowed", "desc": "Reason a game cannot be picked, for any other cause. The server's sentence is spoken.", "words": ["blocked", "refused", "banned"], "alts": ["🚫", "🛑", "🔒"] },
|
|
||||||
"health.ok": { "glyph": "✅", "spoken": "Healthy", "desc": "State mark on a health badge: all is well.", "words": ["healthy", "fine", "up"], "alts": ["🟢", "💚", "👍"] },
|
|
||||||
"health.warn": { "glyph": "⚠️", "spoken": "Degraded", "desc": "State mark on a health badge: the server runs stale code or the daemon is restarting.", "words": ["degraded", "stale", "shaky"], "alts": ["🟡", "🟠", "🚧"] },
|
|
||||||
"health.bad": { "glyph": "⛔", "spoken": "Down", "desc": "State mark on a health badge: the server is down or the daemon is unreachable.", "words": ["down", "dead", "offline"], "alts": ["🔴", "💥", "🛑"] },
|
|
||||||
"health.unknown": { "glyph": "…", "spoken": "Unknown", "desc": "State mark on a health badge before the daemon state is known.", "words": ["unknown", "loading", "pending"], "alts": ["❔", "💤", "🔘"] },
|
|
||||||
"health.stale": { "glyph": "⚠️🌐", "spoken": "Stale server", "desc": "Banner mark: the running server is older than the code on disk. The restart button beside it fixes that.", "words": ["stale", "outdated", "old"], "alts": ["🕰️🌐", "🥀", "📛"] },
|
|
||||||
"dialog.close": { "glyph": "×", "spoken": "Close", "desc": "Close button in the corner of every dialog.", "words": ["close", "exit", "dismiss"], "alts": ["✖️", "❌", "🚪"] },
|
|
||||||
"words.page": { "glyph": "🏷️", "spoken": "Icon words", "desc": "Command palette entry that opens this icon-words picker. You are here now.", "words": ["words", "labels", "names"], "alts": ["🔖", "🗨️", "🔤"] }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,13 +9,10 @@ const JOB_STATES: JobState[] = ['queued', 'running', 'waiting_input', 'succeeded
|
|||||||
const TONES: Tone[] = ['info', 'success', 'warning', 'danger']
|
const TONES: Tone[] = ['info', 'success', 'warning', 'danger']
|
||||||
|
|
||||||
describe('icon registry', () => {
|
describe('icon registry', () => {
|
||||||
it('registers pass 1 first (8 nav, the palette, 26 commands, 6 job states, 4 tones), then the rest of the UI', () => {
|
it('registers exactly this pass: 8 nav, the palette, 26 commands, 6 job states, 4 tones', () => {
|
||||||
const ids = ICONS.map((e) => e.id)
|
const ids = ICONS.map((e) => e.id)
|
||||||
expect(new Set(ids).size).toBe(ids.length)
|
expect(new Set(ids).size).toBe(ids.length)
|
||||||
const pass1 = /^(nav|palette|cmd|job\.state|notice)\./
|
expect(ids).toHaveLength(8 + 1 + 26 + 6 + 4)
|
||||||
expect(ids.slice(0, 8 + 1 + 26 + 6 + 4).every((id) => pass1.test(id))).toBe(true)
|
|
||||||
expect(ids.slice(8 + 1 + 26 + 6 + 4).some((id) => pass1.test(id))).toBe(false)
|
|
||||||
expect(ids.length).toBeGreaterThan(45)
|
|
||||||
for (const n of NAV) expect(isIconId(n.icon)).toBe(true)
|
for (const n of NAV) expect(isIconId(n.icon)).toBe(true)
|
||||||
expect(isIconId('palette.open')).toBe(true)
|
expect(isIconId('palette.open')).toBe(true)
|
||||||
for (const name of Object.keys(COMMAND_HOME) as (keyof typeof COMMAND_HOME)[]) {
|
for (const name of Object.keys(COMMAND_HOME) as (keyof typeof COMMAND_HOME)[]) {
|
||||||
@ -25,9 +22,7 @@ describe('icon registry', () => {
|
|||||||
for (const t of TONES) expect(isIconId(`notice.${t}`)).toBe(true)
|
for (const t of TONES) expect(isIconId(`notice.${t}`)).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it.each(ICONS.map((e) => [e.id, e] as const))('%s: glyph, name, description, 3 words, 3 alternatives', (id, e) => {
|
it.each(ICONS.map((e) => [e.id, e] as const))('%s: glyph, name, description, 3 words, 3 alternatives', (_id, e) => {
|
||||||
// The server's route accepts only this id shape (_web_routes._ICON).
|
|
||||||
expect(id).toMatch(/^[a-z][a-z0-9_.-]{0,63}$/)
|
|
||||||
expect(e.glyph).not.toBe('')
|
expect(e.glyph).not.toBe('')
|
||||||
expect(e.spoken).not.toBe('')
|
expect(e.spoken).not.toBe('')
|
||||||
expect(e.desc.length).toBeGreaterThan(20)
|
expect(e.desc.length).toBeGreaterThan(20)
|
||||||
@ -37,8 +32,6 @@ describe('icon registry', () => {
|
|||||||
for (const w of e.words) expect(w).toMatch(/^\S+$/)
|
for (const w of e.words) expect(w).toMatch(/^\S+$/)
|
||||||
expect(e.alts).toHaveLength(3)
|
expect(e.alts).toHaveLength(3)
|
||||||
expect(new Set([e.glyph, ...e.alts]).size).toBe(4)
|
expect(new Set([e.glyph, ...e.alts]).size).toBe(4)
|
||||||
// Not the same picture twice, even when only the emoji variation selector differs.
|
|
||||||
expect(new Set([e.glyph, ...e.alts].map((g) => g.replaceAll('️', ''))).size).toBe(4)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('keeps every default glyph the UI painted before the registry', () => {
|
it('keeps every default glyph the UI painted before the registry', () => {
|
||||||
|
|||||||
@ -66,10 +66,11 @@ describe('glyph(id)', () => {
|
|||||||
expect(el.querySelector('.icon-word')).toBeNull()
|
expect(el.querySelector('.icon-word')).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('tags the glyph with its id so decorateIcons can refresh it', () => {
|
it('still paints a raw glyph with the old signature', () => {
|
||||||
const el = glyph('state.warn', 'Stale')
|
const el = glyph('🧭', 'navigate')
|
||||||
expect(el.querySelector('[data-icon]')?.getAttribute('data-icon')).toBe('state.warn')
|
expect(el.querySelector('[aria-hidden]')?.textContent).toBe('🧭')
|
||||||
expect(el.querySelector('.sr-only')?.textContent).toBe('Stale')
|
expect(el.querySelector('.sr-only')?.textContent).toBe('navigate')
|
||||||
|
expect(el.querySelector('.icon-word')).toBeNull()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -36,17 +36,6 @@ export function iconWord(id: IconId): HTMLSpanElement | null {
|
|||||||
return word ? h('span', { class: 'icon-word', 'aria-hidden': 'true', 'data-icon-word': id }, word) : null
|
return word ? h('span', { class: 'icon-word', 'aria-hidden': 'true', 'data-icon-word': id }, word) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The icon for painted-only places (inside `said(...)`, buttons, labels): the
|
|
||||||
* glyph mark alone, or mark plus word in one row when the user chose a word.
|
|
||||||
* No spoken text: the caller keeps its own aria-label / .sr-only sentence.
|
|
||||||
*/
|
|
||||||
export function iconInline(id: IconId, className = ''): HTMLSpanElement {
|
|
||||||
const mark = iconMark(id, className)
|
|
||||||
const word = iconWord(id)
|
|
||||||
return word ? h('span', { class: 'icon-inline has-word' }, mark, word) : mark
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh static markup (the Astro sidebar and palette button) from the
|
* Refresh static markup (the Astro sidebar and palette button) from the
|
||||||
* ledger: each `[data-icon]` gets its current glyph and, right after it, its
|
* ledger: each `[data-icon]` gets its current glyph and, right after it, its
|
||||||
@ -65,10 +54,7 @@ export function decorateIcons(root: ParentNode): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** The static chrome every page shares (sidebar, top bar); run at boot and after a pick. */
|
||||||
* The static chrome every page shares (sidebar, top bar) plus any static
|
|
||||||
* markup tagged `data-static-icons` (the 404 home link); run at boot and after a pick.
|
|
||||||
*/
|
|
||||||
export function decorateChrome(doc: Document = document): void {
|
export function decorateChrome(doc: Document = document): void {
|
||||||
for (const el of doc.querySelectorAll('.sidebar, .topbar, [data-static-icons]')) decorateIcons(el)
|
for (const el of doc.querySelectorAll('.sidebar, .topbar')) decorateIcons(el)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
// Static Astro markup outside the sidebar and top bar (the 404 home link) opts
|
|
||||||
// in with `data-static-icons`; the boot decoration then paints the user's
|
|
||||||
// word and glyph there too.
|
|
||||||
|
|
||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { decorateChrome } from './render'
|
|
||||||
|
|
||||||
const markup = (attr: string) => `
|
|
||||||
<div class="actions" ${attr}>
|
|
||||||
<a href="/" aria-label="Back to the dashboard"><span aria-hidden="true" data-icon="nav.dashboard">🏠</span></a>
|
|
||||||
</div>`
|
|
||||||
|
|
||||||
describe('decorateChrome and data-static-icons', () => {
|
|
||||||
it('decorates a tagged container with the word and the alternative glyph', () => {
|
|
||||||
useIcons({ 'nav.dashboard': { word: 'home', glyph: '🏡' } })
|
|
||||||
document.body.innerHTML = markup('data-static-icons')
|
|
||||||
decorateChrome()
|
|
||||||
const icon = document.querySelector('[data-icon]')
|
|
||||||
expect(icon?.textContent).toBe('🏡')
|
|
||||||
expect(icon?.nextElementSibling).toHaveClass('icon-word')
|
|
||||||
expect(icon?.nextElementSibling?.textContent).toBe('Home')
|
|
||||||
expect(icon?.parentElement).toHaveClass('has-word')
|
|
||||||
expect(document.querySelector('a')).toHaveAttribute('aria-label', 'Back to the dashboard')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('leaves untagged containers alone', () => {
|
|
||||||
useIcons({ 'nav.dashboard': { word: 'home', glyph: '🏡' } })
|
|
||||||
document.body.innerHTML = markup('')
|
|
||||||
decorateChrome()
|
|
||||||
expect(document.querySelector('[data-icon]')?.textContent).toBe('🏠')
|
|
||||||
expect(document.querySelector('.icon-word')).toBeNull()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
// right of the icon, a chosen alternative replaces the default glyph.
|
// right of the icon, a chosen alternative replaces the default glyph.
|
||||||
|
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { commandIcon } from '../commands/catalog'
|
import { COMMAND_ICON, commandIcon } from '../commands/catalog'
|
||||||
import { commandButton } from '../commands/commandButton'
|
import { commandButton } from '../commands/commandButton'
|
||||||
import { stateBadge } from '../jobs/progress'
|
import { stateBadge } from '../jobs/progress'
|
||||||
import { NAV } from '../shell/nav'
|
import { NAV } from '../shell/nav'
|
||||||
@ -48,4 +48,10 @@ describe('registered call sites', () => {
|
|||||||
expect(commandIcon('gaming-status')).toBe('cmd.gaming-status')
|
expect(commandIcon('gaming-status')).toBe('cmd.gaming-status')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('COMMAND_ICON (sites not yet on ids) is the live glyph, alternative applied', () => {
|
||||||
|
expect(COMMAND_ICON.done).toBe('🏆')
|
||||||
|
useIcons({ 'cmd.done': { glyph: '🏁' } })
|
||||||
|
expect(COMMAND_ICON.done).toBe('🏁')
|
||||||
|
expect(Object.keys(COMMAND_ICON)).toHaveLength(26)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -7,9 +7,7 @@
|
|||||||
import { api } from '../api/client'
|
import { api } from '../api/client'
|
||||||
import type { JobProgress as Progress, JobState } from '../api/jobContract'
|
import type { JobProgress as Progress, JobState } from '../api/jobContract'
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { commandIcon, commandLabel, findCommand } from '../commands/catalog'
|
import { COMMAND_ICON, commandLabel, findCommand } from '../commands/catalog'
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { Action } from '../lib/action'
|
import { Action } from '../lib/action'
|
||||||
import { define, h } from '../lib/dom'
|
import { define, h } from '../lib/dom'
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
@ -28,11 +26,11 @@ export function eta(p: Progress, live: LiveJob, now: number): number | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DONE: ReadonlySet<JobState> = new Set(['succeeded', 'failed', 'cancelled'])
|
const DONE: ReadonlySet<JobState> = new Set(['succeeded', 'failed', 'cancelled'])
|
||||||
const DONE_LABEL = {
|
const DONE_LABEL: Record<'succeeded' | 'failed' | 'cancelled', string> = {
|
||||||
succeeded: 'job.state.succeeded',
|
succeeded: '✅',
|
||||||
failed: 'job.state.failed',
|
failed: '⛔',
|
||||||
cancelled: 'job.state.cancelled',
|
cancelled: '🚫',
|
||||||
} as const satisfies Record<'succeeded' | 'failed' | 'cancelled', IconId>
|
}
|
||||||
const isDone = (s: JobState): s is keyof typeof DONE_LABEL => DONE.has(s)
|
const isDone = (s: JobState): s is keyof typeof DONE_LABEL => DONE.has(s)
|
||||||
|
|
||||||
export class JobProgressElement extends LiveElement {
|
export class JobProgressElement extends LiveElement {
|
||||||
@ -132,8 +130,8 @@ export class JobProgressElement extends LiveElement {
|
|||||||
f.section.className = compact ? 'job job-compact' : 'job'
|
f.section.className = compact ? 'job job-compact' : 'job'
|
||||||
f.section.dataset.state = state
|
f.section.dataset.state = state
|
||||||
f.section.setAttribute('aria-label', `Job ${job ? commandLabel(job.command) : id}`)
|
f.section.setAttribute('aria-label', `Job ${job ? commandLabel(job.command) : id}`)
|
||||||
// Textgate: the command's glyph (and its word) painted, its name spoken.
|
// Textgate: the command's glyph painted, its name spoken.
|
||||||
f.title.replaceChildren(...(job ? [glyph(commandIcon(job.command), title)] : []))
|
f.title.replaceChildren(...(job ? [glyph(COMMAND_ICON[job.command], title)] : []))
|
||||||
f.badge.replaceChildren(stateBadge(state))
|
f.badge.replaceChildren(stateBadge(state))
|
||||||
f.meta.replaceChildren(
|
f.meta.replaceChildren(
|
||||||
job ? duration(job.started_at, job.ended_at, now) : '',
|
job ? duration(job.started_at, job.ended_at, now) : '',
|
||||||
@ -150,7 +148,7 @@ export class JobProgressElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'span',
|
'span',
|
||||||
{ class: 'job-label' },
|
{ class: 'job-label' },
|
||||||
isDone(state) ? iconInline(DONE_LABEL[state]) : waiting ? iconInline('jobs.waiting') : progress ? iconInline('job.state.running') : '',
|
isDone(state) ? DONE_LABEL[state] : waiting ? '⏳' : progress ? '▶️' : '',
|
||||||
progress?.label && !finished ? h('span', { class: 'sr-only' }, progress.label) : null,
|
progress?.label && !finished ? h('span', { class: 'sr-only' }, progress.label) : null,
|
||||||
),
|
),
|
||||||
!finished && progress && progress.total !== null
|
!finished && progress && progress.total !== null
|
||||||
@ -190,7 +188,7 @@ export class JobProgressElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'button',
|
'button',
|
||||||
{ type: 'button', class: 'btn btn-ghost', disabled: this.cancel.pending, onclick: () => void this.cancel.run(), 'aria-label': this.cancel.pending ? 'Cancelling…' : 'Cancel job' },
|
{ type: 'button', class: 'btn btn-ghost', disabled: this.cancel.pending, onclick: () => void this.cancel.run(), 'aria-label': this.cancel.pending ? 'Cancelling…' : 'Cancel job' },
|
||||||
iconInline(this.cancel.pending ? 'state.wait' : 'jobs.cancel'),
|
this.cancel.pending ? '⏳' : '✕',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@ -211,7 +209,7 @@ export class JobProgressElement extends LiveElement {
|
|||||||
private updateLog(f: NonNullable<JobProgressElement['frame']>, live: LiveJob, finished: boolean, compact: boolean): void {
|
private updateLog(f: NonNullable<JobProgressElement['frame']>, live: LiveJob, finished: boolean, compact: boolean): void {
|
||||||
const logs = live.logs
|
const logs = live.logs
|
||||||
f.summary.replaceChildren(
|
f.summary.replaceChildren(
|
||||||
iconInline('jobs.log', 'log-count-icon'),
|
h('span', { class: 'log-count-icon', 'aria-hidden': 'true' }, '📋'),
|
||||||
h('span', { class: 'log-count', 'aria-hidden': 'true' }, String(logs.length)),
|
h('span', { class: 'log-count', 'aria-hidden': 'true' }, String(logs.length)),
|
||||||
)
|
)
|
||||||
f.summary.setAttribute('aria-label', `${logs.length} lines`)
|
f.summary.setAttribute('aria-label', `${logs.length} lines`)
|
||||||
|
|||||||
@ -1,89 +0,0 @@
|
|||||||
// Pass 2 wiring for the jobs page, the job view, the prompt form and the
|
|
||||||
// top-bar job chip: ledger words right of the icons, chosen glyphs applied,
|
|
||||||
// accessible names unchanged.
|
|
||||||
|
|
||||||
import { screen } from '@testing-library/dom'
|
|
||||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
||||||
import type { PromptEvent } from './hub'
|
|
||||||
import { promptForm } from './promptForm'
|
|
||||||
import { jobChip } from '../shell/jobIndicator'
|
|
||||||
import '../sections/jobs'
|
|
||||||
import { makeJob, makeSpec } from '../test/fixtures'
|
|
||||||
import { installEventSource, mount, stubApi } from '../test/harness'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { mountJob } from '../test/jobHelpers'
|
|
||||||
|
|
||||||
beforeEach(installEventSource)
|
|
||||||
|
|
||||||
const word = (el: Element | null | undefined) => el?.nextElementSibling?.textContent
|
|
||||||
const prompt = (over: Partial<PromptEvent>): PromptEvent => ({
|
|
||||||
seq: 1, ts: 't', type: 'prompt', prompt_id: 'q1', kind: 'confirm', message: 'Sure?', ...over,
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('job view icons', () => {
|
|
||||||
it('the title shows the command word and chosen glyph (cmd id), the name stays spoken', async () => {
|
|
||||||
useIcons({ 'cmd.scan': { word: 'survey', glyph: '🛰️' } })
|
|
||||||
const { el } = mountJob({ job: { state: 'running' } })
|
|
||||||
await vi.waitFor(() => { expect(el.querySelector('h3 .sr-only')).toHaveTextContent('Scan') })
|
|
||||||
const icon = el.querySelector('h3 [data-icon="cmd.scan"]')
|
|
||||||
expect(icon?.textContent).toBe('🛰️')
|
|
||||||
expect(word(icon)).toBe('Survey')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the phase mark, the log count and the cancel button use their ids', async () => {
|
|
||||||
useIcons({ 'job.state.running': { word: 'busy' }, 'jobs.log': { word: 'log' }, 'jobs.cancel': { word: 'stop' } })
|
|
||||||
const { el, send } = mountJob({ job: { state: 'running' }, cancellable: true })
|
|
||||||
send('progress', { step: 1, total: 3, label: 'Working' })
|
|
||||||
await vi.waitFor(() => { expect(el.querySelector('.job-label [data-icon="job.state.running"]')).not.toBeNull() })
|
|
||||||
expect(word(el.querySelector('.job-label [data-icon="job.state.running"]'))).toBe('Busy')
|
|
||||||
expect(word(el.querySelector('summary [data-icon="jobs.log"]'))).toBe('Log')
|
|
||||||
await vi.waitFor(() => { expect(screen.getByRole('button', { name: 'Cancel job' })).toBeInTheDocument() })
|
|
||||||
expect(word(screen.getByRole('button', { name: 'Cancel job' }).querySelector('[data-icon="jobs.cancel"]'))).toBe('Stop')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('jobs page icons', () => {
|
|
||||||
it('the history headers paint their words, the column names stay spoken', async () => {
|
|
||||||
history.replaceState({}, '', '/jobs/')
|
|
||||||
useIcons({ 'jobs.took': { word: 'duration', glyph: '⌛' } })
|
|
||||||
stubApi({ 'GET /api/jobs': [makeJob({ id: 'a' })], 'GET /api/commands': [makeSpec('scan')] })
|
|
||||||
mount('<jobs-page></jobs-page>')
|
|
||||||
const took = (await screen.findByText('Took', { selector: 'th .sr-only' })).closest('th')
|
|
||||||
expect(took?.querySelector('[data-icon="jobs.took"]')?.textContent).toBe('⌛')
|
|
||||||
expect(word(took?.querySelector('[data-icon="jobs.took"]'))).toBe('Duration')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('prompt form icons', () => {
|
|
||||||
it('Yes and No buttons keep their aria-labels and paint their words', () => {
|
|
||||||
useIcons({ 'prompt.yes': { word: 'agree' }, 'prompt.no': { word: 'refuse', glyph: '👎' } })
|
|
||||||
const form = promptForm('j', prompt({}))
|
|
||||||
document.body.append(form)
|
|
||||||
const yes = screen.getByRole('button', { name: 'Yes' })
|
|
||||||
expect(word(yes.querySelector('[data-icon="prompt.yes"]'))).toBe('Agree')
|
|
||||||
const no = screen.getByRole('button', { name: 'No' })
|
|
||||||
expect(no.querySelector('[data-icon="prompt.no"]')?.textContent).toBe('👎')
|
|
||||||
expect(word(no.querySelector('[data-icon="prompt.no"]'))).toBe('Refuse')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the question mark and the answer button follow the ledger', () => {
|
|
||||||
useIcons({ 'prompt.question': { word: 'ask' }, 'prompt.answer': { word: 'send', glyph: '📤' } })
|
|
||||||
const form = promptForm('j', prompt({ kind: 'text' }))
|
|
||||||
document.body.append(form)
|
|
||||||
expect(word(form.querySelector('[data-icon="prompt.question"]'))).toBe('Ask')
|
|
||||||
const answer = screen.getByRole('button', { name: 'Answer' })
|
|
||||||
expect(answer.querySelector('[data-icon="prompt.answer"]')?.textContent).toBe('📤')
|
|
||||||
expect(word(answer.querySelector('[data-icon="prompt.answer"]'))).toBe('Send')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('job chip icon', () => {
|
|
||||||
it('the needs-input mark paints its word, the aria-label keeps the sentence', () => {
|
|
||||||
useIcons({ 'jobchip.needs-input': { word: 'answer', glyph: '🙋' } })
|
|
||||||
const chip = jobChip(makeJob({ id: 'chip-wait', command: 'scan', state: 'waiting_input' }))
|
|
||||||
const mark = chip.querySelector('[data-icon="jobchip.needs-input"]')
|
|
||||||
expect(mark?.textContent).toBe('🙋')
|
|
||||||
expect(word(mark)).toBe('Answer')
|
|
||||||
expect(chip).toHaveAttribute('aria-label', 'Scan: needs your input')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -8,17 +8,15 @@ import { q } from '../api/queries'
|
|||||||
import { phraseMatches } from '../commands/catalog'
|
import { phraseMatches } from '../commands/catalog'
|
||||||
import { PhraseField } from '../commands/phraseField'
|
import { PhraseField } from '../commands/phraseField'
|
||||||
import { Action } from '../lib/action'
|
import { Action } from '../lib/action'
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { h, hx } from '../lib/dom'
|
import { h, hx } from '../lib/dom'
|
||||||
import type { GameBrowserElement } from '../library/pick'
|
import type { GameBrowserElement } from '../library/pick'
|
||||||
import { errorNotice, glyph } from '../ui/build'
|
import { errorNotice, glyph } from '../ui/build'
|
||||||
import { hub, type PromptEvent } from './hub'
|
import { hub, type PromptEvent } from './hub'
|
||||||
|
|
||||||
/** A glyph-only button: `icon` painted, `spoken` its accessible name. */
|
/** A glyph-only button: `icon` painted, `spoken` its accessible name. */
|
||||||
function sendButton(btn: HTMLButtonElement, spoken: string, icon: IconId): void {
|
function sendButton(btn: HTMLButtonElement, spoken: string, icon: string): void {
|
||||||
btn.setAttribute('aria-label', spoken)
|
btn.setAttribute('aria-label', spoken)
|
||||||
btn.replaceChildren(iconInline(icon))
|
btn.textContent = icon
|
||||||
}
|
}
|
||||||
|
|
||||||
function answerAction(jobId: string, prompt: PromptEvent, onChange: () => void): Action<[string], void> {
|
function answerAction(jobId: string, prompt: PromptEvent, onChange: () => void): Action<[string], void> {
|
||||||
@ -42,8 +40,8 @@ function answerForm(jobId: string, prompt: PromptEvent): HTMLFormElement {
|
|||||||
const submit = (v: string = value) => {
|
const submit = (v: string = value) => {
|
||||||
void send.run(v)
|
void send.run(v)
|
||||||
}
|
}
|
||||||
// Textgate: the server's question is spoken; the question icon marks that the job waits on you.
|
// Textgate: the server's question is spoken; ❓ marks that the job waits on you.
|
||||||
const form = h('form', { class: 'prompt', 'aria-label': 'Job question' }, h('p', { class: 'prompt-msg' }, glyph('prompt.question', prompt.message)))
|
const form = h('form', { class: 'prompt', 'aria-label': 'Job question' }, h('p', { class: 'prompt-msg' }, glyph('❓', prompt.message)))
|
||||||
form.addEventListener('submit', (e) => {
|
form.addEventListener('submit', (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (ready()) submit()
|
if (ready()) submit()
|
||||||
@ -67,7 +65,7 @@ function answerForm(jobId: string, prompt: PromptEvent): HTMLFormElement {
|
|||||||
{ class: 'choice' },
|
{ class: 'choice' },
|
||||||
radio,
|
radio,
|
||||||
// Option labels are game names (content); the "own game" escape is a glyph.
|
// Option labels are game names (content); the "own game" escape is a glyph.
|
||||||
o.value === 'own' ? glyph('prompt.own-game', o.label, 'choice-label') : h('span', { class: 'choice-label' }, o.label),
|
o.value === 'own' ? glyph('🗂️', o.label, 'choice-label') : h('span', { class: 'choice-label' }, o.label),
|
||||||
o.detail ? h('span', { class: 'choice-detail sr-only' }, o.detail) : null,
|
o.detail ? h('span', { class: 'choice-detail sr-only' }, o.detail) : null,
|
||||||
)
|
)
|
||||||
label.dataset.value = o.value
|
label.dataset.value = o.value
|
||||||
@ -105,14 +103,14 @@ function answerForm(jobId: string, prompt: PromptEvent): HTMLFormElement {
|
|||||||
errorSlot.replaceChildren(...(send.error ? [errorNotice(send.error)] : []))
|
errorSlot.replaceChildren(...(send.error ? [errorNotice(send.error)] : []))
|
||||||
if (prompt.kind === 'confirm') {
|
if (prompt.kind === 'confirm') {
|
||||||
actions.replaceChildren(
|
actions.replaceChildren(
|
||||||
h('button', { type: 'button', class: 'btn btn-primary', 'aria-label': 'Yes', autofocus: prompt.default !== 'no', disabled: send.pending, onclick: () => { submit('yes') } }, iconInline('prompt.yes')),
|
h('button', { type: 'button', class: 'btn btn-primary', 'aria-label': 'Yes', autofocus: prompt.default !== 'no', disabled: send.pending, onclick: () => { submit('yes') } }, '✔️'),
|
||||||
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'No', autofocus: prompt.default === 'no', disabled: send.pending, onclick: () => { submit('no') } }, iconInline('prompt.no')),
|
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'No', autofocus: prompt.default === 'no', disabled: send.pending, onclick: () => { submit('no') } }, '✖️'),
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const btn = actions.querySelector('button') ?? actions.appendChild(h('button', { type: 'submit', class: 'btn btn-primary' }))
|
const btn = actions.querySelector('button') ?? actions.appendChild(h('button', { type: 'submit', class: 'btn btn-primary' }))
|
||||||
btn.disabled = !ready() || send.pending
|
btn.disabled = !ready() || send.pending
|
||||||
sendButton(btn, send.pending ? 'Sending…' : 'Answer', send.pending ? 'state.wait' : 'prompt.answer')
|
sendButton(btn, send.pending ? 'Sending…' : 'Answer', send.pending ? '⏳' : '↵')
|
||||||
}
|
}
|
||||||
refresh()
|
refresh()
|
||||||
return form
|
return form
|
||||||
@ -137,7 +135,7 @@ function gamePrompt(jobId: string, prompt: PromptEvent): HTMLFormElement {
|
|||||||
}
|
}
|
||||||
browser.pick = { appIds, selected, onSelect: pick }
|
browser.pick = { appIds, selected, onSelect: pick }
|
||||||
const pickBtn = h('button', { type: 'submit', class: 'btn btn-primary' })
|
const pickBtn = h('button', { type: 'submit', class: 'btn btn-primary' })
|
||||||
const backBtn = h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Back to the list', onclick: () => void send.run('') }, iconInline('prompt.back'))
|
const backBtn = h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Back to the list', onclick: () => void send.run('') }, '↩️')
|
||||||
const errorSlot = h('div', { class: 'contents' })
|
const errorSlot = h('div', { class: 'contents' })
|
||||||
const form = h(
|
const form = h(
|
||||||
'form',
|
'form',
|
||||||
@ -145,9 +143,9 @@ function gamePrompt(jobId: string, prompt: PromptEvent): HTMLFormElement {
|
|||||||
h(
|
h(
|
||||||
'p',
|
'p',
|
||||||
{ class: 'prompt-msg' },
|
{ class: 'prompt-msg' },
|
||||||
glyph('prompt.question', prompt.message),
|
glyph('❓', prompt.message),
|
||||||
' ',
|
' ',
|
||||||
h('span', { class: 'muted' }, h('span', { 'aria-hidden': 'true' }, '· ', iconInline('prompt.games'), ` ${appIds.size}`), h('span', { class: 'sr-only' }, `· ${appIds.size} games can be picked`)),
|
h('span', { class: 'muted' }, h('span', { 'aria-hidden': 'true' }, `· 🎮 ${appIds.size}`), h('span', { class: 'sr-only' }, `· ${appIds.size} games can be picked`)),
|
||||||
),
|
),
|
||||||
browser,
|
browser,
|
||||||
errorSlot,
|
errorSlot,
|
||||||
@ -161,12 +159,12 @@ function gamePrompt(jobId: string, prompt: PromptEvent): HTMLFormElement {
|
|||||||
function refresh(): void {
|
function refresh(): void {
|
||||||
const name = q.library.state.data?.games.find((g) => g.app_id === selected)?.name ?? String(selected)
|
const name = q.library.state.data?.games.find((g) => g.app_id === selected)?.name ?? String(selected)
|
||||||
pickBtn.disabled = selected === null || send.pending
|
pickBtn.disabled = selected === null || send.pending
|
||||||
// The pick icon + the chosen game's name (content) painted; the verb is spoken.
|
// 🎯 + the chosen game's name (content) painted; the verb is spoken.
|
||||||
if (send.pending) sendButton(pickBtn, 'Sending…', 'state.wait')
|
if (send.pending) sendButton(pickBtn, 'Sending…', '⏳')
|
||||||
else if (selected === null) sendButton(pickBtn, 'Select a game', 'prompt.pick')
|
else if (selected === null) sendButton(pickBtn, 'Select a game', '🎯')
|
||||||
else {
|
else {
|
||||||
pickBtn.setAttribute('aria-label', `Pick ${name}`)
|
pickBtn.setAttribute('aria-label', `Pick ${name}`)
|
||||||
pickBtn.replaceChildren(h('span', { 'aria-hidden': 'true' }, iconInline('prompt.pick'), ` ${name}`))
|
pickBtn.replaceChildren(h('span', { 'aria-hidden': 'true' }, `🎯 ${name}`))
|
||||||
}
|
}
|
||||||
backBtn.disabled = send.pending
|
backBtn.disabled = send.pending
|
||||||
errorSlot.replaceChildren(...(send.error ? [errorNotice(send.error)] : []))
|
errorSlot.replaceChildren(...(send.error ? [errorNotice(send.error)] : []))
|
||||||
|
|||||||
@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
import type { EstimateResult } from '../../estimate'
|
import type { EstimateResult } from '../../estimate'
|
||||||
import { isoDate } from '../../format'
|
import { isoDate } from '../../format'
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import type { Filters, WebStateInfo } from '../../types'
|
import type { Filters, WebStateInfo } from '../../types'
|
||||||
import { h } from '../dom'
|
|
||||||
|
|
||||||
const W = 820
|
const W = 820
|
||||||
const H = 320
|
const H = 320
|
||||||
@ -85,14 +83,10 @@ export function timelineChart(
|
|||||||
const box = document.createElement('div')
|
const box = document.createElement('div')
|
||||||
box.className = 'chart'
|
box.className = 'chart'
|
||||||
if (pts.length < 2) {
|
if (pts.length < 2) {
|
||||||
box.append(
|
const hint = document.createElement('p')
|
||||||
h(
|
hint.className = 'hint empty-state'
|
||||||
'p',
|
hint.innerHTML = '<span class="empty-icon" aria-hidden="true">📭</span><span class="sr-only">Not enough games in scope to draw a timeline.</span>'
|
||||||
{ class: 'hint empty-state' },
|
box.append(hint)
|
||||||
iconInline('state.empty', 'empty-icon'),
|
|
||||||
h('span', { class: 'sr-only' }, 'Not enough games in scope to draw a timeline.'),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
return box
|
return box
|
||||||
}
|
}
|
||||||
box.append(timelineSvg(pts, now))
|
box.append(timelineSvg(pts, now))
|
||||||
|
|||||||
@ -2,15 +2,14 @@
|
|||||||
// `hash-state` (the Library page only) they live in the URL hash, so a
|
// `hash-state` (the Library page only) they live in the URL hash, so a
|
||||||
// reload restores them.
|
// reload restores them.
|
||||||
|
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { readHash } from './hashState'
|
import { readHash } from './hashState'
|
||||||
import { NO_FILTERS, SORTS, type Filters, type SortKey } from './view'
|
import { NO_FILTERS, SORTS, type Filters, type SortKey } from './view'
|
||||||
|
|
||||||
/** Filter key, spoken checkbox label, its token in the hash's `f=` list, painted icon. */
|
/** Filter key, spoken checkbox label, its token in the hash's `f=` list, painted glyph. */
|
||||||
export const FILTERS: [keyof Filters, string, string, IconId][] = [
|
export const FILTERS: [keyof Filters, string, string, string][] = [
|
||||||
['hideCompleted', 'Hide completed', 'completed', 'lib.hide-completed'],
|
['hideCompleted', 'Hide completed', 'completed', '🙈🏆'],
|
||||||
['installedOnly', 'Installed only', 'installed', 'dash.installed'],
|
['installedOnly', 'Installed only', 'installed', '💾'],
|
||||||
['pickableOnly', 'Pickable only', 'pickable', 'lib.pickable'],
|
['pickableOnly', 'Pickable only', 'pickable', '🎯'],
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface BrowserState {
|
export interface BrowserState {
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
// caret; the browser only writes values into it and hears every edit back.
|
// caret; the browser only writes values into it and hears every edit back.
|
||||||
|
|
||||||
import type { LibraryGame } from '../api/contract'
|
import type { LibraryGame } from '../api/contract'
|
||||||
import { iconText } from '../icons/iconText'
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { h } from '../lib/dom'
|
import { h } from '../lib/dom'
|
||||||
import { glyph } from '../ui/build'
|
import { glyph } from '../ui/build'
|
||||||
import { FILTERS, type BrowserState } from './browserState'
|
import { FILTERS, type BrowserState } from './browserState'
|
||||||
@ -33,8 +31,7 @@ export class BrowserToolbar {
|
|||||||
opts.onSort(this.sortSelect.value as SortKey)
|
opts.onSort(this.sortSelect.value as SortKey)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// An <option> holds text only: the icon, then the user's word right of it.
|
SORTS.map((s) => h('option', { value: s.key, 'aria-label': s.label }, s.icon)),
|
||||||
SORTS.map((s) => h('option', { value: s.key, 'aria-label': s.label }, iconText(s.icon))),
|
|
||||||
)
|
)
|
||||||
this.checks = new Map(
|
this.checks = new Map(
|
||||||
FILTERS.map(([key]) => [
|
FILTERS.map(([key]) => [
|
||||||
@ -51,7 +48,7 @@ export class BrowserToolbar {
|
|||||||
'div',
|
'div',
|
||||||
{ class: 'lib-toolbar' },
|
{ class: 'lib-toolbar' },
|
||||||
this.searchBox.el,
|
this.searchBox.el,
|
||||||
h('label', { class: 'lib-sort' }, glyph('lib.sort', 'Sort', 'field-label'), this.sortSelect),
|
h('label', { class: 'lib-sort' }, glyph('↕️', 'Sort', 'field-label'), this.sortSelect),
|
||||||
h(
|
h(
|
||||||
'fieldset',
|
'fieldset',
|
||||||
{ class: 'lib-filters' },
|
{ class: 'lib-filters' },
|
||||||
@ -82,13 +79,7 @@ export class BrowserToolbar {
|
|||||||
setCount(shown: number, total: number, byRelevance: boolean): void {
|
setCount(shown: number, total: number, byRelevance: boolean): void {
|
||||||
const spoken = `${shown} of ${total} games${byRelevance ? ' · by relevance' : ''}`
|
const spoken = `${shown} of ${total} games${byRelevance ? ' · by relevance' : ''}`
|
||||||
this.count.replaceChildren(
|
this.count.replaceChildren(
|
||||||
h(
|
h('span', { 'aria-hidden': 'true' }, `🎮 ${shown}/${total}${byRelevance ? ' 🔍' : ''}`),
|
||||||
'span',
|
|
||||||
{ 'aria-hidden': 'true' },
|
|
||||||
iconInline('lib.count'),
|
|
||||||
` ${shown}/${total}`,
|
|
||||||
byRelevance ? [' ', iconInline('lib.relevance')] : null,
|
|
||||||
),
|
|
||||||
h('span', { class: 'sr-only' }, spoken),
|
h('span', { class: 'sr-only' }, spoken),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,8 +42,8 @@ export function gameCard(game: LibraryGame): HTMLButtonElement {
|
|||||||
? h(
|
? h(
|
||||||
'span',
|
'span',
|
||||||
{ class: 'game-badges' },
|
{ class: 'game-badges' },
|
||||||
game.assigned ? pill('accent', 'assigned', 'assigned.game') : null,
|
game.assigned ? pill('accent', 'assigned', '🎯') : null,
|
||||||
game.installed ? pill('neutral', 'installed', 'dash.installed') : null,
|
game.installed ? pill('neutral', 'installed', '💾') : null,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,55 +0,0 @@
|
|||||||
// Pass-2 icon wiring for the library browser: sort options and placeholders
|
|
||||||
// show the glyph plus the user's word as text, badges and counts draw the
|
|
||||||
// word right of the icon, spoken labels stay.
|
|
||||||
|
|
||||||
import { describe, expect, it, vi } from 'vitest'
|
|
||||||
import { makeLibGame } from '../test/fixtures'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { painted } from '../test/painted'
|
|
||||||
import { BrowserToolbar } from './browserToolbar'
|
|
||||||
import { gameCard } from './gameCard'
|
|
||||||
|
|
||||||
function toolbar(): BrowserToolbar {
|
|
||||||
const bar = new BrowserToolbar({ onInput: vi.fn(), onChoose: vi.fn(), reason: () => null, onSort: vi.fn(), onFilter: vi.fn() })
|
|
||||||
document.body.append(bar.el)
|
|
||||||
return bar
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('library toolbar by id', () => {
|
|
||||||
it('writes the glyph and word into the search placeholder and the sort options', () => {
|
|
||||||
useIcons({ 'lib.search': { word: 'find', glyph: '🔎' }, 'lib.hltb': { word: 'length' } })
|
|
||||||
const bar = toolbar()
|
|
||||||
expect(bar.el.querySelector('input[type=search]')).toHaveAttribute('placeholder', '🔎 Find')
|
|
||||||
const options = [...bar.el.querySelectorAll('option')]
|
|
||||||
expect(options.map((o) => o.textContent)).toEqual(['🔤', '🕐', '🏆', '⏱️ Length'])
|
|
||||||
expect(options[3]).toHaveAttribute('aria-label', 'Shortest (HLTB)')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('draws the sort label, the filters and the count with words, aria unchanged', () => {
|
|
||||||
useIcons({
|
|
||||||
'lib.sort': { word: 'order' },
|
|
||||||
'dash.installed': { word: 'local' },
|
|
||||||
'lib.count': { word: 'games' },
|
|
||||||
'lib.relevance': { glyph: '📊' },
|
|
||||||
})
|
|
||||||
const bar = toolbar()
|
|
||||||
bar.setCount(3, 5, true)
|
|
||||||
expect(painted(bar.el.querySelector('.lib-sort'))).toContain('↕️Order')
|
|
||||||
expect(painted(bar.el.querySelector('.lib-filters label:nth-of-type(2)'))).toBe('💾Local')
|
|
||||||
expect(bar.el.querySelector('.lib-count [aria-hidden]')?.textContent).toBe('🎮Games 3/5 📊')
|
|
||||||
expect(bar.el.querySelector('.lib-count .sr-only')?.textContent).toBe('3 of 5 games · by relevance')
|
|
||||||
expect(bar.el.querySelector('.lib-filters .sr-only')?.textContent).toBe('Filters')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('game card badges by id', () => {
|
|
||||||
it('draws the assigned and installed badges with their words, spoken names unchanged', () => {
|
|
||||||
useIcons({ 'assigned.game': { word: 'target' }, 'dash.installed': { glyph: '📥' } })
|
|
||||||
const card = gameCard(makeLibGame({ assigned: true, installed: true }))
|
|
||||||
const [assigned, installed] = [...card.querySelectorAll('.game-badges .pill')]
|
|
||||||
expect(painted(assigned)).toBe('🎯Target')
|
|
||||||
expect(assigned.querySelector('.sr-only')?.textContent).toBe('assigned')
|
|
||||||
expect(painted(installed)).toBe('📥')
|
|
||||||
expect(installed.querySelector('.sr-only')?.textContent).toBe('installed')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -4,7 +4,6 @@
|
|||||||
// clears. The input is built once; only the list and ARIA state change.
|
// clears. The input is built once; only the list and ARIA state change.
|
||||||
|
|
||||||
import type { LibraryGame } from '../api/contract'
|
import type { LibraryGame } from '../api/contract'
|
||||||
import { iconText } from '../icons/iconText'
|
|
||||||
import { h } from '../lib/dom'
|
import { h } from '../lib/dom'
|
||||||
import { uid } from '../lib/ids'
|
import { uid } from '../lib/ids'
|
||||||
import { reasonOrMeta } from './view'
|
import { reasonOrMeta } from './view'
|
||||||
@ -37,7 +36,7 @@ export class SearchBox {
|
|||||||
'aria-expanded': 'false',
|
'aria-expanded': 'false',
|
||||||
'aria-controls': this.listId,
|
'aria-controls': this.listId,
|
||||||
'aria-autocomplete': 'list',
|
'aria-autocomplete': 'list',
|
||||||
placeholder: iconText('lib.search'),
|
placeholder: '🔍',
|
||||||
})
|
})
|
||||||
this.list = h('ul', { id: this.listId, role: 'listbox', class: 'lib-suggest', hidden: true, 'aria-label': 'Suggestions' })
|
this.list = h('ul', { id: this.listId, role: 'listbox', class: 'lib-suggest', hidden: true, 'aria-label': 'Suggestions' })
|
||||||
this.el = h('div', { class: 'lib-search' }, this.input, this.list)
|
this.el = h('div', { class: 'lib-search' }, this.input, this.list)
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { h, type Child } from '../lib/dom'
|
|
||||||
import { makeLibGame } from '../test/fixtures'
|
import { makeLibGame } from '../test/fixtures'
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { completion, filterGames, isCompleted, metaGlyphs, metaLine, NO_FILTERS, reasonGlyph, reasonOrMeta, sortGames } from './view'
|
import { completion, filterGames, isCompleted, metaGlyphs, metaLine, NO_FILTERS, reasonGlyph, reasonOrMeta, sortGames } from './view'
|
||||||
|
|
||||||
const g = makeLibGame
|
const g = makeLibGame
|
||||||
@ -71,23 +69,13 @@ describe('metaLine', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/** The text the painted nodes show. */
|
|
||||||
const text = (nodes: Child[]) => h('span', {}, ...nodes).textContent
|
|
||||||
|
|
||||||
describe('metaGlyphs', () => {
|
describe('metaGlyphs', () => {
|
||||||
it('paints trophy, clock and play with their values', () => {
|
it('paints trophy, clock and play with their values', () => {
|
||||||
expect(text(metaGlyphs(g({ achievements_total: 8, achievements_unlocked: 3, hltb_hours: 12, playtime_minutes: 192 }))))
|
expect(metaGlyphs(g({ achievements_total: 8, achievements_unlocked: 3, hltb_hours: 12, playtime_minutes: 192 })))
|
||||||
.toBe('🏆 37% · ⏱️ 12 h · ▶️ 3.2 h')
|
.toBe('🏆 37% · ⏱️ 12 h · ▶️ 3.2 h')
|
||||||
})
|
})
|
||||||
it('paints a dash for no achievements and drops unknown HLTB and zero playtime', () => {
|
it('paints a dash for no achievements and drops unknown HLTB and zero playtime', () => {
|
||||||
expect(text(metaGlyphs(g({ achievements_total: 0, hltb_hours: null, playtime_minutes: 0 })))).toBe('🏆 —')
|
expect(metaGlyphs(g({ achievements_total: 0, hltb_hours: null, playtime_minutes: 0 }))).toBe('🏆 —')
|
||||||
})
|
|
||||||
it('draws the user word right of each icon and his alternative glyph', () => {
|
|
||||||
useIcons({ 'lib.hltb': { word: 'length', glyph: '⌛' }, 'lib.completion': { word: 'percent' } })
|
|
||||||
const meta = h('span', {}, ...metaGlyphs(g({ achievements_total: 8, achievements_unlocked: 3, hltb_hours: 12, playtime_minutes: 0 })))
|
|
||||||
expect([...meta.querySelectorAll('.icon-word')].map((w) => w.textContent)).toEqual(['Percent', 'Length'])
|
|
||||||
expect(meta.querySelector('[data-icon="lib.hltb"]')?.textContent).toBe('⌛')
|
|
||||||
expect(meta.querySelector('[data-icon="lib.hltb"]')?.nextElementSibling).toHaveClass('icon-word')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -100,12 +88,7 @@ describe('reasonGlyph', () => {
|
|||||||
['Something else', '⛔'],
|
['Something else', '⛔'],
|
||||||
['Blocked until 2026-10-02', '⛔ 2026-10-02'],
|
['Blocked until 2026-10-02', '⛔ 2026-10-02'],
|
||||||
])('%s paints %s', (reason, painted) => {
|
])('%s paints %s', (reason, painted) => {
|
||||||
expect(text(reasonGlyph(reason))).toBe(painted)
|
expect(reasonGlyph(reason)).toBe(painted)
|
||||||
})
|
|
||||||
it('draws the user word beside the reason icon, the date after it', () => {
|
|
||||||
useIcons({ 'lib.why.skipped': { word: 'skipped' } })
|
|
||||||
const el = h('span', {}, ...reasonGlyph('Skipped until 2026-09-01'))
|
|
||||||
expect(el.textContent).toBe('⏭️Skipped 2026-09-01')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -114,7 +97,7 @@ describe('reasonOrMeta', () => {
|
|||||||
const game = g({ achievements_total: 8, achievements_unlocked: 3, hltb_hours: 12, playtime_minutes: 192 })
|
const game = g({ achievements_total: 8, achievements_unlocked: 3, hltb_hours: 12, playtime_minutes: 192 })
|
||||||
const el = reasonOrMeta(null, game, 'sub')
|
const el = reasonOrMeta(null, game, 'sub')
|
||||||
expect(el.className).toBe('sub')
|
expect(el.className).toBe('sub')
|
||||||
expect(el.querySelector('[aria-hidden="true"]')?.textContent).toBe(text(metaGlyphs(game)))
|
expect(el.querySelector('[aria-hidden="true"]')?.textContent).toBe(metaGlyphs(game))
|
||||||
expect(el.querySelector('.sr-only')?.textContent).toBe(metaLine(game))
|
expect(el.querySelector('.sr-only')?.textContent).toBe(metaLine(game))
|
||||||
})
|
})
|
||||||
it('paints the reason glyph and speaks the reason when not pickable', () => {
|
it('paints the reason glyph and speaks the reason when not pickable', () => {
|
||||||
|
|||||||
@ -2,18 +2,16 @@
|
|||||||
// the grid component only wires state to them.
|
// the grid component only wires state to them.
|
||||||
|
|
||||||
import type { LibraryGame } from '../api/contract'
|
import type { LibraryGame } from '../api/contract'
|
||||||
import type { IconId } from '../icons/registry'
|
import { h } from '../lib/dom'
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { h, type Child } from '../lib/dom'
|
|
||||||
|
|
||||||
export type SortKey = 'name' | 'recent' | 'completion' | 'hltb'
|
export type SortKey = 'name' | 'recent' | 'completion' | 'hltb'
|
||||||
|
|
||||||
/** `label` is spoken only; the sort select paints `icon`. */
|
/** `label` is spoken only; the sort select paints `icon`. */
|
||||||
export const SORTS: { key: SortKey; label: string; icon: IconId }[] = [
|
export const SORTS: { key: SortKey; label: string; icon: string }[] = [
|
||||||
{ key: 'name', label: 'Name', icon: 'lib.name' },
|
{ key: 'name', label: 'Name', icon: '🔤' },
|
||||||
{ key: 'recent', label: 'Recently played', icon: 'lib.recent' },
|
{ key: 'recent', label: 'Recently played', icon: '🕐' },
|
||||||
{ key: 'completion', label: 'Completion', icon: 'lib.completion' },
|
{ key: 'completion', label: 'Completion', icon: '🏆' },
|
||||||
{ key: 'hltb', label: 'Shortest (HLTB)', icon: 'lib.hltb' },
|
{ key: 'hltb', label: 'Shortest (HLTB)', icon: '⏱️' },
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface Filters {
|
export interface Filters {
|
||||||
@ -71,30 +69,30 @@ export function metaLine(g: LibraryGame): string {
|
|||||||
return parts.join(' · ')
|
return parts.join(' · ')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The painted meta line: "🏆 45% · ⏱️ 12 h · ▶️ 3.2 h" (🏆 — without achievements), icons by id. */
|
/** The painted meta line: "🏆 45% · ⏱️ 12 h · ▶️ 3.2 h" (🏆 — without achievements). */
|
||||||
export function metaGlyphs(g: LibraryGame): Child[] {
|
export function metaGlyphs(g: LibraryGame): string {
|
||||||
const pct = completion(g)
|
const pct = completion(g)
|
||||||
const parts: Child[][] = [[iconInline('lib.completion'), ` ${pct === null ? '—' : `${Math.floor(pct)}%`}`]]
|
const parts = [`🏆 ${pct === null ? '—' : `${Math.floor(pct)}%`}`]
|
||||||
if (g.hltb_hours !== null) parts.push([iconInline('lib.hltb'), ` ${hours(g.hltb_hours)}`])
|
if (g.hltb_hours !== null) parts.push(`⏱️ ${hours(g.hltb_hours)}`)
|
||||||
if (g.playtime_minutes > 0) parts.push([iconInline('lib.played'), ` ${hours(g.playtime_minutes / 60)}`])
|
if (g.playtime_minutes > 0) parts.push(`▶️ ${hours(g.playtime_minutes / 60)}`)
|
||||||
return parts.flatMap((part, i) => (i === 0 ? part : [' · ', ...part]))
|
return parts.join(' · ')
|
||||||
}
|
}
|
||||||
|
|
||||||
function hours(h: number): string {
|
function hours(h: number): string {
|
||||||
return h >= 10 ? `${Math.round(h)} h` : `${h.toFixed(1)} h`
|
return h >= 10 ? `${Math.round(h)} h` : `${h.toFixed(1)} h`
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Icon for a server ineligibility reason; a date in a skip or block stays painted. */
|
/** Glyph for a server ineligibility reason; a date in it stays painted. */
|
||||||
export function reasonGlyph(reason: string): Child[] {
|
export function reasonGlyph(reason: string): string {
|
||||||
const date = /\d{4}-\d{2}-\d{2}/.exec(reason)?.[0]
|
const date = /\d{4}-\d{2}-\d{2}/.exec(reason)?.[0]
|
||||||
if (reason.includes('100%')) return [iconInline('lib.why.complete')]
|
if (reason.includes('100%')) return '🏆✅'
|
||||||
if (/no achievements/i.test(reason)) return [iconInline('lib.why.noach')]
|
if (/no achievements/i.test(reason)) return '🏆🚫'
|
||||||
const id = /skip/i.test(reason) ? 'lib.why.skipped' : 'lib.why.blocked'
|
if (/skip/i.test(reason)) return date ? `⏭️ ${date}` : '⏭️'
|
||||||
return date ? [iconInline(id), ` ${date}`] : [iconInline(id)]
|
return date ? `⛔ ${date}` : '⛔'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Glyphs painted, words spoken: `text` shown as `painted` with an sr-only twin. */
|
/** Glyphs painted, words spoken: `text` shown as `painted` with an sr-only twin. */
|
||||||
export function spokenGlyphs(painted: Child, text: string, className: string): HTMLSpanElement {
|
export function spokenGlyphs(painted: string, text: string, className: string): HTMLSpanElement {
|
||||||
return h('span', { class: className }, h('span', { 'aria-hidden': 'true' }, painted), h('span', { class: 'sr-only' }, text))
|
return h('span', { class: className }, h('span', { 'aria-hidden': 'true' }, painted), h('span', { class: 'sr-only' }, text))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
---
|
---
|
||||||
// Any address with no page (the server serves this with a real 404).
|
// Any address with no page (the server serves this with a real 404).
|
||||||
import PageHead from '../components/PageHead.astro'
|
import PageHead from '../components/PageHead.astro'
|
||||||
import { iconEntry } from '../icons/registry'
|
|
||||||
import Shell from '../layouts/Shell.astro'
|
import Shell from '../layouts/Shell.astro'
|
||||||
---
|
---
|
||||||
|
|
||||||
<Shell title="Not found">
|
<Shell title="Not found">
|
||||||
<PageHead title="Not found" sub="There is no screen at this address." />
|
<PageHead title="Not found" sub="There is no screen at this address." />
|
||||||
{/* data-static-icons: boot decorates the icon with the user's word and glyph (icons/render.ts). */}
|
<div class="actions"><a href="/" class="btn btn-primary" aria-label="Back to the dashboard"><span aria-hidden="true">🏠</span></a></div>
|
||||||
<div class="actions" data-static-icons>
|
|
||||||
<a href="/" class="btn btn-primary" aria-label="Back to the dashboard"><span aria-hidden="true" data-icon="nav.dashboard">{iconEntry('nav.dashboard').glyph}</span></a>
|
|
||||||
</div>
|
|
||||||
</Shell>
|
</Shell>
|
||||||
|
|||||||
@ -1,34 +1,32 @@
|
|||||||
// The planner's estimate filters (was FilterPanel.tsx). Built once; `sync()`
|
// The planner's estimate filters (was FilterPanel.tsx). Built once; `sync()`
|
||||||
// writes values, active segments and conditional rows in place, so a slider
|
// writes values, active segments and conditional rows in place, so a slider
|
||||||
// being dragged or a date being typed never loses focus.
|
// being dragged or a date being typed never loses focus.
|
||||||
// Textgate: every label is an icon (registry ids, glyphs.ts) with its words
|
// Textgate: every label is a glyph (glyphs.ts) with its words spoken only;
|
||||||
// spoken only; slider values (numbers + units) stay painted.
|
// slider values (numbers + units) stay painted.
|
||||||
|
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import { h } from '../../lib/dom'
|
import { h } from '../../lib/dom'
|
||||||
import { SELECTABLE_TIERS } from '../../protondb'
|
import { SELECTABLE_TIERS } from '../../protondb'
|
||||||
import type { EstimateBasis, Filters, PlaytimeMode, ProtonMode, WebDefaults } from '../../types'
|
import type { EstimateBasis, Filters, PlaytimeMode, ProtonMode, WebDefaults } from '../../types'
|
||||||
import { glyph } from '../../ui/build'
|
import { glyph } from '../../ui/build'
|
||||||
import { BASIS_ICON, tierText } from './glyphs'
|
import { ANY_GLYPH, BASIS_GLYPH, TIER_GLYPH } from './glyphs'
|
||||||
|
|
||||||
type Update = (patch: Partial<Filters>) => void
|
type Update = (patch: Partial<Filters>) => void
|
||||||
interface Seg<T> { id: T; label: string; icon: IconId }
|
interface Seg<T> { id: T; label: string; icon: string }
|
||||||
|
|
||||||
const BASES: readonly Seg<EstimateBasis>[] = [
|
const BASES: readonly Seg<EstimateBasis>[] = [
|
||||||
{ id: 'rush', label: 'Rush', icon: BASIS_ICON.rush },
|
{ id: 'rush', label: 'Rush', icon: BASIS_GLYPH.rush },
|
||||||
{ id: 'leisure', label: 'Leisure', icon: BASIS_ICON.leisure },
|
{ id: 'leisure', label: 'Leisure', icon: BASIS_GLYPH.leisure },
|
||||||
{ id: 'worst', label: 'Worst', icon: BASIS_ICON.worst },
|
{ id: 'worst', label: 'Worst', icon: BASIS_GLYPH.worst },
|
||||||
{ id: 'pace', label: 'Pace', icon: BASIS_ICON.pace },
|
{ id: 'pace', label: 'Pace', icon: BASIS_GLYPH.pace },
|
||||||
]
|
]
|
||||||
const PROTON: readonly Seg<ProtonMode>[] = [
|
const PROTON: readonly Seg<ProtonMode>[] = [
|
||||||
{ id: 'playable', label: 'Playable (CLI rule)', icon: 'backlog.cli' },
|
{ id: 'playable', label: 'Playable (CLI rule)', icon: '⌨️' },
|
||||||
{ id: 'minTier', label: 'Min tier', icon: 'filter.min-tier' },
|
{ id: 'minTier', label: 'Min tier', icon: '🥇≥' },
|
||||||
]
|
]
|
||||||
const PLAYTIME: readonly Seg<PlaytimeMode>[] = [
|
const PLAYTIME: readonly Seg<PlaytimeMode>[] = [
|
||||||
{ id: 'all', label: 'All', icon: 'backlog.any' },
|
{ id: 'all', label: 'All', icon: ANY_GLYPH },
|
||||||
{ id: 'started', label: 'Started', icon: 'filter.started' },
|
{ id: 'started', label: 'Started', icon: '▶️' },
|
||||||
{ id: 'untouched', label: 'Untouched', icon: 'filter.untouched' },
|
{ id: 'untouched', label: 'Untouched', icon: '∅' },
|
||||||
]
|
]
|
||||||
|
|
||||||
type NumberKey = 'dailyHours' | 'minCountComp' | 'minComp100' | 'minConfidenceSum' | 'maxHoursPerGame' | 'fallbackHours'
|
type NumberKey = 'dailyHours' | 'minCountComp' | 'minComp100' | 'minConfidenceSum' | 'maxHoursPerGame' | 'fallbackHours'
|
||||||
@ -37,7 +35,7 @@ interface Slider {
|
|||||||
key: NumberKey
|
key: NumberKey
|
||||||
input: HTMLInputElement
|
input: HTMLInputElement
|
||||||
val: HTMLSpanElement
|
val: HTMLSpanElement
|
||||||
show: (f: Filters) => string | HTMLSpanElement
|
show: (f: Filters) => string
|
||||||
}
|
}
|
||||||
|
|
||||||
const hint = (text: string) => h('p', { class: 'hint sr-only' }, text)
|
const hint = (text: string) => h('p', { class: 'hint sr-only' }, text)
|
||||||
@ -47,7 +45,7 @@ export class FilterPanel {
|
|||||||
private readonly syncs: ((f: Filters) => void)[] = []
|
private readonly syncs: ((f: Filters) => void)[] = []
|
||||||
|
|
||||||
constructor(defaults: WebDefaults, update: Update, onReset: () => void) {
|
constructor(defaults: WebDefaults, update: Update, onReset: () => void) {
|
||||||
const slider = (key: NumberKey, icon: IconId, label: string, min: number, max: number, step: number, show: Slider['show']) => {
|
const slider = (key: NumberKey, icon: string, label: string, min: number, max: number, step: number, show: Slider['show']) => {
|
||||||
const val = h('span', { class: 'val' })
|
const val = h('span', { class: 'val' })
|
||||||
const input = h('input', { type: 'range', min, max, step, 'aria-label': label })
|
const input = h('input', { type: 'range', min, max, step, 'aria-label': label })
|
||||||
input.addEventListener('input', () => {
|
input.addEventListener('input', () => {
|
||||||
@ -57,13 +55,13 @@ export class FilterPanel {
|
|||||||
})
|
})
|
||||||
this.syncs.push((f) => {
|
this.syncs.push((f) => {
|
||||||
input.value = String(f[key])
|
input.value = String(f[key])
|
||||||
val.replaceChildren(show(f))
|
val.textContent = show(f)
|
||||||
})
|
})
|
||||||
return { label: h('label', {}, glyph(icon, label), ' ', val), input }
|
return { label: h('label', {}, glyph(icon, label), ' ', val), input }
|
||||||
}
|
}
|
||||||
const segmented = <T extends string>(items: readonly Seg<T>[], current: (f: Filters) => T, set: (id: T) => void) => {
|
const segmented = <T extends string>(items: readonly Seg<T>[], current: (f: Filters) => T, set: (id: T) => void) => {
|
||||||
const buttons = items.map((it) =>
|
const buttons = items.map((it) =>
|
||||||
h('button', { type: 'button', class: 'seg', 'aria-label': it.label, onclick: () => { set(it.id) } }, iconInline(it.icon)),
|
h('button', { type: 'button', class: 'seg', 'aria-label': it.label, onclick: () => { set(it.id) } }, it.icon),
|
||||||
)
|
)
|
||||||
this.syncs.push((f) => {
|
this.syncs.push((f) => {
|
||||||
buttons.forEach((b, i) => {
|
buttons.forEach((b, i) => {
|
||||||
@ -74,7 +72,7 @@ export class FilterPanel {
|
|||||||
})
|
})
|
||||||
return h('div', { class: 'segmented' }, buttons)
|
return h('div', { class: 'segmented' }, buttons)
|
||||||
}
|
}
|
||||||
const check = (icon: IconId, label: string, read: (f: Filters) => boolean, set: (on: boolean) => void) => {
|
const check = (icon: string, label: string, read: (f: Filters) => boolean, set: (on: boolean) => void) => {
|
||||||
const input = h('input', { type: 'checkbox' })
|
const input = h('input', { type: 'checkbox' })
|
||||||
input.addEventListener('change', () => {
|
input.addEventListener('change', () => {
|
||||||
set(input.checked)
|
set(input.checked)
|
||||||
@ -90,21 +88,21 @@ export class FilterPanel {
|
|||||||
})
|
})
|
||||||
return el
|
return el
|
||||||
}
|
}
|
||||||
const heading = (icon: IconId, label: string) => h('label', {}, glyph(icon, label))
|
const heading = (icon: string, label: string) => h('label', {}, glyph(icon, label))
|
||||||
|
|
||||||
const daily = slider('dailyHours', 'filter.daily', 'Daily play time', 0.5, 16, 0.5, (f) => `${f.dailyHours} h/day`)
|
const daily = slider('dailyHours', '⏰', 'Daily play time', 0.5, 16, 0.5, (f) => `${f.dailyHours} h/day`)
|
||||||
const minComp = slider('minCountComp', 'planner.completions', 'Min HLTB completions', 0, 100, 1, (f) => String(f.minCountComp))
|
const minComp = slider('minCountComp', '#', 'Min HLTB completions', 0, 100, 1, (f) => String(f.minCountComp))
|
||||||
const min100 = slider('minComp100', 'filter.min-polled', 'Min polled completionist times', 0, 50, 1, (f) => String(f.minComp100))
|
const min100 = slider('minComp100', '💯', 'Min polled completionist times', 0, 50, 1, (f) => String(f.minComp100))
|
||||||
const minConf = slider('minConfidenceSum', 'filter.min-confidence', 'Min confidence sum', 0, 150, 1, (f) => String(f.minConfidenceSum))
|
const minConf = slider('minConfidenceSum', 'Σ', 'Min confidence sum', 0, 150, 1, (f) => String(f.minConfidenceSum))
|
||||||
const maxH = slider('maxHoursPerGame', 'filter.max-time', 'Max time per game', 0, 200, 5, (f) =>
|
const maxH = slider('maxHoursPerGame', '⏳', 'Max time per game', 0, 200, 5, (f) =>
|
||||||
f.maxHoursPerGame > 0 ? `${f.maxHoursPerGame} h` : iconInline('filter.no-cap'),
|
f.maxHoursPerGame > 0 ? `${f.maxHoursPerGame} h` : '∞',
|
||||||
)
|
)
|
||||||
const fallback = slider('fallbackHours', 'filter.fallback', 'Fallback estimate', 1, 100, 1, (f) => `${f.fallbackHours} h`)
|
const fallback = slider('fallbackHours', '❓', 'Fallback estimate', 1, 100, 1, (f) => `${f.fallbackHours} h`)
|
||||||
|
|
||||||
const tier = h(
|
const tier = h(
|
||||||
'select',
|
'select',
|
||||||
{ 'aria-label': 'Minimum ProtonDB tier' },
|
{ 'aria-label': 'Minimum ProtonDB tier' },
|
||||||
SELECTABLE_TIERS.map((t) => h('option', { value: t, 'aria-label': t }, tierText(t))),
|
SELECTABLE_TIERS.map((t) => h('option', { value: t, 'aria-label': t }, TIER_GLYPH[t])),
|
||||||
)
|
)
|
||||||
tier.addEventListener('change', () => {
|
tier.addEventListener('change', () => {
|
||||||
update({ protonMinTier: tier.value })
|
update({ protonMinTier: tier.value })
|
||||||
@ -121,7 +119,7 @@ export class FilterPanel {
|
|||||||
date.value = f.targetDate
|
date.value = f.targetDate
|
||||||
})
|
})
|
||||||
const clear = shownWhen(
|
const clear = shownWhen(
|
||||||
h('button', { type: 'button', class: 'ghost', 'aria-label': 'Clear', onclick: () => { update({ targetDate: '' }) } }, iconInline('filter.clear-date')),
|
h('button', { type: 'button', class: 'ghost', 'aria-label': 'Clear', onclick: () => { update({ targetDate: '' }) } }, '✕'),
|
||||||
(f) => f.targetDate !== '',
|
(f) => f.targetDate !== '',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -131,16 +129,10 @@ export class FilterPanel {
|
|||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'panel-head' },
|
{ class: 'panel-head' },
|
||||||
h('h2', {}, glyph('backlog.filters', 'Filters')),
|
h('h2', {}, glyph('🎚️', 'Filters')),
|
||||||
h(
|
h('button', { type: 'button', class: 'ghost', 'aria-label': 'Reset to CLI defaults', onclick: () => { onReset() } }, '↺ ⌨️'),
|
||||||
'button',
|
|
||||||
{ type: 'button', class: 'ghost', 'aria-label': 'Reset to CLI defaults', onclick: () => { onReset() } },
|
|
||||||
iconInline('filter.reset'),
|
|
||||||
' ',
|
|
||||||
iconInline('backlog.cli'),
|
|
||||||
),
|
),
|
||||||
),
|
h('section', { class: 'field' }, heading('📐', 'Estimate basis'), segmented(BASES, (f) => f.basis, (basis) => { update({ basis }) })),
|
||||||
h('section', { class: 'field' }, heading('filter.basis', 'Estimate basis'), segmented(BASES, (f) => f.basis, (basis) => { update({ basis }) })),
|
|
||||||
h('section', { class: 'field' }, daily.label, daily.input),
|
h('section', { class: 'field' }, daily.label, daily.input),
|
||||||
h(
|
h(
|
||||||
'section',
|
'section',
|
||||||
@ -149,18 +141,18 @@ export class FilterPanel {
|
|||||||
minComp.input,
|
minComp.input,
|
||||||
hint(`Higher = more reliable HLTB times (CLI default ${defaults.min_count_comp}).`),
|
hint(`Higher = more reliable HLTB times (CLI default ${defaults.min_count_comp}).`),
|
||||||
),
|
),
|
||||||
h('details', { class: 'field' }, h('summary', {}, glyph('filter.advanced', 'Advanced confidence')), min100.label, min100.input, minConf.label, minConf.input),
|
h('details', { class: 'field' }, h('summary', {}, glyph('🔬', 'Advanced confidence')), min100.label, min100.input, minConf.label, minConf.input),
|
||||||
h(
|
h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'field' },
|
{ class: 'field' },
|
||||||
heading('planner.proton', 'ProtonDB compatibility'),
|
heading('🐧', 'ProtonDB compatibility'),
|
||||||
segmented(PROTON, (f) => f.protonMode, (protonMode) => { update({ protonMode }) }),
|
segmented(PROTON, (f) => f.protonMode, (protonMode) => { update({ protonMode }) }),
|
||||||
shownWhen(
|
shownWhen(
|
||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'subfield' },
|
{ class: 'subfield' },
|
||||||
tier,
|
tier,
|
||||||
check('filter.proton-missing', 'Keep games with no ProtonDB data', (f) => f.protonTreatMissingAsPass, (on) => {
|
check('❓', 'Keep games with no ProtonDB data', (f) => f.protonTreatMissingAsPass, (on) => {
|
||||||
update({ protonTreatMissingAsPass: on })
|
update({ protonTreatMissingAsPass: on })
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@ -171,13 +163,13 @@ export class FilterPanel {
|
|||||||
h(
|
h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'field' },
|
{ class: 'field' },
|
||||||
heading('planner.playtime', 'Playtime'),
|
heading('⏱', 'Playtime'),
|
||||||
segmented(PLAYTIME, (f) => f.playtimeMode, (playtimeMode) => { update({ playtimeMode }) }),
|
segmented(PLAYTIME, (f) => f.playtimeMode, (playtimeMode) => { update({ playtimeMode }) }),
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'field' },
|
{ class: 'field' },
|
||||||
check('planner.no-data', 'Include games with no HLTB data', (f) => f.includeNoData, (on) => {
|
check('❓', 'Include games with no HLTB data', (f) => f.includeNoData, (on) => {
|
||||||
update({ includeNoData: on })
|
update({ includeNoData: on })
|
||||||
}),
|
}),
|
||||||
shownWhen(h('div', { class: 'subfield' }, fallback.label, fallback.input), (f) => f.includeNoData),
|
shownWhen(h('div', { class: 'subfield' }, fallback.label, fallback.input), (f) => f.includeNoData),
|
||||||
@ -185,7 +177,7 @@ export class FilterPanel {
|
|||||||
h(
|
h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'field' },
|
{ class: 'field' },
|
||||||
heading('filter.target-date', 'Target finish date'),
|
heading('🏁', 'Target finish date'),
|
||||||
h('div', { class: 'subfield row' }, date, clear),
|
h('div', { class: 'subfield row' }, date, clear),
|
||||||
hint('Pick a date to see the hours/day required.'),
|
hint('Pick a date to see the hours/day required.'),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,69 +1,57 @@
|
|||||||
// Backlog pictograms by registry id (textgate: these are painted, the words
|
// Backlog pictograms (textgate: these are painted, the words are spoken only).
|
||||||
// are spoken only). One icon per idea across the stats card, the planner
|
// One glyph per idea across the stats card, the planner filters, the summary
|
||||||
// filters, the summary cards and the table headers, so an icon learned in one
|
// cards and the table headers, so a glyph learned in one place reads the same
|
||||||
// place reads the same everywhere, and the user's word follows it.
|
// everywhere.
|
||||||
|
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { iconText } from '../../icons/iconText'
|
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import type { EstimateBasis } from '../../types'
|
import type { EstimateBasis } from '../../types'
|
||||||
import { glyph } from '../../ui/build'
|
import { glyph } from '../../ui/build'
|
||||||
|
|
||||||
export const BASIS_ICON = {
|
export const BASIS_GLYPH: Record<EstimateBasis, string> = {
|
||||||
rush: 'basis.rush',
|
rush: '🐇',
|
||||||
leisure: 'basis.leisure',
|
leisure: '🐢',
|
||||||
worst: 'basis.worst',
|
worst: '🐌',
|
||||||
pace: 'basis.pace',
|
pace: '👤',
|
||||||
} as const satisfies Record<EstimateBasis, IconId>
|
|
||||||
|
|
||||||
/** Player style vs HLTB; the `--<style>` class adds the colour channel. */
|
|
||||||
const STYLE_ICON: Record<string, IconId> = {
|
|
||||||
faster_than_rush: 'style.fast',
|
|
||||||
rush_to_leisure: 'style.between',
|
|
||||||
slower_than_leisure: 'style.slow',
|
|
||||||
unknown: 'state.unknown',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const STYLE_SPOKEN: Record<string, string> = {
|
/** Player style vs HLTB; the `--<style>` class adds the colour channel. */
|
||||||
|
export const STYLE_GLYPH: Record<string, string> = {
|
||||||
|
faster_than_rush: '⚡',
|
||||||
|
rush_to_leisure: '🐇↔🐢',
|
||||||
|
slower_than_leisure: '🐌',
|
||||||
|
unknown: '❔',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const STYLE_SPOKEN: Record<string, string> = {
|
||||||
faster_than_rush: 'Faster than HLTB rush',
|
faster_than_rush: 'Faster than HLTB rush',
|
||||||
rush_to_leisure: 'Between rush and leisure',
|
rush_to_leisure: 'Between rush and leisure',
|
||||||
slower_than_leisure: 'Slower than HLTB leisure',
|
slower_than_leisure: 'Slower than HLTB leisure',
|
||||||
unknown: 'Not enough finished games yet',
|
unknown: 'Not enough finished games yet',
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A player style: its icon painted (the class adds colour), its sentence spoken. */
|
/** A player style: its glyph painted (the class adds colour), its sentence spoken. */
|
||||||
export const styleGlyph = (style: string) =>
|
export const styleGlyph = (style: string) =>
|
||||||
glyph(STYLE_ICON[style] ?? 'state.unknown', STYLE_SPOKEN[style] ?? style, `player-insight-style player-insight-style--${style}`)
|
glyph(STYLE_GLYPH[style] ?? '❔', STYLE_SPOKEN[style] ?? style, `player-insight-style player-insight-style--${style}`)
|
||||||
|
|
||||||
/** ProtonDB tiers, best to worst: medals, then a crash and an hourglass. */
|
/** ProtonDB tiers, best to worst: medals, then a crash and an hourglass. */
|
||||||
const TIER_ICON: Record<string, IconId> = {
|
export const TIER_GLYPH: Record<string, string> = {
|
||||||
native: 'tier.native',
|
native: '⭐',
|
||||||
platinum: 'tier.platinum',
|
platinum: '💎',
|
||||||
gold: 'tier.gold',
|
gold: '🥇',
|
||||||
silver: 'tier.silver',
|
silver: '🥈',
|
||||||
bronze: 'tier.bronze',
|
bronze: '🥉',
|
||||||
borked: 'tier.borked',
|
borked: '💥',
|
||||||
pending: 'tier.pending',
|
pending: '⏳',
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A tierLabel() string (`gold`, `gold / silver`, `—`) as icons; an unknown tier is the unknown mark. */
|
const tierGlyph = (tier: string) => TIER_GLYPH[tier] ?? '❔'
|
||||||
export function tierMarks(label: string): (HTMLSpanElement | string)[] {
|
|
||||||
if (!label || label === '—') return ['—']
|
|
||||||
return label
|
|
||||||
.split(' / ')
|
|
||||||
.flatMap((tier, i) => [...(i ? ['/'] : []), iconInline(TIER_ICON[tier] ?? 'state.unknown')])
|
|
||||||
}
|
|
||||||
|
|
||||||
/** `tierMarks` as plain text (glyph, then word) for an `<option>`, which cannot hold markup. */
|
/** A tierLabel() string (`gold`, `gold / silver`, `—`) as glyphs. */
|
||||||
export function tierText(label: string): string {
|
export function tierGlyphs(label: string): string {
|
||||||
if (!label || label === '—') return '—'
|
if (!label || label === '—') return '—'
|
||||||
return label
|
return label.split(' / ').map(tierGlyph).join('/')
|
||||||
.split(' / ')
|
|
||||||
.map((tier) => iconText(TIER_ICON[tier] ?? 'state.unknown'))
|
|
||||||
.join('/')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const KEEP_ICON: Record<string, IconId> = { kept: 'keep.kept', excluded: 'keep.excluded' }
|
export const KEEP_GLYPH: Record<string, string> = { kept: '📌', excluded: '🚫' }
|
||||||
|
|
||||||
/** The keep filter's value as plain option text. */
|
/** "Any value" in a filter select or segmented control. */
|
||||||
export const keepText = (value: string) => iconText(KEEP_ICON[value])
|
export const ANY_GLYPH = '✱'
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
// The backlog page's icons are registry ids: the user's word shows right of
|
|
||||||
// the icon, a chosen alternative glyph replaces it, spoken names stay.
|
|
||||||
|
|
||||||
import { screen } from '@testing-library/dom'
|
|
||||||
import { afterEach, describe, expect, it } from 'vitest'
|
|
||||||
import { applyFilters } from '../../estimate'
|
|
||||||
import { timelineChart } from '../../lib/charts/timeline'
|
|
||||||
import { makeDataset, makeFilters, makeGame, makePaceVsHltb, makeState } from '../../test/factories'
|
|
||||||
import { useIcons } from '../../test/iconLedger'
|
|
||||||
import { GAMES, header, panel, show, table } from '../../test/plannerHelpers'
|
|
||||||
import { painted } from '../../test/painted'
|
|
||||||
import { keepText, styleGlyph, tierMarks, tierText } from './glyphs'
|
|
||||||
import { summaryCards } from './summary'
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
history.replaceState(null, '', '/')
|
|
||||||
})
|
|
||||||
|
|
||||||
const wordAfter = (mark: Element | null) => mark?.nextElementSibling?.textContent
|
|
||||||
|
|
||||||
describe('backlog icons: filter panel', () => {
|
|
||||||
it('draws the basis word right of the icon and keeps the button name', async () => {
|
|
||||||
useIcons({ 'basis.rush': { word: 'sprint', glyph: '🚀' } })
|
|
||||||
await show()
|
|
||||||
const rush = panel().getByRole('button', { name: 'Rush' })
|
|
||||||
expect(rush.querySelector('[data-icon]')?.textContent).toBe('🚀')
|
|
||||||
expect(wordAfter(rush.querySelector('[data-icon]'))).toBe('Sprint')
|
|
||||||
expect(rush.querySelector('.icon-inline')).toHaveClass('has-word')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('reset button, no-cap value and clear-date mark follow the ledger', async () => {
|
|
||||||
useIcons({ 'filter.reset': { glyph: '🧹' }, 'filter.no-cap': { word: 'endless' }, 'backlog.cli': { word: 'default' } })
|
|
||||||
await show()
|
|
||||||
const reset = panel().getByRole('button', { name: 'Reset to CLI defaults' })
|
|
||||||
expect(painted(reset)).toBe('🧹 ⌨️Default')
|
|
||||||
expect(document.querySelector('.panel .val .icon-word')?.textContent).toBe('Endless')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('tier options and the keep check carry the tier icons and their words', async () => {
|
|
||||||
useIcons({ 'tier.gold': { word: 'great' }, 'filter.proton-missing': { word: 'unrated' } })
|
|
||||||
await show()
|
|
||||||
const gold = [...document.querySelectorAll('.panel select option')].find((o) => o.getAttribute('aria-label') === 'gold')
|
|
||||||
expect(gold?.textContent).toBe('🥇 Great')
|
|
||||||
expect(wordAfter(document.querySelector('.panel .check [data-icon="filter.proton-missing"]'))).toBe('Unrated')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('backlog icons: table', () => {
|
|
||||||
it('sort arrow and column icons use their ids', async () => {
|
|
||||||
useIcons({ 'backlog.sort-asc': { glyph: '🔼', word: 'up' }, 'basis.leisure': { word: 'slow' } })
|
|
||||||
await show()
|
|
||||||
const th = header('Leisure')
|
|
||||||
expect(th).toHaveAttribute('aria-label', 'Leisure')
|
|
||||||
expect(th.querySelector('[data-icon="backlog.sort-asc"]')?.textContent).toBe('🔼')
|
|
||||||
expect([...th.querySelectorAll('.icon-word')].map((w) => w.textContent)).toEqual(['Slow', 'Up'])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('tier cells, options and the no-data badge follow the ledger', async () => {
|
|
||||||
useIcons({ 'tier.platinum': { glyph: '💠' }, 'keep.kept': { word: 'pinned' }, 'planner.no-data': { word: 'blank' } })
|
|
||||||
history.replaceState(null, '', '/backlog/#nodata=1')
|
|
||||||
await show([...GAMES, makeGame({ app_id: 9, name: 'No Data', rush_hours: -1, leisure_hours: -1, worst_hours: -1 })])
|
|
||||||
expect(table().querySelector('td.proton [data-icon="tier.platinum"]')?.textContent).toBe('💠')
|
|
||||||
const keep = screen.getByRole('combobox', { name: 'Filter Keep' })
|
|
||||||
expect([...keep.querySelectorAll('option')].map((o) => o.textContent)).toContain('📌 Pinned')
|
|
||||||
expect(wordAfter(table().querySelector('.badge [data-icon="planner.no-data"]'))).toBe('Blank')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('number filter boxes keep their comparator placeholders', async () => {
|
|
||||||
await show()
|
|
||||||
expect(table().querySelector('input[aria-label$=" min"]')).toHaveAttribute('placeholder', '≥')
|
|
||||||
expect(table().querySelector('input[aria-label$=" max"]')).toHaveAttribute('placeholder', '≤')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('backlog icons: summary, glyph helpers and chart', () => {
|
|
||||||
it('the banner and parity row paint ledger words and alternatives, spoken text unchanged', () => {
|
|
||||||
useIcons({ 'filter.target-date': { word: 'deadline' }, 'summary.need': { glyph: '➡️' }, 'summary.match': { word: 'same' } })
|
|
||||||
const filters = makeFilters({ targetDate: '2026-01-11' })
|
|
||||||
const result = applyFilters(makeDataset([makeGame({ app_id: 1 })]), filters)
|
|
||||||
const el = summaryCards(
|
|
||||||
{ result, filters, state: makeState(), presets: [2], defaultQualifying: result.remainingGames, paceVsHltb: makePaceVsHltb() },
|
|
||||||
new Date('2026-01-01T00:00:00Z'),
|
|
||||||
)
|
|
||||||
document.body.append(el)
|
|
||||||
expect(painted(el.querySelector('.target-banner'))).toContain('🏁Deadline')
|
|
||||||
expect(painted(el.querySelector('.target-banner'))).toContain('➡️')
|
|
||||||
expect(wordAfter(el.querySelector('.parity [data-icon="summary.match"]'))).toBe('Same')
|
|
||||||
expect(el.querySelector('.target-banner')).toHaveTextContent('by')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('style, tier and keep helpers draw ids, and the empty chart draws the empty id', () => {
|
|
||||||
useIcons({ 'style.fast': { word: 'speedy' }, 'state.empty': { glyph: '📪' }, 'tier.bronze': { word: 'rough' } })
|
|
||||||
const style = styleGlyph('faster_than_rush')
|
|
||||||
expect(style.querySelector('.icon-word')?.textContent).toBe('Speedy')
|
|
||||||
expect(style).toHaveTextContent('Faster than HLTB rush')
|
|
||||||
expect(tierMarks('bronze').map((m) => (typeof m === 'string' ? m : m.textContent)).join('')).toBe('🥉Rough')
|
|
||||||
expect(keepText('kept')).toBe('📌')
|
|
||||||
expect(tierText('bronze / gold')).toBe('🥉 Rough/🥇')
|
|
||||||
const filters = makeFilters()
|
|
||||||
const box = timelineChart(applyFilters(makeDataset([]), filters), filters, makeState())
|
|
||||||
expect(box.querySelector('.empty-icon')?.textContent).toBe('📪')
|
|
||||||
expect(box).toHaveTextContent('Not enough games in scope to draw a timeline.')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -112,12 +112,12 @@ export class Planner {
|
|||||||
private syncSub(): void {
|
private syncSub(): void {
|
||||||
const s = this.data.state
|
const s = this.data.state
|
||||||
this.sub.replaceChildren(
|
this.sub.replaceChildren(
|
||||||
...(s.current_game_name ? [glyph('planner.playing', 'Currently playing '), ' ', h('strong', {}, s.current_game_name), ' · '] : []),
|
...(s.current_game_name ? [glyph('▶️', 'Currently playing '), ' ', h('strong', {}, s.current_game_name), ' · '] : []),
|
||||||
glyph('dash.finished', 'games finished'),
|
glyph('🏆', 'games finished'),
|
||||||
` ${s.games_done_since_start} · `,
|
` ${s.games_done_since_start} · `,
|
||||||
glyph('planner.since', 'since'),
|
glyph('📅', 'since'),
|
||||||
` ${s.enforcement_started_at.slice(0, 10) || '—'} · `,
|
` ${s.enforcement_started_at.slice(0, 10) || '—'} · `,
|
||||||
glyph('planner.candidates', 'candidates'),
|
glyph('🎮', 'candidates'),
|
||||||
` ${this.data.games.length}`,
|
` ${this.data.games.length}`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { screen, within } from '@testing-library/dom'
|
|||||||
import { afterEach, describe, expect, it } from 'vitest'
|
import { afterEach, describe, expect, it } from 'vitest'
|
||||||
import { makeGame } from '../../test/factories'
|
import { makeGame } from '../../test/factories'
|
||||||
import { GAMES, hash, header, names, show, table } from '../../test/plannerHelpers'
|
import { GAMES, hash, header, names, show, table } from '../../test/plannerHelpers'
|
||||||
|
import { ANY_GLYPH } from './glyphs'
|
||||||
import { hltbUrl } from './plannerTable'
|
import { hltbUrl } from './plannerTable'
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -119,7 +120,7 @@ describe('<game-table> table', () => {
|
|||||||
await show()
|
await show()
|
||||||
const options = [...screen.getByRole('combobox', { name: 'Filter Keep' }).querySelectorAll('option')]
|
const options = [...screen.getByRole('combobox', { name: 'Filter Keep' }).querySelectorAll('option')]
|
||||||
expect(options.map((o) => [o.value, o.textContent, o.getAttribute('aria-label')])).toEqual([
|
expect(options.map((o) => [o.value, o.textContent, o.getAttribute('aria-label')])).toEqual([
|
||||||
['', '✱', 'All'],
|
['', ANY_GLYPH, 'All'],
|
||||||
['kept', '📌', 'kept'],
|
['kept', '📌', 'kept'],
|
||||||
['excluded', '🚫', 'excluded'],
|
['excluded', '🚫', 'excluded'],
|
||||||
])
|
])
|
||||||
|
|||||||
@ -5,14 +5,11 @@
|
|||||||
|
|
||||||
import type { GameRow } from '../../estimate'
|
import type { GameRow } from '../../estimate'
|
||||||
import { fmtHoursPrecise, fmtPlaytime } from '../../format'
|
import { fmtHoursPrecise, fmtPlaytime } from '../../format'
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { iconText } from '../../icons/iconText'
|
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import { h } from '../../lib/dom'
|
import { h } from '../../lib/dom'
|
||||||
import { tierLabel } from '../../protondb'
|
import { tierLabel } from '../../protondb'
|
||||||
import type { WebGame } from '../../types'
|
import type { WebGame } from '../../types'
|
||||||
import { glyph } from '../../ui/build'
|
import { glyph } from '../../ui/build'
|
||||||
import { BASIS_ICON, keepText, tierMarks, tierText } from './glyphs'
|
import { ANY_GLYPH, KEEP_GLYPH, tierGlyphs } from './glyphs'
|
||||||
import { COLUMNS, optionsFor, type Column, type ColumnKey, type TableState } from './tableState'
|
import { COLUMNS, optionsFor, type Column, type ColumnKey, type TableState } from './tableState'
|
||||||
|
|
||||||
export const DISPLAY_CAP = 300
|
export const DISPLAY_CAP = 300
|
||||||
@ -39,28 +36,27 @@ export function hltbUrl(game: WebGame): string {
|
|||||||
return `https://howlongtobeat.com/?q=${encodeURIComponent(game.name)}`
|
return `https://howlongtobeat.com/?q=${encodeURIComponent(game.name)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Textgate: select options paint icons; the value (kept/excluded, a
|
// Textgate: select options paint glyphs; the value (kept/excluded, a
|
||||||
// tierLabel string) is what the hash stores and what the option speaks.
|
// tierLabel string) is what the hash stores and what the option speaks.
|
||||||
// Only the keep and proton columns have a select filter; keep's options are
|
// Only the keep and proton columns have a select filter; keep's options are
|
||||||
// always kept/excluded, so every one has an icon.
|
// always kept/excluded, so every one has a glyph.
|
||||||
// An <option> holds text only, so these are glyph-then-word strings.
|
const optionLabel = (c: Column, v: string) => (c.key === 'keep' ? KEEP_GLYPH[v] : tierGlyphs(v))
|
||||||
const optionLabel = (c: Column, v: string) => (c.key === 'keep' ? keepText(v) : tierText(v))
|
|
||||||
const option = (c: Column, v: string) =>
|
const option = (c: Column, v: string) =>
|
||||||
h('option', { value: v, 'aria-label': v || 'All' }, v ? optionLabel(c, v) : iconText('backlog.any'))
|
h('option', { value: v, 'aria-label': v || 'All' }, v ? optionLabel(c, v) : ANY_GLYPH)
|
||||||
|
|
||||||
// Textgate: column headers are pictograms; the column name is the button's
|
// Textgate: column headers are pictograms; the column name is the button's
|
||||||
// aria-label (spoken only), the sort arrow stays visible.
|
// aria-label (spoken only), the sort arrow stays visible.
|
||||||
const COLUMN_ICON = {
|
const COLUMN_ICON: Record<ColumnKey, string> = {
|
||||||
name: 'planner.game',
|
name: '🎮',
|
||||||
completion: 'planner.completion',
|
completion: '%',
|
||||||
playtime: 'planner.playtime',
|
playtime: '⏱',
|
||||||
rush: BASIS_ICON.rush,
|
rush: '🐇',
|
||||||
leisure: BASIS_ICON.leisure,
|
leisure: '🐢',
|
||||||
worst: BASIS_ICON.worst,
|
worst: '🐌',
|
||||||
count_comp: 'planner.completions',
|
count_comp: '#',
|
||||||
proton: 'planner.proton',
|
proton: '🐧',
|
||||||
keep: 'planner.keep',
|
keep: '📌',
|
||||||
} as const satisfies Record<ColumnKey, IconId>
|
}
|
||||||
|
|
||||||
export class PlannerTable {
|
export class PlannerTable {
|
||||||
readonly el: HTMLElement
|
readonly el: HTMLElement
|
||||||
@ -113,12 +109,8 @@ export class PlannerTable {
|
|||||||
return el
|
return el
|
||||||
}
|
}
|
||||||
if (c.filter === 'range') {
|
if (c.filter === 'range') {
|
||||||
// The comparator in the box is a math operator, not an icon: a placeholder is text only.
|
|
||||||
const bound = (side: 'min' | 'max') =>
|
const bound = (side: 'min' | 'max') =>
|
||||||
field(
|
field(`${c.key}.${side}`, h('input', { type: 'number', inputmode: 'decimal', placeholder: side === 'min' ? '≥' : '≤', 'aria-label': `${c.label} ${side}` }))
|
||||||
`${c.key}.${side}`,
|
|
||||||
h('input', { type: 'number', inputmode: 'decimal', placeholder: side === 'min' ? '≥' : '≤', 'aria-label': `${c.label} ${side}` }),
|
|
||||||
)
|
|
||||||
return h('td', { class: 'range-filter' }, h('div', {}, bound('min'), bound('max')))
|
return h('td', { class: 'range-filter' }, h('div', {}, bound('min'), bound('max')))
|
||||||
}
|
}
|
||||||
if (c.filter === 'select') {
|
if (c.filter === 'select') {
|
||||||
@ -129,7 +121,7 @@ export class PlannerTable {
|
|||||||
return h('td', {}, field(c.key, h('input', { type: 'search', placeholder: '', 'aria-label': `Filter ${c.label}` })))
|
return h('td', {}, field(c.key, h('input', { type: 'search', placeholder: '', 'aria-label': `Filter ${c.label}` })))
|
||||||
}
|
}
|
||||||
const headCell = (c: Column): HTMLTableCellElement => {
|
const headCell = (c: Column): HTMLTableCellElement => {
|
||||||
const button = h('button', { type: 'button', class: 'sort-btn', 'aria-label': c.label }, iconInline(COLUMN_ICON[c.key]))
|
const button = h('button', { type: 'button', class: 'sort-btn', 'aria-label': c.label }, COLUMN_ICON[c.key])
|
||||||
const th = h('th', { class: c.numeric ? 'num clickable' : 'clickable', scope: 'col', 'aria-label': c.label }, button)
|
const th = h('th', { class: c.numeric ? 'num clickable' : 'clickable', scope: 'col', 'aria-label': c.label }, button)
|
||||||
th.addEventListener('click', () => {
|
th.addEventListener('click', () => {
|
||||||
this.opts.onSort(c.key)
|
this.opts.onSort(c.key)
|
||||||
@ -169,7 +161,7 @@ export class PlannerTable {
|
|||||||
keep.addEventListener('change', () => { this.opts.onToggle(id) })
|
keep.addEventListener('change', () => { this.opts.onToggle(id) })
|
||||||
const link = h('a', { target: '_blank', rel: 'noreferrer' })
|
const link = h('a', { target: '_blank', rel: 'noreferrer' })
|
||||||
const name = h('td', { class: 'name' }, link)
|
const name = h('td', { class: 'name' }, link)
|
||||||
row = { tr: h('tr', {}, name, cells, h('td', { class: 'num' }, keep)), name, link, badge: glyph('planner.no-data', 'no data', 'badge'), cells, keep }
|
row = { tr: h('tr', {}, name, cells, h('td', { class: 'num' }, keep)), name, link, badge: glyph('❓', 'no data', 'badge'), cells, keep }
|
||||||
this.rows.set(id, row)
|
this.rows.set(id, row)
|
||||||
}
|
}
|
||||||
const g = r.game
|
const g = r.game
|
||||||
@ -187,9 +179,9 @@ export class PlannerTable {
|
|||||||
fmtHoursPrecise(r.leisure),
|
fmtHoursPrecise(r.leisure),
|
||||||
fmtHoursPrecise(r.worst),
|
fmtHoursPrecise(r.worst),
|
||||||
String(g.count_comp),
|
String(g.count_comp),
|
||||||
|
tierGlyphs(tier),
|
||||||
]
|
]
|
||||||
texts.forEach((text, i) => { row.cells[i].textContent = text })
|
texts.forEach((text, i) => { row.cells[i].textContent = text })
|
||||||
row.cells[6].replaceChildren(...tierMarks(tier))
|
|
||||||
row.cells[6].setAttribute('aria-label', tier)
|
row.cells[6].setAttribute('aria-label', tier)
|
||||||
row.keep.checked = !r.excluded
|
row.keep.checked = !r.excluded
|
||||||
row.keep.setAttribute('aria-label', r.excluded ? 'Re-include' : 'Exclude')
|
row.keep.setAttribute('aria-label', r.excluded ? 'Re-include' : 'Exclude')
|
||||||
@ -211,8 +203,8 @@ export class PlannerTable {
|
|||||||
private syncHeads(table: TableState): void {
|
private syncHeads(table: TableState): void {
|
||||||
for (const [c, th, button] of this.heads) {
|
for (const [c, th, button] of this.heads) {
|
||||||
const active = c.key === table.sort
|
const active = c.key === table.sort
|
||||||
const arrow = active ? [' ', iconInline(table.asc ? 'backlog.sort-asc' : 'backlog.sort-desc')] : []
|
const arrow = active ? (table.asc ? ' ▲' : ' ▼') : ''
|
||||||
button.replaceChildren(iconInline(COLUMN_ICON[c.key]), ...arrow)
|
button.textContent = `${COLUMN_ICON[c.key]}${arrow}`
|
||||||
if (active) th.setAttribute('aria-sort', table.asc ? 'ascending' : 'descending')
|
if (active) th.setAttribute('aria-sort', table.asc ? 'ascending' : 'descending')
|
||||||
else th.removeAttribute('aria-sort')
|
else th.removeAttribute('aria-sort')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,16 @@
|
|||||||
// <backlog-stats>: the CLI's `stats` estimate for the default filters (was
|
// <backlog-stats>: the CLI's `stats` estimate for the default filters (was
|
||||||
// screens/Backlog.tsx StatsCard). Textgate: labels are icons, words spoken only.
|
// screens/Backlog.tsx StatsCard). Textgate: labels are glyphs, words spoken only.
|
||||||
|
|
||||||
import { q } from '../../api/queries'
|
import { q } from '../../api/queries'
|
||||||
import { fmtHours } from '../../format'
|
import { fmtHours } from '../../format'
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { h } from '../../lib/dom'
|
import { h } from '../../lib/dom'
|
||||||
import { LiveElement } from '../../lib/element'
|
import { LiveElement } from '../../lib/element'
|
||||||
import { card, errorNotice, facts, glyph, loading } from '../../ui/build'
|
import { card, errorNotice, facts, glyph, loading } from '../../ui/build'
|
||||||
import { BASIS_ICON, styleGlyph } from './glyphs'
|
import { BASIS_GLYPH, styleGlyph } from './glyphs'
|
||||||
|
|
||||||
const ICON: IconId = 'stats.card'
|
const ICON = '📊'
|
||||||
const ratio = (r: number) => (r < 0 ? '—' : `${r.toFixed(2)}×`)
|
const ratio = (r: number) => (r < 0 ? '—' : `${r.toFixed(2)}×`)
|
||||||
const stat = (num: string | number, icon: IconId, label: string) =>
|
const stat = (num: string | number, icon: string, label: string) =>
|
||||||
h('div', { class: 'stat' }, h('span', { class: 'stat-num' }, num), glyph(icon, label, 'stat-label'))
|
h('div', { class: 'stat' }, h('span', { class: 'stat-num' }, num), glyph(icon, label, 'stat-label'))
|
||||||
|
|
||||||
export class BacklogStatsElement extends LiveElement {
|
export class BacklogStatsElement extends LiveElement {
|
||||||
@ -38,17 +37,17 @@ export class BacklogStatsElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'stat-row' },
|
{ class: 'stat-row' },
|
||||||
stat(s.qualifying, 'backlog.in-scope', 'qualifying games'),
|
stat(s.qualifying, '🎮', 'qualifying games'),
|
||||||
stat(fmtHours(s.rush_total), BASIS_ICON.rush, 'rush'),
|
stat(fmtHours(s.rush_total), BASIS_GLYPH.rush, 'rush'),
|
||||||
stat(fmtHours(s.leisure_total), BASIS_ICON.leisure, 'leisure'),
|
stat(fmtHours(s.leisure_total), BASIS_GLYPH.leisure, 'leisure'),
|
||||||
stat(fmtHours(s.worst_total), BASIS_ICON.worst, 'worst case'),
|
stat(fmtHours(s.worst_total), BASIS_GLYPH.worst, 'worst case'),
|
||||||
),
|
),
|
||||||
p
|
p
|
||||||
? facts([
|
? facts([
|
||||||
[glyph(BASIS_ICON.pace, 'Your pace'), styleGlyph(p.player_style)],
|
[glyph(BASIS_GLYPH.pace, 'Your pace'), styleGlyph(p.player_style)],
|
||||||
[glyph(BASIS_ICON.rush, 'vs rush'), ratio(p.ratio_vs_rush)],
|
[glyph(BASIS_GLYPH.rush, 'vs rush'), ratio(p.ratio_vs_rush)],
|
||||||
[glyph(BASIS_ICON.leisure, 'vs leisure'), ratio(p.ratio_vs_leisure)],
|
[glyph(BASIS_GLYPH.leisure, 'vs leisure'), ratio(p.ratio_vs_leisure)],
|
||||||
[glyph('dash.finished','Calibrated on'), [String(p.calibration_count), h('span', { class: 'sr-only' }, ' finished games')]],
|
[glyph('🏆', 'Calibrated on'), [String(p.calibration_count), h('span', { class: 'sr-only' }, ' finished games')]],
|
||||||
])
|
])
|
||||||
: null,
|
: null,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
// The planner's headline: games in scope, the target-date banner, one card per
|
// The planner's headline: games in scope, the target-date banner, one card per
|
||||||
// estimate basis and the player's pace vs HLTB (was SummaryCards.tsx).
|
// estimate basis and the player's pace vs HLTB (was SummaryCards.tsx).
|
||||||
// Textgate: labels are icons (glyphs.ts), the old wording is spoken only.
|
// Textgate: labels are glyphs (glyphs.ts), the old wording is spoken only.
|
||||||
|
|
||||||
import { basisTotal, etaDays, paceDays, playerEstimatedTotal, type EstimateResult } from '../../estimate'
|
import { basisTotal, etaDays, paceDays, playerEstimatedTotal, type EstimateResult } from '../../estimate'
|
||||||
import { fmtEta, fmtHours } from '../../format'
|
import { fmtEta, fmtHours } from '../../format'
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import { h } from '../../lib/dom'
|
import { h } from '../../lib/dom'
|
||||||
import type { EstimateBasis, Filters, PaceVsHLTB, WebStateInfo } from '../../types'
|
import type { EstimateBasis, Filters, PaceVsHLTB, WebStateInfo } from '../../types'
|
||||||
import { empty, glyph } from '../../ui/build'
|
import { empty, glyph } from '../../ui/build'
|
||||||
import { BASIS_ICON, styleGlyph } from './glyphs'
|
import { BASIS_GLYPH, styleGlyph } from './glyphs'
|
||||||
|
|
||||||
export interface SummaryProps {
|
export interface SummaryProps {
|
||||||
result: EstimateResult
|
result: EstimateResult
|
||||||
@ -28,8 +26,8 @@ const CARDS: readonly { basis: EstimateBasis; title: string; blurb: string }[] =
|
|||||||
]
|
]
|
||||||
|
|
||||||
const spoken = (text: string) => h('span', { class: 'sr-only' }, text)
|
const spoken = (text: string) => h('span', { class: 'sr-only' }, text)
|
||||||
/** Games per day: the games icon stands in for the word "games". */
|
/** Games per day: the 🎮 stands in for the word "games". */
|
||||||
const perDay = (n: number | string) => [`${n} `, iconInline('summary.games-per-day'), '/d', spoken(' games per day')]
|
const perDay = (n: number | string) => [`${n} 🎮/d`, spoken(' games per day')]
|
||||||
|
|
||||||
function targetBanner({ result, filters }: SummaryProps, now: Date): HTMLDivElement | null {
|
function targetBanner({ result, filters }: SummaryProps, now: Date): HTMLDivElement | null {
|
||||||
if (!filters.targetDate) return null
|
if (!filters.targetDate) return null
|
||||||
@ -41,20 +39,16 @@ function targetBanner({ result, filters }: SummaryProps, now: Date): HTMLDivElem
|
|||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'target-banner' },
|
{ class: 'target-banner' },
|
||||||
glyph('summary.to-finish', 'To finish'),
|
glyph('🎮', 'To finish'),
|
||||||
' ',
|
' ',
|
||||||
h('strong', {}, result.remainingGames),
|
h('strong', {}, result.remainingGames),
|
||||||
spoken(' games'),
|
spoken(' games'),
|
||||||
' ',
|
' 🏁 ',
|
||||||
iconInline('filter.target-date'),
|
|
||||||
' ',
|
|
||||||
spoken('by '),
|
spoken('by '),
|
||||||
h('strong', {}, filters.targetDate),
|
h('strong', {}, filters.targetDate),
|
||||||
` (${days} d) `,
|
` (${days} d) `,
|
||||||
glyph(BASIS_ICON[filters.basis], `on the ${filters.basis} model, you need`),
|
glyph(BASIS_GLYPH[filters.basis], `on the ${filters.basis} model, you need`),
|
||||||
' ',
|
' → ',
|
||||||
iconInline('summary.need'),
|
|
||||||
' ',
|
|
||||||
h('strong', {}, need),
|
h('strong', {}, need),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -66,13 +60,13 @@ const presetRows = (presets: readonly number[], eta: (perDay: number) => number
|
|||||||
presets.map((p) => h('div', { class: 'preset' }, h('span', {}, `${p} h/day`), h('span', {}, fmtEta(eta(p))))),
|
presets.map((p) => h('div', { class: 'preset' }, h('span', {}, `${p} h/day`), h('span', {}, fmtEta(eta(p))))),
|
||||||
)
|
)
|
||||||
|
|
||||||
const pair = (icon: IconId, label: string, value: Node | string, attrs: Record<string, string> = {}) => [
|
const pair = (icon: string, label: string, value: Node | string, attrs: Record<string, string> = {}) => [
|
||||||
glyph(icon, label),
|
glyph(icon, label),
|
||||||
typeof value === 'string' ? h('span', attrs, value) : value,
|
typeof value === 'string' ? h('span', attrs, value) : value,
|
||||||
]
|
]
|
||||||
|
|
||||||
function playerInsight({ result, paceVsHltb: pace, presets }: SummaryProps): HTMLDivElement {
|
function playerInsight({ result, paceVsHltb: pace, presets }: SummaryProps): HTMLDivElement {
|
||||||
const title = h('div', { class: 'player-insight-title' }, glyph(BASIS_ICON.pace, 'Your Play Style vs HLTB'))
|
const title = h('div', { class: 'player-insight-title' }, glyph(BASIS_GLYPH.pace, 'Your Play Style vs HLTB'))
|
||||||
if (!pace || pace.calibration_count === 0) {
|
if (!pace || pace.calibration_count === 0) {
|
||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
@ -89,18 +83,18 @@ function playerInsight({ result, paceVsHltb: pace, presets }: SummaryProps): HTM
|
|||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'player-insight-grid' },
|
{ class: 'player-insight-grid' },
|
||||||
pair('dash.finished','Calibration games', String(pace.calibration_count)),
|
pair('🏆', 'Calibration games', String(pace.calibration_count)),
|
||||||
pace.ratio_vs_rush !== -1
|
pace.ratio_vs_rush !== -1
|
||||||
? pair(BASIS_ICON.rush, 'vs Rush speed', `${pace.ratio_vs_rush.toFixed(2)}×`, {
|
? pair(BASIS_GLYPH.rush, 'vs Rush speed', `${pace.ratio_vs_rush.toFixed(2)}×`, {
|
||||||
class: pace.ratio_vs_rush <= 1 ? 'player-insight-fast' : 'player-insight-slow',
|
class: pace.ratio_vs_rush <= 1 ? 'player-insight-fast' : 'player-insight-slow',
|
||||||
})
|
})
|
||||||
: null,
|
: null,
|
||||||
pace.ratio_vs_leisure !== -1 ? pair(BASIS_ICON.leisure, 'vs Leisure speed', `${pace.ratio_vs_leisure.toFixed(2)}×`) : null,
|
pace.ratio_vs_leisure !== -1 ? pair(BASIS_GLYPH.leisure, 'vs Leisure speed', `${pace.ratio_vs_leisure.toFixed(2)}×`) : null,
|
||||||
// `t` is the formula's own symbol: 0 = rush speed, 1 = leisure speed.
|
// `t` is the formula's own symbol: 0 = rush speed, 1 = leisure speed.
|
||||||
pace.interpolation_t !== -1
|
pace.interpolation_t !== -1
|
||||||
? pair('summary.interpolation', 'Interpolation t, 0 = rush speed, 1 = leisure speed', pace.interpolation_t.toFixed(3))
|
? pair('t', 'Interpolation t, 0 = rush speed, 1 = leisure speed', pace.interpolation_t.toFixed(3))
|
||||||
: null,
|
: null,
|
||||||
pair('summary.style', 'Play style', styleGlyph(pace.player_style)),
|
pair('🎭', 'Play style', styleGlyph(pace.player_style)),
|
||||||
),
|
),
|
||||||
estimated !== null
|
estimated !== null
|
||||||
? h(
|
? h(
|
||||||
@ -109,7 +103,7 @@ function playerInsight({ result, paceVsHltb: pace, presets }: SummaryProps): HTM
|
|||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'player-insight-estimate-total' },
|
{ class: 'player-insight-estimate-total' },
|
||||||
glyph('summary.estimated-total', 'Estimated total at your pace: '),
|
glyph('Σ', 'Estimated total at your pace: '),
|
||||||
' ',
|
' ',
|
||||||
h('strong', { class: 'player-insight-estimate-hours' }, fmtHours(estimated)),
|
h('strong', { class: 'player-insight-estimate-hours' }, fmtHours(estimated)),
|
||||||
),
|
),
|
||||||
@ -128,10 +122,10 @@ function basisCard(props: SummaryProps, c: (typeof CARDS)[number]): HTMLDivEleme
|
|||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
{ class: filters.basis === c.basis ? 'card active' : 'card', 'data-basis': c.basis },
|
{ class: filters.basis === c.basis ? 'card active' : 'card', 'data-basis': c.basis },
|
||||||
h('div', { class: 'card-title' }, glyph(BASIS_ICON[c.basis], c.title)),
|
h('div', { class: 'card-title' }, glyph(BASIS_GLYPH[c.basis], c.title)),
|
||||||
spoken(c.blurb),
|
spoken(c.blurb),
|
||||||
h('div', { class: 'card-total' }, isPace ? perDay(pace) : fmtHours(total)),
|
h('div', { class: 'card-total' }, isPace ? perDay(pace) : fmtHours(total)),
|
||||||
h('div', { class: 'card-eta' }, isPace && !pace ? glyph('summary.no-start', 'No start date set') : fmtEta(eta)),
|
h('div', { class: 'card-eta' }, isPace && !pace ? glyph('∅', 'No start date set') : fmtEta(eta)),
|
||||||
isPace ? null : presetRows(presets, (p) => etaDays(total, p)),
|
isPace ? null : presetRows(presets, (p) => etaDays(total, p)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -149,15 +143,15 @@ export function summaryCards(props: SummaryProps, now: Date = new Date()): HTMLD
|
|||||||
'div',
|
'div',
|
||||||
{},
|
{},
|
||||||
h('span', { class: 'big' }, result.remainingGames.toLocaleString()),
|
h('span', { class: 'big' }, result.remainingGames.toLocaleString()),
|
||||||
glyph('backlog.in-scope', 'games in scope', 'big-label'),
|
glyph('🎮', 'games in scope', 'big-label'),
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'parity', 'data-match': String(match) },
|
{ class: 'parity', 'data-match': String(match) },
|
||||||
glyph('backlog.cli', 'CLI default qualifies '),
|
glyph('⌨️', 'CLI default qualifies '),
|
||||||
' ',
|
' ',
|
||||||
h('strong', {}, defaultQualifying),
|
h('strong', {}, defaultQualifying),
|
||||||
match ? h('span', { class: 'ok' }, ' ', iconInline('summary.match'), spoken(' match')) : null,
|
match ? h('span', { class: 'ok' }, ' ✓', spoken(' match')) : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
targetBanner(props, now),
|
targetBanner(props, now),
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { makeGame, makePaceVsHltb, makeState } from '../../test/factories'
|
|||||||
import { flush, mount, stubApi } from '../../test/harness'
|
import { flush, mount, stubApi } from '../../test/harness'
|
||||||
import { GAMES, panel, show } from '../../test/plannerHelpers'
|
import { GAMES, panel, show } from '../../test/plannerHelpers'
|
||||||
import { visibleWords } from '../../test/visibleWords'
|
import { visibleWords } from '../../test/visibleWords'
|
||||||
import { keepText, styleGlyph, tierMarks, tierText } from './glyphs'
|
import { ANY_GLYPH, KEEP_GLYPH, styleGlyph, tierGlyphs } from './glyphs'
|
||||||
import { painted } from '../../test/painted'
|
import { painted } from '../../test/painted'
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -50,15 +50,11 @@ describe('textgate guard: backlog', () => {
|
|||||||
|
|
||||||
describe('backlog glyphs', () => {
|
describe('backlog glyphs', () => {
|
||||||
it('paints ProtonDB tiers as medals, unknown tiers as ❔', () => {
|
it('paints ProtonDB tiers as medals, unknown tiers as ❔', () => {
|
||||||
const text = (label: string) => tierMarks(label).map((m) => (typeof m === 'string' ? m : m.textContent)).join('')
|
expect(tierGlyphs('gold / silver')).toBe('🥇/🥈')
|
||||||
expect(text('gold / silver')).toBe('🥇/🥈')
|
expect(tierGlyphs('—')).toBe('—')
|
||||||
expect(text('—')).toBe('—')
|
expect(tierGlyphs('')).toBe('—')
|
||||||
expect(text('')).toBe('—')
|
expect(tierGlyphs('weird')).toBe('❔')
|
||||||
expect(text('weird')).toBe('❔')
|
expect(KEEP_GLYPH.excluded).toBe('🚫')
|
||||||
expect(keepText('excluded')).toBe('🚫')
|
|
||||||
expect(tierText('gold / silver')).toBe('🥇/🥈')
|
|
||||||
expect(tierText('—')).toBe('—')
|
|
||||||
expect(tierText('weird')).toBe('❔')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('speaks an unknown play style by its key', () => {
|
it('speaks an unknown play style by its key', () => {
|
||||||
@ -71,7 +67,7 @@ describe('backlog glyphs', () => {
|
|||||||
it('offers glyph options in the table filters, values unchanged', async () => {
|
it('offers glyph options in the table filters, values unchanged', async () => {
|
||||||
await show()
|
await show()
|
||||||
const keep = screen.getByRole('combobox', { name: 'Filter Keep' })
|
const keep = screen.getByRole('combobox', { name: 'Filter Keep' })
|
||||||
expect([...keep.querySelectorAll('option')].map((o) => [o.value, o.textContent])).toContainEqual(['', '✱'])
|
expect([...keep.querySelectorAll('option')].map((o) => [o.value, o.textContent])).toContainEqual(['', ANY_GLYPH])
|
||||||
expect([...keep.querySelectorAll('option')].map((o) => [o.value, o.textContent])).toContainEqual(['kept', '📌'])
|
expect([...keep.querySelectorAll('option')].map((o) => [o.value, o.textContent])).toContainEqual(['kept', '📌'])
|
||||||
const tier = screen.getByRole('combobox', { name: 'Filter ProtonDB' })
|
const tier = screen.getByRole('combobox', { name: 'Filter ProtonDB' })
|
||||||
expect([...tier.querySelectorAll('option')].map((o) => o.textContent)).toContain('🥇/💎')
|
expect([...tier.querySelectorAll('option')].map((o) => o.textContent)).toContain('🥇/💎')
|
||||||
|
|||||||
@ -60,8 +60,7 @@ describe('Dashboard', () => {
|
|||||||
describe('assignment', () => {
|
describe('assignment', () => {
|
||||||
it('summarises a healthy state', async () => {
|
it('summarises a healthy state', async () => {
|
||||||
show()
|
show()
|
||||||
// The billing line also names the game, behind its icon: pick the hero by class.
|
expect(await screen.findByText('Hollow Knight')).toHaveClass('hero-game')
|
||||||
expect(await screen.findByText('Hollow Knight', { selector: '.hero-game' })).toHaveClass('hero-game')
|
|
||||||
expect(fact('Installed')).toHaveTextContent('Yes')
|
expect(fact('Installed')).toHaveTextContent('Yes')
|
||||||
expect(fact('Games finished')).toHaveTextContent('3')
|
expect(fact('Games finished')).toHaveTextContent('3')
|
||||||
expect(fact('Store')).toHaveTextContent('Blocked')
|
expect(fact('Store')).toHaveTextContent('Blocked')
|
||||||
@ -162,7 +161,7 @@ describe('Dashboard', () => {
|
|||||||
|
|
||||||
it('stays out of the way when nothing is installing', async () => {
|
it('stays out of the way when nothing is installing', async () => {
|
||||||
show({ 'GET /api/daemon': { ...daemon(), fast_installs: undefined } })
|
show({ 'GET /api/daemon': { ...daemon(), fast_installs: undefined } })
|
||||||
expect(await screen.findByText('Hollow Knight', { selector: '.hero-game' })).toBeInTheDocument()
|
expect(await screen.findByText('Hollow Knight')).toBeInTheDocument()
|
||||||
expect(screen.queryByText(/Fast-installing/)).not.toBeInTheDocument()
|
expect(screen.queryByText(/Fast-installing/)).not.toBeInTheDocument()
|
||||||
expect(screen.queryByRole('region', { name: 'Fast install' })).not.toBeInTheDocument()
|
expect(screen.queryByRole('region', { name: 'Fast install' })).not.toBeInTheDocument()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import { commandIcon, commandLabel } from '../commands/catalog'
|
|||||||
import '../commands/commandButton'
|
import '../commands/commandButton'
|
||||||
import { fmtDuration, fmtRemaining } from '../format'
|
import { fmtDuration, fmtRemaining } from '../format'
|
||||||
import { progressBar, stateBadge, type BarTone } from '../jobs/progress'
|
import { progressBar, stateBadge, type BarTone } from '../jobs/progress'
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { define, h, hx } from '../lib/dom'
|
import { define, h, hx } from '../lib/dom'
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
import { jobHref } from '../lib/runner'
|
import { jobHref } from '../lib/runner'
|
||||||
@ -16,11 +15,11 @@ import { card, empty, errorNotice, facts, glyph, link, loading } from '../ui/bui
|
|||||||
import { ago } from '../ui/format'
|
import { ago } from '../ui/format'
|
||||||
import { said } from './spoken'
|
import { said } from './spoken'
|
||||||
|
|
||||||
/** "5 min ago" painted as a clock icon and 5 min (the word "ago" spoken only). */
|
/** "5 min ago" painted as 🕓 5 min (the word "ago" spoken only). */
|
||||||
export function since(iso: string | null): HTMLSpanElement {
|
export function since(iso: string | null): HTMLSpanElement {
|
||||||
const spoken = ago(iso)
|
const spoken = ago(iso)
|
||||||
const short = spoken === 'just now' ? '<1 min' : spoken.replace(/ ago$/, '')
|
const short = spoken === 'just now' ? '<1 min' : spoken.replace(/ ago$/, '')
|
||||||
return said(spoken, iconInline('dash.ago'), ' ', short)
|
return said(spoken, '🕓 ', short)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Seconds left on the total block: from `until` when known, else the
|
/** Seconds left on the total block: from `until` when known, else the
|
||||||
@ -44,26 +43,23 @@ export class BlockCountdownElement extends LiveElement {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const left = fmtRemaining(blockSecondsLeft(block))
|
const left = fmtRemaining(blockSecondsLeft(block))
|
||||||
this.replaceChildren(h('span', { class: 'text-danger' }, said(`${left} left`, iconInline('dash.block-left'), ' ', left)))
|
this.replaceChildren(h('span', { class: 'text-danger' }, said(`${left} left`, '⏳ ', left)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusFacts(s: StatusPayload): HTMLDListElement {
|
function statusFacts(s: StatusPayload): HTMLDListElement {
|
||||||
return facts([
|
return facts([
|
||||||
[
|
[
|
||||||
glyph('dash.installed', 'Installed'),
|
glyph('💾', 'Installed'),
|
||||||
s.assigned_game_installed ? glyph('state.yes', 'Yes') : h('span', { class: 'text-warning' }, glyph('state.warn', 'No — install it from Library')),
|
s.assigned_game_installed ? glyph('✅', 'Yes') : h('span', { class: 'text-warning' }, glyph('⚠️', 'No — install it from Library')),
|
||||||
],
|
],
|
||||||
[glyph('dash.finished', 'Games finished'), s.finished_count],
|
[glyph('🏆', 'Games finished'), s.finished_count],
|
||||||
|
[glyph('🛒', 'Store'), s.store_blocked ? glyph('🔒', 'Blocked') : h('span', { class: 'text-warning' }, glyph('🔓', 'Unblocked'))],
|
||||||
|
[glyph('🗂️', 'Installed games'), s.installed_count],
|
||||||
|
[glyph('⛔', 'Total block'), s.total_block.active ? hx('block-countdown') : glyph('➖', 'Off')],
|
||||||
[
|
[
|
||||||
glyph('dash.store', 'Store'),
|
glyph('📌', 'Manual picks'),
|
||||||
s.store_blocked ? glyph('dash.store-blocked', 'Blocked') : h('span', { class: 'text-warning' }, glyph('dash.store-open', 'Unblocked')),
|
s.manual_picks.length ? s.manual_picks.map((p) => `${p.name} (${p.age_days} d)`).join(', ') : glyph('➖', 'None'),
|
||||||
],
|
|
||||||
[glyph('dash.games', 'Installed games'), s.installed_count],
|
|
||||||
[glyph('dash.total-block', 'Total block'), s.total_block.active ? hx('block-countdown') : glyph('state.off', 'Off')],
|
|
||||||
[
|
|
||||||
glyph('picks.manual', 'Manual picks'),
|
|
||||||
s.manual_picks.length ? s.manual_picks.map((p) => `${p.name} (${p.age_days} d)`).join(', ') : glyph('state.off', 'None'),
|
|
||||||
],
|
],
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
@ -75,13 +71,13 @@ export class DashboardStatusElement extends LiveElement {
|
|||||||
|
|
||||||
protected update(): void {
|
protected update(): void {
|
||||||
const { data, error } = q.status.state
|
const { data, error } = q.status.state
|
||||||
const icon = 'assigned.game'
|
const icon = '🎯'
|
||||||
if (error) {
|
if (error) {
|
||||||
this.replaceChildren(card('Assignment', errorNotice(error), { icon }))
|
this.replaceChildren(card('Assignment', errorNotice(error), { icon }))
|
||||||
} else if (!data) {
|
} else if (!data) {
|
||||||
this.replaceChildren(card('Assignment', loading('status'), { icon }))
|
this.replaceChildren(card('Assignment', loading('status'), { icon }))
|
||||||
} else {
|
} else {
|
||||||
const game = data.current_game_name ?? glyph('state.empty', 'Nothing assigned')
|
const game = data.current_game_name ?? glyph('📭', 'Nothing assigned')
|
||||||
this.replaceChildren(
|
this.replaceChildren(
|
||||||
card('Assignment', [h('p', { class: 'hero-game' }, game), statusFacts(data)], {
|
card('Assignment', [h('p', { class: 'hero-game' }, game), statusFacts(data)], {
|
||||||
icon,
|
icon,
|
||||||
@ -99,9 +95,9 @@ function budgetTone(blocked: boolean, used: number): BarTone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function billingLine(blocked: boolean, label: string): HTMLParagraphElement {
|
function billingLine(blocked: boolean, label: string): HTMLParagraphElement {
|
||||||
if (blocked) return h('p', { class: 'field-help' }, glyph('dash.blocked-today', 'Blocked for today.'))
|
if (blocked) return h('p', { class: 'field-help' }, glyph('⛔', 'Blocked for today.'))
|
||||||
if (!label) return h('p', { class: 'field-help' }, said('Now: nothing billing', iconInline('dash.not-billing')))
|
if (!label) return h('p', { class: 'field-help' }, said('Now: nothing billing', '⏸️'))
|
||||||
return h('p', { class: 'field-help' }, said(`Now: ${label}`, iconInline('dash.billing'), ' ', label))
|
return h('p', { class: 'field-help' }, said(`Now: ${label}`, '▶️ ', label))
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BudgetGlanceElement extends LiveElement {
|
export class BudgetGlanceElement extends LiveElement {
|
||||||
@ -111,7 +107,7 @@ export class BudgetGlanceElement extends LiveElement {
|
|||||||
|
|
||||||
protected update(): void {
|
protected update(): void {
|
||||||
const { data, error } = q.budget.state
|
const { data, error } = q.budget.state
|
||||||
const icon = 'dash.budget'
|
const icon = '⏱️'
|
||||||
if (error) {
|
if (error) {
|
||||||
this.replaceChildren(card('Gaming today', errorNotice(error), { icon }))
|
this.replaceChildren(card('Gaming today', errorNotice(error), { icon }))
|
||||||
return
|
return
|
||||||
@ -132,8 +128,8 @@ export class BudgetGlanceElement extends LiveElement {
|
|||||||
progressBar(t.fraction_used, 'Budget used', budgetTone(t.blocked, t.fraction_used)),
|
progressBar(t.fraction_used, 'Budget used', budgetTone(t.blocked, t.fraction_used)),
|
||||||
billingLine(t.blocked, data.session.billing_label),
|
billingLine(t.blocked, data.session.billing_label),
|
||||||
]
|
]
|
||||||
: h('p', { class: 'text-danger' }, data.error ?? glyph('state.warn', 'Budget state unavailable.'))
|
: h('p', { class: 'text-danger' }, data.error ?? glyph('⚠️', 'Budget state unavailable.'))
|
||||||
this.replaceChildren(card('Gaming today', body, { icon, aside: link('/gaming/', glyph('action.open', 'Details')) }))
|
this.replaceChildren(card('Gaming today', body, { icon, aside: link('/gaming/', glyph('➡️', 'Details')) }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,8 +140,8 @@ function fastInstallRow(r: FastInstallRun): HTMLDivElement {
|
|||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
{},
|
{},
|
||||||
h('p', { class: 'text-danger' }, said(`Fast install of ${r.name} failed: ${r.error}`, iconInline('dash.fast-failed'), ' ', r.name, ': ', r.error)),
|
h('p', { class: 'text-danger' }, said(`Fast install of ${r.name} failed: ${r.error}`, '⛔ ', r.name, ': ', r.error)),
|
||||||
h('p', { class: 'field-help' }, glyph('dash.steam-took-over', "Steam's own download took over.")),
|
h('p', { class: 'field-help' }, glyph('↪️', "Steam's own download took over.")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const pct = r.percent === null ? null : Math.floor(r.percent)
|
const pct = r.percent === null ? null : Math.floor(r.percent)
|
||||||
@ -153,9 +149,9 @@ function fastInstallRow(r: FastInstallRun): HTMLDivElement {
|
|||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
{},
|
{},
|
||||||
h('p', {}, said(`Fast-installing ${r.name} — ${where}`, iconInline('dash.fast-install'), ' ', r.name, pct === null ? '' : ` ${pct}%`)),
|
h('p', {}, said(`Fast-installing ${r.name} — ${where}`, '⚡ ', r.name, pct === null ? '' : ` ${pct}%`)),
|
||||||
progressBar(pct === null ? null : pct / 100, `${r.name} download`),
|
progressBar(pct === null ? null : pct / 100, `${r.name} download`),
|
||||||
h('p', { class: 'field-help' }, said(`${fmtDuration(r.elapsed_seconds)} elapsed`, iconInline('dash.elapsed'), ' ', fmtDuration(r.elapsed_seconds))),
|
h('p', { class: 'field-help' }, said(`${fmtDuration(r.elapsed_seconds)} elapsed`, '⏳ ', fmtDuration(r.elapsed_seconds))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +163,7 @@ export class FastInstallsElement extends LiveElement {
|
|||||||
|
|
||||||
protected update(): void {
|
protected update(): void {
|
||||||
const runs = q.daemon.state.data?.fast_installs ?? []
|
const runs = q.daemon.state.data?.fast_installs ?? []
|
||||||
this.replaceChildren(...(runs.length ? [card('Fast install', runs.map(fastInstallRow), { icon: 'dash.fast-install' })] : []))
|
this.replaceChildren(...(runs.length ? [card('Fast install', runs.map(fastInstallRow), { icon: '⚡' })] : []))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +201,7 @@ export class RecentJobsElement extends LiveElement {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
{ icon: 'dash.recent-jobs', aside: link('/jobs/', glyph('action.open', 'All jobs')) },
|
{ icon: '⚙️', aside: link('/jobs/', glyph('➡️', 'All jobs')) },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,6 @@
|
|||||||
import { OTHER_KEY, UNATTRIBUTED_KEY, seriesClass } from '../../budgetSeries'
|
import { OTHER_KEY, UNATTRIBUTED_KEY, seriesClass } from '../../budgetSeries'
|
||||||
import { fmtAgo, fmtDuration } from '../../format'
|
import { fmtAgo, fmtDuration } from '../../format'
|
||||||
import { budgetHistorySvg } from '../../lib/charts/budgetHistory'
|
import { budgetHistorySvg } from '../../lib/charts/budgetHistory'
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { h } from '../../lib/dom'
|
import { h } from '../../lib/dom'
|
||||||
import type { BudgetHistoryDay, BudgetLegendEntry, BudgetRules, BudgetSession, BudgetToday } from '../../types'
|
import type { BudgetHistoryDay, BudgetLegendEntry, BudgetRules, BudgetSession, BudgetToday } from '../../types'
|
||||||
import { glyph } from '../../ui/build'
|
import { glyph } from '../../ui/build'
|
||||||
@ -27,17 +25,17 @@ function meterState(today: BudgetToday): string {
|
|||||||
|
|
||||||
/** A series name: game names are content; the sentinels and the "(launcher)" tag are glyphs. */
|
/** A series name: game names are content; the sentinels and the "(launcher)" tag are glyphs. */
|
||||||
export function seriesLabel(key: string, label: string): HTMLElement {
|
export function seriesLabel(key: string, label: string): HTMLElement {
|
||||||
if (key === OTHER_KEY) return glyph('gaming.series.other', label)
|
if (key === OTHER_KEY) return glyph('➕', label)
|
||||||
if (key === UNATTRIBUTED_KEY) return glyph('gaming.series.unattributed', label)
|
if (key === UNATTRIBUTED_KEY) return glyph('❔', label)
|
||||||
if (key.startsWith('launcher:')) return said(label, iconInline('gaming.launcher'), ' ', label.replace(/\s*\(launcher\)$/, ''))
|
if (key.startsWith('launcher:')) return said(label, '🚀 ', label.replace(/\s*\(launcher\)$/, ''))
|
||||||
return h('span', {}, label)
|
return h('span', {}, label)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** "5m ago" painted as the as-of icon and 5m. */
|
/** "5m ago" painted as 🕓 5m. */
|
||||||
function asOf(iso: string): HTMLElement {
|
function asOf(iso: string): HTMLElement {
|
||||||
const ago = fmtAgo(iso)
|
const ago = fmtAgo(iso)
|
||||||
const short = ago === 'unknown' ? '?' : ago === 'just now' ? '<10s' : ago.replace(/ ago$/, '')
|
const short = ago === 'unknown' ? '?' : ago === 'just now' ? '<10s' : ago.replace(/ ago$/, '')
|
||||||
return said(`as of ${ago}`, iconInline('dash.ago'), ' ', short)
|
return said(`as of ${ago}`, '🕓 ', short)
|
||||||
}
|
}
|
||||||
|
|
||||||
function warningLine(today: BudgetToday, maskedCount: number): HTMLElement {
|
function warningLine(today: BudgetToday, maskedCount: number): HTMLElement {
|
||||||
@ -50,14 +48,14 @@ function warningLine(today: BudgetToday, maskedCount: number): HTMLElement {
|
|||||||
'span',
|
'span',
|
||||||
{ class: 'budget-badge budget-badge--blocked' },
|
{ class: 'budget-badge budget-badge--blocked' },
|
||||||
maskedCount > 0
|
maskedCount > 0
|
||||||
? glyph('gaming.cutoff.masked', 'Cutoff engaged — launchers are masked')
|
? glyph('⛔🔒', 'Cutoff engaged — launchers are masked')
|
||||||
: glyph('gaming.cutoff.unmasked', 'Cutoff engaged — launchers are not currently masked'),
|
: glyph('⛔🔓', 'Cutoff engaged — launchers are not currently masked'),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const next = today.next_warning_seconds
|
const next = today.next_warning_seconds
|
||||||
return next === null
|
return next === null
|
||||||
? glyph('gaming.warn.none', 'No further warnings today.')
|
? glyph('🔕', 'No further warnings today.')
|
||||||
: said(`Next warning at ${fmtDuration(next)} remaining.`, iconInline('gaming.warning'), ' ', fmtDuration(next))
|
: said(`Next warning at ${fmtDuration(next)} remaining.`, '🔔 ', fmtDuration(next))
|
||||||
}
|
}
|
||||||
|
|
||||||
function usageLine(t: BudgetToday): HTMLElement {
|
function usageLine(t: BudgetToday): HTMLElement {
|
||||||
@ -65,18 +63,7 @@ function usageLine(t: BudgetToday): HTMLElement {
|
|||||||
const spoken =
|
const spoken =
|
||||||
`${fmtDuration(t.seconds_used)} of ${fmtDuration(t.budget_seconds)} used · ` +
|
`${fmtDuration(t.seconds_used)} of ${fmtDuration(t.budget_seconds)} used · ` +
|
||||||
`${Math.round(t.fraction_used * 100)}% · gaming day ${t.gaming_day} (starts ${t.day_starts_at})`
|
`${Math.round(t.fraction_used * 100)}% · gaming day ${t.gaming_day} (starts ${t.day_starts_at})`
|
||||||
return said(
|
return said(spoken, used, ' · 📅 ', t.gaming_day, ' · 🌅 ', t.day_starts_at.replace(/\s*local$/, ''))
|
||||||
spoken,
|
|
||||||
used,
|
|
||||||
' · ',
|
|
||||||
iconInline('gaming.day'),
|
|
||||||
' ',
|
|
||||||
t.gaming_day,
|
|
||||||
' · ',
|
|
||||||
iconInline('gaming.day_start'),
|
|
||||||
' ',
|
|
||||||
t.day_starts_at.replace(/\s*local$/, ''),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function todayCard(today: BudgetToday, legend: readonly BudgetLegendEntry[], maskedCount: number): HTMLElement {
|
export function todayCard(today: BudgetToday, legend: readonly BudgetLegendEntry[], maskedCount: number): HTMLElement {
|
||||||
@ -89,14 +76,14 @@ export function todayCard(today: BudgetToday, legend: readonly BudgetLegendEntry
|
|||||||
return h(
|
return h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'budget-today' },
|
{ class: 'budget-today' },
|
||||||
h('h2', {}, glyph('gaming.today', 'Today')),
|
h('h2', {}, glyph('📅', 'Today')),
|
||||||
h('p', { class: 'budget-hero' }, h('strong', {}, fmtDuration(today.seconds_remaining)), h('span', { class: 'sr-only' }, ' left')),
|
h('p', { class: 'budget-hero' }, h('strong', {}, fmtDuration(today.seconds_remaining)), h('span', { class: 'sr-only' }, ' left')),
|
||||||
h('div', { class: `budget-meter budget-meter--${meterState(today)}` }, fill),
|
h('div', { class: `budget-meter budget-meter--${meterState(today)}` }, fill),
|
||||||
h('p', { class: 'hint' }, usageLine(today)),
|
h('p', { class: 'hint' }, usageLine(today)),
|
||||||
h('p', { class: 'hint' }, warningLine(today, maskedCount)),
|
h('p', { class: 'hint' }, warningLine(today, maskedCount)),
|
||||||
today.games.length > 0
|
today.games.length > 0
|
||||||
? [
|
? [
|
||||||
h('h3', { class: 'budget-subhead' }, glyph('gaming.by_game', 'Today by game')),
|
h('h3', { class: 'budget-subhead' }, glyph('🎮', 'Today by game')),
|
||||||
h(
|
h(
|
||||||
'ul',
|
'ul',
|
||||||
{ class: 'budget-games' },
|
{ class: 'budget-games' },
|
||||||
@ -121,23 +108,23 @@ export function todayUnavailable(error: string | null): HTMLElement {
|
|||||||
return h(
|
return h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'budget-today' },
|
{ class: 'budget-today' },
|
||||||
h('h2', {}, glyph('gaming.today', 'Today')),
|
h('h2', {}, glyph('📅', 'Today')),
|
||||||
// The server's own error is shown as is; the fallback is a glyph.
|
// The server's own error is shown as is; the fallback is a glyph.
|
||||||
h('p', { class: 'error' }, error ?? glyph('state.warn', 'Budget state unavailable.')),
|
h('p', { class: 'error' }, error ?? glyph('⚠️', 'Budget state unavailable.')),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERDICT = new Map<string, readonly [IconId, string]>([
|
const VERDICT = new Map([
|
||||||
['engaged', ['dash.billing', 'Billing — you are playing']],
|
['engaged', ['▶️', 'Billing — you are playing']],
|
||||||
['not_applicable', ['dash.not-billing', 'Not billing — no game running']],
|
['not_applicable', ['⏸️', 'Not billing — no game running']],
|
||||||
])
|
])
|
||||||
|
|
||||||
export function liveCard(session: BudgetSession): HTMLElement {
|
export function liveCard(session: BudgetSession): HTMLElement {
|
||||||
const title = h('h2', {}, glyph('gaming.right_now', 'Right now'))
|
const title = h('h2', {}, glyph('📡', 'Right now'))
|
||||||
if (!session.available) {
|
if (!session.available) {
|
||||||
return h('section', { class: 'budget-live' }, title, h('p', { class: 'hint' }, glyph('state.empty', 'No verdict has been logged yet.')))
|
return h('section', { class: 'budget-live' }, title, h('p', { class: 'hint' }, glyph('📭', 'No verdict has been logged yet.')))
|
||||||
}
|
}
|
||||||
const [icon, verdict] = VERDICT.get(session.state) ?? (['state.unknown', session.state] as const)
|
const [icon, verdict] = VERDICT.get(session.state) ?? ['❔', session.state]
|
||||||
return h(
|
return h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'budget-live' },
|
{ class: 'budget-live' },
|
||||||
@ -147,8 +134,8 @@ export function liveCard(session: BudgetSession): HTMLElement {
|
|||||||
? h(
|
? h(
|
||||||
'p',
|
'p',
|
||||||
{ class: 'hint' },
|
{ class: 'hint' },
|
||||||
session.game_name ? [said('Assigned game ', iconInline('assigned.game'), ' '), h('strong', {}, session.game_name), ' · '] : null,
|
session.game_name ? [said('Assigned game ', '🎯 '), h('strong', {}, session.game_name), ' · '] : null,
|
||||||
said(`${session.qualifying_count} qualifying processes`, iconInline('gaming.qualifying'), ' ', session.qualifying_count),
|
said(`${session.qualifying_count} qualifying processes`, '⚙️ ', session.qualifying_count),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
// The assignment above is what the enforcer told you to play; this is
|
// The assignment above is what the enforcer told you to play; this is
|
||||||
@ -159,9 +146,7 @@ export function liveCard(session: BudgetSession): HTMLElement {
|
|||||||
? h(
|
? h(
|
||||||
'p',
|
'p',
|
||||||
{ class: 'hint' },
|
{ class: 'hint' },
|
||||||
session.state === 'engaged'
|
session.state === 'engaged' ? said('Billing to ', '💸 ') : said('Last billed to ', '⏮️💸 '),
|
||||||
? said('Billing to ', iconInline('gaming.billing_to'), ' ')
|
|
||||||
: said('Last billed to ', iconInline('gaming.billed_last'), ' '),
|
|
||||||
h('strong', {}, session.billing_label),
|
h('strong', {}, session.billing_label),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
@ -172,13 +157,13 @@ export function liveCard(session: BudgetSession): HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function historyCard(days: readonly BudgetHistoryDay[], legend: readonly BudgetLegendEntry[], budgetSeconds: number): HTMLElement {
|
export function historyCard(days: readonly BudgetHistoryDay[], legend: readonly BudgetLegendEntry[], budgetSeconds: number): HTMLElement {
|
||||||
const title = h('h2', {}, glyph('gaming.history', 'Last 14 days'))
|
const title = h('h2', {}, glyph('📊', 'Last 14 days'))
|
||||||
if (days.length === 0) {
|
if (days.length === 0) {
|
||||||
return h(
|
return h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'chart' },
|
{ class: 'chart' },
|
||||||
title,
|
title,
|
||||||
h('p', { class: 'hint' }, glyph('state.empty', 'No budget history recorded yet — a bar appears for each gaming day from now on.')),
|
h('p', { class: 'hint' }, glyph('📭', 'No budget history recorded yet — a bar appears for each gaming day from now on.')),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// A <template> parses the markup as HTML, which puts <svg> in the SVG namespace.
|
// A <template> parses the markup as HTML, which puts <svg> in the SVG namespace.
|
||||||
@ -204,24 +189,24 @@ export function historyCard(days: readonly BudgetHistoryDay[], legend: readonly
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onOff = (value: boolean, on: string, off: string) => (value ? glyph('state.yes', on) : glyph('state.off', off))
|
const onOff = (value: boolean, on: string, off: string) => (value ? glyph('✅', on) : glyph('➖', off))
|
||||||
|
|
||||||
export function rulesCard(rules: BudgetRules): HTMLElement {
|
export function rulesCard(rules: BudgetRules): HTMLElement {
|
||||||
const row = (icon: IconId, term: string, value: Node | string) => [h('dt', {}, glyph(icon, term)), h('dd', {}, value)]
|
const row = (icon: string, term: string, value: Node | string) => [h('dt', {}, glyph(icon, term)), h('dd', {}, value)]
|
||||||
const warn = rules.warn_at.map((s) => fmtDuration(s)).join(', ')
|
const warn = rules.warn_at.map((s) => fmtDuration(s)).join(', ')
|
||||||
return h(
|
return h(
|
||||||
'section',
|
'section',
|
||||||
{ class: 'budget-rules' },
|
{ class: 'budget-rules' },
|
||||||
h('h2', {}, glyph('gaming.rules', 'Rules in effect')),
|
h('h2', {}, glyph('📏', 'Rules in effect')),
|
||||||
h(
|
h(
|
||||||
'dl',
|
'dl',
|
||||||
{ class: 'budget-rules-list' },
|
{ class: 'budget-rules-list' },
|
||||||
row('gaming.budget', 'Daily budget', fmtDuration(rules.budget_seconds)),
|
row('⏱️', 'Daily budget', fmtDuration(rules.budget_seconds)),
|
||||||
row('gaming.enforcement', 'Enforcement', onOff(rules.enforcement, 'on', 'off')),
|
row('🛡️', 'Enforcement', onOff(rules.enforcement, 'on', 'off')),
|
||||||
row('gaming.launcher', 'Counts launchers', onOff(rules.counts_launchers, 'yes', 'no')),
|
row('🚀', 'Counts launchers', onOff(rules.counts_launchers, 'yes', 'no')),
|
||||||
row('gaming.warning', 'Warnings at', said(`${warn} remaining`, warn)),
|
row('🔔', 'Warnings at', said(`${warn} remaining`, warn)),
|
||||||
rules.demo ? row('gaming.mode', 'Mode', glyph('gaming.demo', 'demo (short budget, separate state)')) : null,
|
rules.demo ? row('🧪', 'Mode', glyph('🧪', 'demo (short budget, separate state)')) : null,
|
||||||
rules.masked_launchers.length > 0 ? row('gaming.masked', 'Masked now', rules.masked_launchers.join(', ')) : null,
|
rules.masked_launchers.length > 0 ? row('🔒', 'Masked now', rules.masked_launchers.join(', ')) : null,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,82 +0,0 @@
|
|||||||
// The gaming page paints every icon through the registry: the user's word
|
|
||||||
// shows right of the icon, a chosen alternative glyph replaces the default,
|
|
||||||
// and the spoken sentence stays as it was.
|
|
||||||
|
|
||||||
import { screen } from '@testing-library/dom'
|
|
||||||
import { afterEach, describe, expect, it } from 'vitest'
|
|
||||||
import { OTHER_KEY } from '../../budgetSeries'
|
|
||||||
import { makeBudgetRules, makeBudgetSession, makeBudgetToday } from '../../test/factories'
|
|
||||||
import { mount } from '../../test/harness'
|
|
||||||
import { useIcons } from '../../test/iconLedger'
|
|
||||||
import { liveCard, rulesCard, seriesLabel, todayCard, todayUnavailable } from './cards'
|
|
||||||
import './panel'
|
|
||||||
|
|
||||||
const show = (el: HTMLElement) => {
|
|
||||||
document.body.replaceChildren(el)
|
|
||||||
}
|
|
||||||
const words = () => [...document.querySelectorAll('.icon-word')].map((w) => w.textContent)
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
history.replaceState(null, '', '/')
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('gaming page icons', () => {
|
|
||||||
it('rules card: a word right of the row icon, an alternative glyph, spoken names kept', () => {
|
|
||||||
useIcons({ 'gaming.budget': { word: 'allowance' }, 'gaming.enforcement': { glyph: '⚔️' }, 'state.yes': { word: 'on' } })
|
|
||||||
show(rulesCard(makeBudgetRules()))
|
|
||||||
const term = document.querySelector('dt')
|
|
||||||
expect(term?.querySelector('[data-icon]')?.nextElementSibling).toHaveClass('icon-word')
|
|
||||||
expect(term?.querySelector('.icon-word')?.textContent).toBe('Allowance')
|
|
||||||
expect(term?.querySelector('.sr-only')?.textContent).toBe('Daily budget')
|
|
||||||
expect(document.querySelectorAll('dt').item(1).querySelector('[data-icon]')?.textContent).toBe('⚔️')
|
|
||||||
expect(words()).toEqual(['Allowance', 'On', 'On'])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('today card: warning, gaming day and heading icons carry the words', () => {
|
|
||||||
useIcons({ 'gaming.warning': { word: 'bell' }, 'gaming.day': { word: 'date' }, 'gaming.today': { glyph: '🗓️' } })
|
|
||||||
show(todayCard(makeBudgetToday(), [], 0))
|
|
||||||
expect(words()).toEqual(['Date', 'Bell'])
|
|
||||||
expect(screen.getByText(/Next warning at 1h 0m remaining/)).toBeInTheDocument()
|
|
||||||
expect(document.querySelector('h2 [data-icon]')?.textContent).toBe('🗓️')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('unavailable and empty marks reuse the shared state icons', () => {
|
|
||||||
useIcons({ 'state.warn': { word: 'attention' } })
|
|
||||||
show(todayUnavailable(null))
|
|
||||||
expect(words()).toEqual(['Attention'])
|
|
||||||
expect(screen.getByText('Budget state unavailable.')).toBeInTheDocument()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('live card: the verdict icon swaps and the billing icon shows its word', () => {
|
|
||||||
useIcons({ 'dash.billing': { glyph: '⏺️' }, 'gaming.billing_to': { word: 'charging' }, 'assigned.game': { word: 'target' } })
|
|
||||||
show(liveCard(makeBudgetSession()))
|
|
||||||
expect(document.querySelector('.budget-verdict [data-icon]')?.textContent).toBe('⏺️')
|
|
||||||
expect(words()).toEqual(['Target', 'Charging'])
|
|
||||||
expect(screen.getByText('Billing to')).toBeInTheDocument()
|
|
||||||
expect(screen.getByText('Billing — you are playing')).toBeInTheDocument()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('series labels: the other-games sentinel and a launcher carry their icons', () => {
|
|
||||||
useIcons({ 'gaming.series.other': { word: 'rest' }, 'gaming.launcher': { word: 'client' } })
|
|
||||||
show(wrap(seriesLabel(OTHER_KEY, 'Other games')))
|
|
||||||
expect(words()).toEqual(['Rest'])
|
|
||||||
show(wrap(seriesLabel('launcher:epic', 'Epic (launcher)')))
|
|
||||||
expect(words()).toEqual(['Client'])
|
|
||||||
expect(document.body.textContent).toContain('Epic')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('mode link: the demo and production icons take the chosen glyph', () => {
|
|
||||||
useIcons({ 'gaming.demo': { glyph: '🔬' }, 'gaming.production': { glyph: '🏢' } })
|
|
||||||
mount('<budget-mode-link></budget-mode-link>')
|
|
||||||
expect(screen.getByRole('link', { name: 'Show demo budget' }).querySelector('[data-icon]')?.textContent).toBe('🔬')
|
|
||||||
history.replaceState(null, '', '/gaming/?demo=1')
|
|
||||||
mount('<budget-mode-link></budget-mode-link>')
|
|
||||||
expect(screen.getByRole('link', { name: 'Show production budget' }).querySelector('[data-icon]')?.textContent).toBe('🏢')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
function wrap(child: HTMLElement): HTMLElement {
|
|
||||||
const el = document.createElement('div')
|
|
||||||
el.append(child)
|
|
||||||
return el
|
|
||||||
}
|
|
||||||
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import { explain } from '../../api/errors'
|
import { explain } from '../../api/errors'
|
||||||
import { q } from '../../api/queries'
|
import { q } from '../../api/queries'
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import { define, h } from '../../lib/dom'
|
import { define, h } from '../../lib/dom'
|
||||||
import { LiveElement } from '../../lib/element'
|
import { LiveElement } from '../../lib/element'
|
||||||
import { commandLine, glyph, loading } from '../../ui/build'
|
import { commandLine, glyph, loading } from '../../ui/build'
|
||||||
@ -22,12 +21,12 @@ export function isDemo(search: string = location.search): boolean {
|
|||||||
export class BudgetModeLinkElement extends LiveElement {
|
export class BudgetModeLinkElement extends LiveElement {
|
||||||
protected update(): void {
|
protected update(): void {
|
||||||
const demo = isDemo()
|
const demo = isDemo()
|
||||||
// The demo icon switches to the demo budget, the production icon back; the words are spoken.
|
// 🧪 switches to the demo budget, 🏭 back to production; the words are spoken.
|
||||||
this.replaceChildren(
|
this.replaceChildren(
|
||||||
h(
|
h(
|
||||||
'a',
|
'a',
|
||||||
{ href: demo ? '/gaming/' : '/gaming/?demo=1', class: 'btn btn-ghost' },
|
{ href: demo ? '/gaming/' : '/gaming/?demo=1', class: 'btn btn-ghost' },
|
||||||
demo ? glyph('gaming.production', 'Show production budget') : glyph('gaming.demo', 'Show demo budget'),
|
demo ? glyph('🏭', 'Show production budget') : glyph('🧪', 'Show demo budget'),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -51,7 +50,7 @@ export class BudgetPanelElement extends LiveElement {
|
|||||||
{ class: 'status' },
|
{ class: 'status' },
|
||||||
// The server's own detail is painted; the framing is spoken. The
|
// The server's own detail is painted; the framing is spoken. The
|
||||||
// command is the recovery path, so it stays with a copy button.
|
// command is the recovery path, so it stays with a copy button.
|
||||||
h('p', { class: 'error' }, said(`Could not read budget state: ${explain(error).detail}`, iconInline('notice.danger'), ' ', explain(error).detail)),
|
h('p', { class: 'error' }, said(`Could not read budget state: ${explain(error).detail}`, '⛔ ', explain(error).detail)),
|
||||||
h('p', { class: 'hint' }, h('span', { class: 'sr-only' }, 'Is the backend running? Start it with')),
|
h('p', { class: 'hint' }, h('span', { class: 'sr-only' }, 'Is the backend running? Start it with')),
|
||||||
commandLine('./run.sh serve'),
|
commandLine('./run.sh serve'),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { explain } from '../api/errors'
|
|||||||
import type { Job } from '../api/jobContract'
|
import type { Job } from '../api/jobContract'
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { commandIcon, commandLabel } from '../commands/catalog'
|
import { commandIcon, commandLabel } from '../commands/catalog'
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import '../jobs/jobProgress'
|
import '../jobs/jobProgress'
|
||||||
import { stateBadge } from '../jobs/progress'
|
import { stateBadge } from '../jobs/progress'
|
||||||
import { define, h, hx } from '../lib/dom'
|
import { define, h, hx } from '../lib/dom'
|
||||||
@ -87,10 +86,10 @@ export class JobListElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'tr',
|
'tr',
|
||||||
{},
|
{},
|
||||||
h('th', { scope: 'col' }, glyph('jobs.command', 'Command')),
|
h('th', { scope: 'col' }, glyph('⌨️', 'Command')),
|
||||||
h('th', { scope: 'col' }, glyph('jobs.state', 'State')),
|
h('th', { scope: 'col' }, glyph('🚦', 'State')),
|
||||||
h('th', { scope: 'col' }, glyph('jobs.started', 'Started')),
|
h('th', { scope: 'col' }, glyph('🕐', 'Started')),
|
||||||
h('th', { scope: 'col', class: 'num' }, glyph('jobs.took', 'Took')),
|
h('th', { scope: 'col', class: 'num' }, glyph('⏱️', 'Took')),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
this.body,
|
this.body,
|
||||||
@ -126,12 +125,12 @@ export class JobListElement extends LiveElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function notFound(id: string, error: ApiFailure): HTMLDivElement {
|
function notFound(id: string, error: ApiFailure): HTMLDivElement {
|
||||||
// The not-found icon + the id painted; the explanation and the server's message are spoken.
|
// ❓ + the id painted; the explanation and the server's message are spoken.
|
||||||
const el = notice(
|
const el = notice(
|
||||||
'warning',
|
'warning',
|
||||||
null,
|
null,
|
||||||
h('p', { class: 'm0' }, h('span', { 'aria-hidden': 'true' }, iconInline('jobs.not-found'), ' '), h('span', { class: 'mono' }, id)),
|
h('p', { class: 'm0' }, h('span', { 'aria-hidden': 'true' }, '❓ '), h('span', { class: 'mono' }, id)),
|
||||||
h('p', { class: 'm0' }, link(pageHref('/jobs'), glyph('jobs.all', 'See all jobs'), '')),
|
h('p', { class: 'm0' }, link(pageHref('/jobs'), glyph('📋', 'See all jobs'), '')),
|
||||||
)
|
)
|
||||||
el.dataset.code = 'not_found'
|
el.dataset.code = 'not_found'
|
||||||
el.setAttribute('aria-label', `Job not found. There is no job ${id}. It may have been pruned: the history keeps the last 50.${error.message ? ` ${error.message}` : ''}`)
|
el.setAttribute('aria-label', `Job not found. There is no job ${id}. It may have been pruned: the history keeps the last 50.${error.message ? ` ${error.message}` : ''}`)
|
||||||
@ -156,7 +155,7 @@ export class JobDetailElement extends LiveElement {
|
|||||||
this.sub = h('p', { class: 'sub' })
|
this.sub = h('p', { class: 'sub' })
|
||||||
this.status = h('div', { class: 'contents' })
|
this.status = h('div', { class: 'contents' })
|
||||||
this.mounted = false
|
this.mounted = false
|
||||||
this.replaceChildren(pageHead(this.heading, this.sub, link(pageHref('/jobs'), glyph('jobs.all', 'All jobs'), 'btn btn-ghost')), this.status)
|
this.replaceChildren(pageHead(this.heading, this.sub, link(pageHref('/jobs'), glyph('📋', 'All jobs'), 'btn btn-ghost')), this.status)
|
||||||
// Subscribed by hand, not via watch(): an unknown id stops polling.
|
// Subscribed by hand, not via watch(): an unknown id stops polling.
|
||||||
let live = true
|
let live = true
|
||||||
const off = q.job(this.jobId).subscribe(() => {
|
const off = q.job(this.jobId).subscribe(() => {
|
||||||
@ -173,12 +172,12 @@ export class JobDetailElement extends LiveElement {
|
|||||||
const id = this.jobId
|
const id = this.jobId
|
||||||
const { data, error, loading: waiting } = q.job(id).state
|
const { data, error, loading: waiting } = q.job(id).state
|
||||||
const missing = !data && error instanceof ApiFailure && error.code === 'not_found' ? error : null
|
const missing = !data && error instanceof ApiFailure && error.code === 'not_found' ? error : null
|
||||||
// Heading: the command's glyph (the not-found icon when the id is unknown, the job icon while loading), name spoken.
|
// Heading: the command's glyph (❓ when the id is unknown, ⚙️ while loading), name spoken.
|
||||||
this.heading.replaceChildren(data ? commandGlyph(data.command) : missing ? glyph('jobs.not-found', 'Job not found') : glyph('jobs.job', 'Job'))
|
this.heading.replaceChildren(data ? commandGlyph(data.command) : missing ? glyph('❓', 'Job not found') : glyph('⚙️', 'Job'))
|
||||||
this.sub.replaceChildren(
|
this.sub.replaceChildren(
|
||||||
h('span', { class: 'sr-only' }, 'Job '),
|
h('span', { class: 'sr-only' }, 'Job '),
|
||||||
h('span', { class: 'mono' }, id),
|
h('span', { class: 'mono' }, id),
|
||||||
data ? h('span', {}, h('span', { 'aria-hidden': 'true' }, ' · ', iconInline('jobs.started'), ' '), h('span', { class: 'sr-only' }, ' · created '), dateTime(data.created_at)) : '',
|
data ? h('span', {}, h('span', { 'aria-hidden': 'true' }, ' · 🕐 '), h('span', { class: 'sr-only' }, ' · created '), dateTime(data.created_at)) : '',
|
||||||
)
|
)
|
||||||
this.status.replaceChildren(
|
this.status.replaceChildren(
|
||||||
...(missing ? [notFound(id, missing)] : error ? [errorNotice(error)] : waiting ? [loading('job')] : []),
|
...(missing ? [notFound(id, missing)] : error ? [errorNotice(error)] : waiting ? [loading('job')] : []),
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
// browser's search state, so a reload comes back to it.
|
// browser's search state, so a reload comes back to it.
|
||||||
|
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { define, h, hx } from '../lib/dom'
|
import { define, h, hx } from '../lib/dom'
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
import '../library/gameBrowser'
|
import '../library/gameBrowser'
|
||||||
@ -15,10 +13,10 @@ import { bytes } from '../ui/format'
|
|||||||
|
|
||||||
type View = 'all' | 'installed'
|
type View = 'all' | 'installed'
|
||||||
|
|
||||||
/** View key, spoken label, painted icon. */
|
/** View key, spoken label, painted glyph. */
|
||||||
const VIEWS: [View, string, IconId][] = [
|
const VIEWS: [View, string, string][] = [
|
||||||
['all', 'All games', 'libpage.all'],
|
['all', 'All games', '🗂️'],
|
||||||
['installed', 'Installed', 'dash.installed'],
|
['installed', 'Installed', '💾'],
|
||||||
]
|
]
|
||||||
|
|
||||||
const viewFromHash = (): View => (readHash().get('view') === 'installed' ? 'installed' : 'all')
|
const viewFromHash = (): View => (readHash().get('view') === 'installed' ? 'installed' : 'all')
|
||||||
@ -68,10 +66,10 @@ export class InstalledTableElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'tr',
|
'tr',
|
||||||
{},
|
{},
|
||||||
h('th', { scope: 'col' }, glyph('libpage.game', 'Game')),
|
h('th', { scope: 'col' }, glyph('🎮', 'Game')),
|
||||||
h('th', { scope: 'col' }, glyph('libpage.app-id', 'App id')),
|
h('th', { scope: 'col' }, glyph('#', 'App id')),
|
||||||
h('th', { scope: 'col', class: 'num' }, glyph('libpage.size', 'Size')),
|
h('th', { scope: 'col', class: 'num' }, glyph('💽', 'Size')),
|
||||||
h('th', { scope: 'col' }, glyph('libpage.role', 'Role')),
|
h('th', { scope: 'col' }, glyph('🏷️', 'Role')),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
@ -87,9 +85,9 @@ export class InstalledTableElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'td',
|
'td',
|
||||||
{},
|
{},
|
||||||
g.assigned ? pill('accent', 'assigned', 'assigned.game') : null,
|
g.assigned ? pill('accent', 'assigned', '🎯') : null,
|
||||||
g.protected ? pill('neutral', 'protected', 'libpage.protected') : null,
|
g.protected ? pill('neutral', 'protected', '🛡️') : null,
|
||||||
!g.assigned && !g.protected ? glyph('libpage.candidate', 'uninstall candidate', 'muted') : null,
|
!g.assigned && !g.protected ? glyph('🗑️', 'uninstall candidate', 'muted') : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -99,12 +97,12 @@ export class InstalledTableElement extends LiveElement {
|
|||||||
: null,
|
: null,
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
icon: 'dash.installed',
|
icon: '💾',
|
||||||
aside: data
|
aside: data
|
||||||
? h(
|
? h(
|
||||||
'span',
|
'span',
|
||||||
{ class: 'muted' },
|
{ class: 'muted' },
|
||||||
h('span', { 'aria-hidden': 'true' }, iconInline('libpage.game'), ` ${games.length} · `, iconInline('libpage.size'), ` ${bytes(total)}`),
|
h('span', { 'aria-hidden': 'true' }, `🎮 ${games.length} · 💽 ${bytes(total)}`),
|
||||||
h('span', { class: 'sr-only' }, `${games.length} games · ${bytes(total)}`),
|
h('span', { class: 'sr-only' }, `${games.length} games · ${bytes(total)}`),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
@ -145,7 +143,7 @@ export class LibraryViewElement extends HTMLElement {
|
|||||||
this.show(key)
|
this.show(key)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
h('span', { 'aria-hidden': 'true' }, iconInline(icon)),
|
h('span', { 'aria-hidden': 'true' }, icon),
|
||||||
)
|
)
|
||||||
this.buttons.set(key, btn)
|
this.buttons.set(key, btn)
|
||||||
return btn
|
return btn
|
||||||
|
|||||||
@ -19,8 +19,8 @@ export class BacklogOverviewElement extends LiveElement {
|
|||||||
|
|
||||||
protected update(): void {
|
protected update(): void {
|
||||||
const { data, error } = q.dataset.state
|
const { data, error } = q.dataset.state
|
||||||
const aside = link('/backlog/', glyph('action.open', 'Open the planner'))
|
const aside = link('/backlog/', glyph('➡️', 'Open the planner'))
|
||||||
const icon = 'dash.outlook'
|
const icon = '📚'
|
||||||
if (!data) {
|
if (!data) {
|
||||||
this.replaceChildren(card('Backlog outlook', error ? errorNotice(error) : loading('backlog'), { aside, icon }))
|
this.replaceChildren(card('Backlog outlook', error ? errorNotice(error) : loading('backlog'), { aside, icon }))
|
||||||
return
|
return
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
// Pass 2 wiring for the dashboard, picks, store, setup and library pages:
|
|
||||||
// a ledger word shows right of its icon, a chosen alternative glyph replaces
|
|
||||||
// the default, and the spoken text is unchanged.
|
|
||||||
|
|
||||||
import { screen, waitFor } from '@testing-library/dom'
|
|
||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
import { makeInstalled, makeLibGame, makeStatus } from '../test/fixtures'
|
|
||||||
import { mount, stubApi } from '../test/harness'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import './dashboard'
|
|
||||||
import './library'
|
|
||||||
import './picks'
|
|
||||||
import './setup'
|
|
||||||
import './store'
|
|
||||||
|
|
||||||
const word = (el: Element | null | undefined) => el?.nextElementSibling?.textContent
|
|
||||||
const markOf = (root: ParentNode, id: string) => root.querySelector(`[data-icon="${id}"], [data-icon-word="${id}"]`)
|
|
||||||
|
|
||||||
describe('dashboard icons', () => {
|
|
||||||
it('a fact row paints its icon word and chosen glyph, the label stays spoken', async () => {
|
|
||||||
useIcons({ 'dash.finished': { word: 'trophies', glyph: '🥇' }, 'state.yes': { word: 'yes' } })
|
|
||||||
stubApi({ 'GET /api/status': makeStatus(), 'GET /api/commands': [] })
|
|
||||||
mount('<dashboard-status></dashboard-status>')
|
|
||||||
const label = await screen.findByText('Games finished', { selector: 'dt .sr-only' })
|
|
||||||
const icon = label.closest('dt')?.querySelector('[data-icon="dash.finished"]')
|
|
||||||
expect(icon?.textContent).toBe('🥇')
|
|
||||||
expect(word(icon)).toBe('Trophies')
|
|
||||||
expect(label).toHaveClass('sr-only')
|
|
||||||
const installed = screen.getByText('Installed', { selector: 'dt .sr-only' }).closest('dt')?.nextElementSibling
|
|
||||||
expect(word(installed?.querySelector('[data-icon="state.yes"]'))).toBe('Yes')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the store row and the block countdown use their own icons', async () => {
|
|
||||||
useIcons({ 'dash.store-blocked': { word: 'shut' }, 'dash.block-left': { word: 'left' } })
|
|
||||||
stubApi({
|
|
||||||
'GET /api/status': makeStatus({ total_block: { active: true, days_remaining: 2, until: null } }),
|
|
||||||
'GET /api/commands': [],
|
|
||||||
})
|
|
||||||
const el = mount('<dashboard-status></dashboard-status>')
|
|
||||||
await screen.findAllByText('Store', { selector: 'dt .sr-only' })
|
|
||||||
expect(word(markOf(el, 'dash.store-blocked'))).toBe('Shut')
|
|
||||||
expect(word(markOf(el, 'dash.block-left'))).toBe('Left')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('store notice icon', () => {
|
|
||||||
it('paints the store-lock icon, its word and glyph, the sentence stays spoken', async () => {
|
|
||||||
useIcons({ 'store.blocked': { word: 'sealed', glyph: '🛑' } })
|
|
||||||
stubApi({ 'GET /api/status': makeStatus({ store_blocked: true }) })
|
|
||||||
mount('<store-notice></store-notice>')
|
|
||||||
const notice = await screen.findByRole('status')
|
|
||||||
const icon = markOf(notice, 'store.blocked')
|
|
||||||
expect(icon?.textContent).toBe('🛑')
|
|
||||||
expect(word(icon)).toBe('Sealed')
|
|
||||||
expect(screen.getByText(/Store blocked\./)).toHaveClass('sr-only')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('picks icons', () => {
|
|
||||||
it('a pick row paints the age icon and the kept pin with their words', async () => {
|
|
||||||
const pick = (app_id: number, name: string) => ({ app_id, name, age_days: 3 })
|
|
||||||
useIcons({ 'picks.age': { word: 'picked' }, 'picks.kept': { word: 'kept', glyph: '💚' } })
|
|
||||||
stubApi({
|
|
||||||
'GET /api/status': makeStatus({ manual_picks: [pick(1, 'Celeste')], kept_picks: [pick(2, 'Hades')] }),
|
|
||||||
'GET /api/commands': [],
|
|
||||||
})
|
|
||||||
const el = mount('<manual-picks></manual-picks>')
|
|
||||||
await screen.findByText('Celeste')
|
|
||||||
expect(word(markOf(el, 'picks.age'))).toBe('Picked')
|
|
||||||
const kept = markOf(el, 'picks.kept')
|
|
||||||
expect(kept?.textContent).toBe('💚')
|
|
||||||
expect(word(kept)).toBe('Kept')
|
|
||||||
expect(screen.getByText('· picked 3 d ago · 1')).toHaveClass('sr-only')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('setup icons', () => {
|
|
||||||
it('the field icons and the stored-key placeholder follow the ledger', async () => {
|
|
||||||
useIcons({ 'setup.api-key': { word: 'key' }, 'setup.key-stored': { word: 'stored', glyph: '🔐' } })
|
|
||||||
stubApi({ 'GET /api/setup': { configured: true, has_api_key: true, steam_id: '76561198000000000' } })
|
|
||||||
const el = mount('<setup-form></setup-form>')
|
|
||||||
expect(word(markOf(el, 'setup.api-key'))).toBe('Key')
|
|
||||||
expect(screen.getByLabelText<HTMLInputElement>('Steam Web API key')).toBeInTheDocument()
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByLabelText<HTMLInputElement>('Steam Web API key').placeholder).toBe(`🔐 Stored ${'•'.repeat(32)}`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('library page icons', () => {
|
|
||||||
it('the installed table headers and the view switch paint their words', async () => {
|
|
||||||
useIcons({ 'libpage.size': { word: 'space', glyph: '📏' }, 'libpage.all': { word: 'covers' } })
|
|
||||||
stubApi({
|
|
||||||
'GET /api/library': { games: [makeLibGame({ app_id: 1, name: 'Hollow Knight' })] },
|
|
||||||
'GET /api/installed': { games: [makeInstalled({ app_id: 5, name: 'Portal' })] },
|
|
||||||
'GET /api/commands': [],
|
|
||||||
})
|
|
||||||
mount('<library-view></library-view>')
|
|
||||||
const th = (await screen.findByText('Size', { selector: 'th .sr-only' })).closest('th')
|
|
||||||
expect(th?.querySelector('[data-icon="libpage.size"]')?.textContent).toBe('📏')
|
|
||||||
expect(word(th?.querySelector('[data-icon="libpage.size"]'))).toBe('Space')
|
|
||||||
expect(screen.getByRole('button', { name: 'All games' })).toHaveTextContent('Covers')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -3,13 +3,12 @@
|
|||||||
|
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { commandButton } from '../commands/commandButton'
|
import { commandButton } from '../commands/commandButton'
|
||||||
import { iconInline } from '../icons/render'
|
import { define, h } from '../lib/dom'
|
||||||
import { define, h, type Child } from '../lib/dom'
|
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
import { card, empty, errorNotice, loading } from '../ui/build'
|
import { card, empty, errorNotice, loading } from '../ui/build'
|
||||||
|
|
||||||
/** Glyphs and numbers painted, the sentence spoken. */
|
/** Glyphs and numbers painted, the sentence spoken. */
|
||||||
function glyphText(painted: readonly Child[], spoken: string): HTMLSpanElement {
|
function glyphText(painted: string, spoken: string): HTMLSpanElement {
|
||||||
return h('span', { class: 'muted' }, h('span', { 'aria-hidden': 'true' }, painted), h('span', { class: 'sr-only' }, spoken))
|
return h('span', { class: 'muted' }, h('span', { 'aria-hidden': 'true' }, painted), h('span', { class: 'sr-only' }, spoken))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ export class ManualPicksElement extends LiveElement {
|
|||||||
{ class: 'grow' },
|
{ class: 'grow' },
|
||||||
h('strong', {}, p.name),
|
h('strong', {}, p.name),
|
||||||
' ',
|
' ',
|
||||||
glyphText(['· ', iconInline('picks.age'), ` ${p.age_days} d · ${p.app_id}`], `· picked ${p.age_days} d ago · ${p.app_id}`),
|
glyphText(`· 🕐 ${p.age_days} d · ${p.app_id}`, `· picked ${p.age_days} d ago · ${p.app_id}`),
|
||||||
),
|
),
|
||||||
abandon(p.app_id),
|
abandon(p.app_id),
|
||||||
),
|
),
|
||||||
@ -62,7 +61,7 @@ export class ManualPicksElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'li',
|
'li',
|
||||||
{ class: 'row' },
|
{ class: 'row' },
|
||||||
h('span', { class: 'grow' }, h('strong', {}, p.name), ' ', glyphText(['· ', iconInline('picks.kept'), ' ', iconInline('state.unlocked'), ` · ${p.app_id}`], `· kept · no lock · ${p.app_id}`)),
|
h('span', { class: 'grow' }, h('strong', {}, p.name), ' ', glyphText(`· 📌 🔓 · ${p.app_id}`, `· kept · no lock · ${p.app_id}`)),
|
||||||
abandon(p.app_id),
|
abandon(p.app_id),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -70,7 +69,7 @@ export class ManualPicksElement extends LiveElement {
|
|||||||
none
|
none
|
||||||
? h('div', { class: 'actions' }, commandButton({ name: 'abandon-pick', label: 'Abandon a pick by app id…' }))
|
? h('div', { class: 'actions' }, commandButton({ name: 'abandon-pick', label: 'Abandon a pick by app id…' }))
|
||||||
: null,
|
: null,
|
||||||
], { icon: 'picks.manual' }),
|
], { icon: '📌' }),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,6 @@
|
|||||||
import { api } from '../api/client'
|
import { api } from '../api/client'
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { Action } from '../lib/action'
|
import { Action } from '../lib/action'
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { iconFor, iconInline } from '../icons/render'
|
|
||||||
import { append, define, h, type Child } from '../lib/dom'
|
import { append, define, h, type Child } from '../lib/dom'
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
import { invalidateAll } from '../lib/query'
|
import { invalidateAll } from '../lib/query'
|
||||||
@ -29,9 +27,9 @@ export function idError(id: string): string | null {
|
|||||||
return ID_RE.test(id.trim()) ? null : 'A SteamID64 is 17 digits and starts with 7656.'
|
return ID_RE.test(id.trim()) ? null : 'A SteamID64 is 17 digits and starts with 7656.'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Textgate: help is a link icon to where the value comes from; its sentence is spoken only.
|
// Textgate: help is a 🔗 to where the value comes from; its sentence is spoken only.
|
||||||
const helpLink = (href: string, spoken: string, sentence: string): Child[] => [
|
const helpLink = (href: string, spoken: string, sentence: string): Child[] => [
|
||||||
h('a', { href, target: '_blank', rel: 'noreferrer', class: 'setup-link', 'aria-label': spoken }, iconInline('setup.help')),
|
h('a', { href, target: '_blank', rel: 'noreferrer', class: 'setup-link', 'aria-label': spoken }, '🔗'),
|
||||||
h('span', { class: 'sr-only' }, sentence),
|
h('span', { class: 'sr-only' }, sentence),
|
||||||
]
|
]
|
||||||
const KEY_HELP = (): Child[] =>
|
const KEY_HELP = (): Child[] =>
|
||||||
@ -40,24 +38,19 @@ const ID_HELP = (): Child[] => helpLink('https://steamid.io', 'steamid.io', 'You
|
|||||||
|
|
||||||
/** Placeholders paint the expected shape: one dot per character, the fixed 7656 prefix. */
|
/** Placeholders paint the expected shape: one dot per character, the fixed 7656 prefix. */
|
||||||
const KEY_SHAPE = '·'.repeat(32)
|
const KEY_SHAPE = '·'.repeat(32)
|
||||||
|
const KEY_STORED = `🔒 ${'•'.repeat(32)}`
|
||||||
const ID_SHAPE = `7656${'·'.repeat(13)}`
|
const ID_SHAPE = `7656${'·'.repeat(13)}`
|
||||||
|
|
||||||
/** A placeholder is plain text: the stored-key icon (and its word, if any) then filled dots. */
|
|
||||||
function keyStored(): string {
|
|
||||||
const { glyph: mark, word } = iconFor('setup.key-stored')
|
|
||||||
return `${mark}${word ? ` ${word}` : ''} ${'•'.repeat(32)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Field {
|
interface Field {
|
||||||
input: HTMLInputElement
|
input: HTMLInputElement
|
||||||
help: HTMLParagraphElement
|
help: HTMLParagraphElement
|
||||||
hint: () => Child[]
|
hint: () => Child[]
|
||||||
baseClass: string
|
baseClass: string
|
||||||
/** Characters a valid value has; a bad value paints the warning icon and `typed/want`. */
|
/** Characters a valid value has; a bad value paints `⚠️ typed/want`. */
|
||||||
want: number
|
want: number
|
||||||
}
|
}
|
||||||
|
|
||||||
function field(id: string, label: string, icon: IconId, input: HTMLInputElement, hint: () => Child[], want: number): { el: HTMLDivElement; f: Field } {
|
function field(id: string, label: string, icon: string, input: HTMLInputElement, hint: () => Child[], want: number): { el: HTMLDivElement; f: Field } {
|
||||||
const help = h('p', { id: `${id}-help`, class: 'field-help' }, hint())
|
const help = h('p', { id: `${id}-help`, class: 'field-help' }, hint())
|
||||||
input.id = id
|
input.id = id
|
||||||
input.setAttribute('aria-describedby', `${id}-help`)
|
input.setAttribute('aria-describedby', `${id}-help`)
|
||||||
@ -66,7 +59,7 @@ function field(id: string, label: string, icon: IconId, input: HTMLInputElement,
|
|||||||
'div',
|
'div',
|
||||||
{ class: 'form-field' },
|
{ class: 'form-field' },
|
||||||
// The glyph is painted beside a spoken-only <label>, so the label's text stays exactly `label`.
|
// The glyph is painted beside a spoken-only <label>, so the label's text stays exactly `label`.
|
||||||
h('span', { class: 'field-label', 'aria-hidden': 'true' }, iconInline(icon)),
|
h('span', { class: 'field-label', 'aria-hidden': 'true' }, icon),
|
||||||
h('label', { for: id, class: 'sr-only' }, label),
|
h('label', { for: id, class: 'sr-only' }, label),
|
||||||
input,
|
input,
|
||||||
help,
|
help,
|
||||||
@ -99,7 +92,7 @@ export class SetupFormElement extends LiveElement {
|
|||||||
const key = field(
|
const key = field(
|
||||||
'setup-key',
|
'setup-key',
|
||||||
'Steam Web API key',
|
'Steam Web API key',
|
||||||
'setup.api-key',
|
'🔑',
|
||||||
h('input', { class: 'input mono', type: 'password', autocomplete: 'off', spellcheck: 'false', autofocus: true }),
|
h('input', { class: 'input mono', type: 'password', autocomplete: 'off', spellcheck: 'false', autofocus: true }),
|
||||||
KEY_HELP,
|
KEY_HELP,
|
||||||
32,
|
32,
|
||||||
@ -107,7 +100,7 @@ export class SetupFormElement extends LiveElement {
|
|||||||
const id = field(
|
const id = field(
|
||||||
'setup-id',
|
'setup-id',
|
||||||
'SteamID64',
|
'SteamID64',
|
||||||
'setup.steam-id',
|
'🆔',
|
||||||
h('input', { class: 'input mono input-num', inputmode: 'numeric', placeholder: ID_SHAPE }),
|
h('input', { class: 'input mono input-num', inputmode: 'numeric', placeholder: ID_SHAPE }),
|
||||||
ID_HELP,
|
ID_HELP,
|
||||||
17,
|
17,
|
||||||
@ -156,8 +149,8 @@ export class SetupFormElement extends LiveElement {
|
|||||||
? [notice('warning', null, spoken('Not configured yet', 'Every other screen needs these two values first.'))]
|
? [notice('warning', null, spoken('Not configured yet', 'Every other screen needs these two values first.'))]
|
||||||
: []),
|
: []),
|
||||||
)
|
)
|
||||||
// Lock icon + filled dots: a key is stored (typing replaces it); hollow dots: none yet.
|
// 🔒 + filled dots: a key is stored (typing replaces it); hollow dots: none yet.
|
||||||
this.keyField.input.placeholder = data?.has_api_key ? keyStored() : KEY_SHAPE
|
this.keyField.input.placeholder = data?.has_api_key ? KEY_STORED : KEY_SHAPE
|
||||||
this.keyField.input.dataset.stored = String(data?.has_api_key ?? false)
|
this.keyField.input.dataset.stored = String(data?.has_api_key ?? false)
|
||||||
if (!this.idEdited) this.idField.input.value = data?.steam_id ?? ''
|
if (!this.idEdited) this.idField.input.value = data?.steam_id ?? ''
|
||||||
this.render()
|
this.render()
|
||||||
@ -174,30 +167,30 @@ export class SetupFormElement extends LiveElement {
|
|||||||
'success',
|
'success',
|
||||||
null,
|
null,
|
||||||
spoken('Saved', 'Steam accepted the key.'),
|
spoken('Saved', 'Steam accepted the key.'),
|
||||||
h('a', { href: '/', class: 'btn btn-ghost btn-small', 'aria-label': 'Go to the dashboard' }, iconInline('nav.dashboard')),
|
h('a', { href: '/', class: 'btn btn-ghost btn-small', 'aria-label': 'Go to the dashboard' }, '🏠'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
)
|
)
|
||||||
this.failure.replaceChildren(...(this.save.error ? [errorNotice(this.save.error)] : []))
|
this.failure.replaceChildren(...(this.save.error ? [errorNotice(this.save.error)] : []))
|
||||||
this.submit.disabled = this.save.pending
|
this.submit.disabled = this.save.pending
|
||||||
// The busy icon while Steam checks, the confirm icon to save; the words are spoken only.
|
// ⏳ while Steam checks, ✔️ to save; the words are spoken only.
|
||||||
this.submit.replaceChildren(this.save.pending ? glyph('state.wait', 'Checking with Steam…') : glyph('action.confirm', 'Save and verify'))
|
this.submit.replaceChildren(this.save.pending ? glyph('⏳', 'Checking with Steam…') : glyph('✔️', 'Save and verify'))
|
||||||
}
|
}
|
||||||
|
|
||||||
private mark(f: Field, problem: string | null): void {
|
private mark(f: Field, problem: string | null): void {
|
||||||
const bad = this.touched && problem !== null
|
const bad = this.touched && problem !== null
|
||||||
f.input.className = bad ? `${f.baseClass} input-bad` : f.baseClass
|
f.input.className = bad ? `${f.baseClass} input-bad` : f.baseClass
|
||||||
f.input.setAttribute('aria-invalid', String(bad))
|
f.input.setAttribute('aria-invalid', String(bad))
|
||||||
// A bad value paints the warning icon and how many characters it has of the `want` it needs.
|
// A bad value paints ⚠️ and how many characters it has of the `want` it needs.
|
||||||
const count = `${f.input.value.trim().length}/${f.want}`
|
const count = `⚠️ ${f.input.value.trim().length}/${f.want}`
|
||||||
const state = bad ? `${problem}|${count}` : 'ok'
|
const state = bad ? `${problem}|${count}` : 'ok'
|
||||||
if (f.help.dataset.state === state) return
|
if (f.help.dataset.state === state) return
|
||||||
f.help.dataset.state = state
|
f.help.dataset.state = state
|
||||||
f.help.dataset.bad = String(bad)
|
f.help.dataset.bad = String(bad)
|
||||||
f.help.className = bad ? 'field-help text-danger' : 'field-help'
|
f.help.className = bad ? 'field-help text-danger' : 'field-help'
|
||||||
f.help.replaceChildren()
|
f.help.replaceChildren()
|
||||||
append(f.help, bad ? [h('span', { 'aria-hidden': 'true', class: 'mono' }, iconInline('state.warn'), ` ${count}`), h('span', { class: 'sr-only' }, problem)] : f.hint())
|
append(f.help, bad ? [h('span', { 'aria-hidden': 'true', class: 'mono' }, count), h('span', { class: 'sr-only' }, problem)] : f.hint())
|
||||||
}
|
}
|
||||||
|
|
||||||
private async store(): Promise<void> {
|
private async store(): Promise<void> {
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
// right now. Nothing shows until the status is known.
|
// right now. Nothing shows until the status is known.
|
||||||
|
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { define, h } from '../lib/dom'
|
import { define, h } from '../lib/dom'
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
import { notice } from '../ui/build'
|
import { notice } from '../ui/build'
|
||||||
@ -18,11 +17,11 @@ export class StoreNoticeElement extends LiveElement {
|
|||||||
this.replaceChildren()
|
this.replaceChildren()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Textgate: the store + lock state icon painted (tone is the 2nd channel), the sentence spoken.
|
// Textgate: 🛒 + lock state painted (tone is the 2nd channel), the sentence spoken.
|
||||||
const [tone, icon, spoken] = data.store_blocked
|
const [tone, icon, spoken] = data.store_blocked
|
||||||
? (['info', 'store.blocked', 'Store blocked. Unblocking takes a typed phrase and is capped at 30 minutes.'] as const)
|
? (['info', '🛒🔒', 'Store blocked. Unblocking takes a typed phrase and is capped at 30 minutes.'] as const)
|
||||||
: (['warning', 'store.open', 'Store unblocked. The store is open right now; it re-blocks automatically.'] as const)
|
: (['warning', '🛒🔓', 'Store unblocked. The store is open right now; it re-blocks automatically.'] as const)
|
||||||
const el = notice(tone, null, h('span', { 'aria-hidden': 'true' }, iconInline(icon)), h('span', { class: 'sr-only' }, spoken))
|
const el = notice(tone, null, h('span', { 'aria-hidden': 'true' }, icon), h('span', { class: 'sr-only' }, spoken))
|
||||||
el.dataset.blocked = String(data.store_blocked)
|
el.dataset.blocked = String(data.store_blocked)
|
||||||
this.replaceChildren(el)
|
this.replaceChildren(el)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,8 +8,6 @@ import { explain } from '../../api/errors'
|
|||||||
import type { StateBackup } from '../../api/contract'
|
import type { StateBackup } from '../../api/contract'
|
||||||
import type { Job } from '../../api/jobContract'
|
import type { Job } from '../../api/jobContract'
|
||||||
import { q } from '../../api/queries'
|
import { q } from '../../api/queries'
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import { phraseMatches } from '../../commands/catalog'
|
import { phraseMatches } from '../../commands/catalog'
|
||||||
import '../../commands/commandButton'
|
import '../../commands/commandButton'
|
||||||
import { PhraseField } from '../../commands/phraseField'
|
import { PhraseField } from '../../commands/phraseField'
|
||||||
@ -26,9 +24,8 @@ import { bytes, dateTime } from '../../ui/format'
|
|||||||
export const restorePhrase = (id: string): string => `restore backup ${id}`
|
export const restorePhrase = (id: string): string => `restore backup ${id}`
|
||||||
|
|
||||||
/** Why a backup was taken, as a glyph (reason words spoken only). */
|
/** Why a backup was taken, as a glyph (reason words spoken only). */
|
||||||
const REASON_ICON: Readonly<Partial<Record<string, IconId>>> = { 'before reset': 'backup.reason.reset', nightly: 'backup.reason.nightly' }
|
const REASON_ICON: Record<string, string> = { 'before reset': '♻️', nightly: '🌙' }
|
||||||
const reasonIcon = (reason: string): IconId => REASON_ICON[reason] ?? 'backup.reason.other'
|
const reasonGlyph = (reason: string): HTMLSpanElement => glyph(REASON_ICON[reason] ?? '🗄️', reason)
|
||||||
const reasonGlyph = (reason: string): HTMLSpanElement => glyph(reasonIcon(reason), reason)
|
|
||||||
|
|
||||||
/** One restore: phrase form, then the job it started. */
|
/** One restore: phrase form, then the job it started. */
|
||||||
export class RestoreDialog {
|
export class RestoreDialog {
|
||||||
@ -69,8 +66,8 @@ export class RestoreDialog {
|
|||||||
'p',
|
'p',
|
||||||
{ class: 'm0 row' },
|
{ class: 'm0 row' },
|
||||||
h('span', { class: 'sr-only' }, `Replaces the current state with the backup from ${dateTime(backup.created_at)} (${backup.reason}).`),
|
h('span', { class: 'sr-only' }, `Replaces the current state with the backup from ${dateTime(backup.created_at)} (${backup.reason}).`),
|
||||||
h('span', { 'aria-hidden': 'true', class: 'mono' }, iconInline('backup.item'), ` ${backup.id} · ${dateTime(backup.created_at)}`),
|
h('span', { 'aria-hidden': 'true', class: 'mono' }, `🗄️ ${backup.id} · ${dateTime(backup.created_at)}`),
|
||||||
h('span', { 'aria-hidden': 'true' }, iconInline(reasonIcon(backup.reason))),
|
h('span', { 'aria-hidden': 'true' }, REASON_ICON[backup.reason] ?? '🗄️'),
|
||||||
),
|
),
|
||||||
this.field.el,
|
this.field.el,
|
||||||
this.failure,
|
this.failure,
|
||||||
@ -78,7 +75,7 @@ export class RestoreDialog {
|
|||||||
'div',
|
'div',
|
||||||
{ class: 'actions' },
|
{ class: 'actions' },
|
||||||
this.submit,
|
this.submit,
|
||||||
h('button', { type: 'button', class: 'btn btn-ghost', onclick: onClose }, glyph('action.cancel', 'Cancel')),
|
h('button', { type: 'button', class: 'btn btn-ghost', onclick: onClose }, glyph('✖️', 'Cancel')),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
this.modal.render(form)
|
this.modal.render(form)
|
||||||
@ -91,7 +88,7 @@ export class RestoreDialog {
|
|||||||
|
|
||||||
private sync(): void {
|
private sync(): void {
|
||||||
this.submit.disabled = !this.matches() || this.restore.pending
|
this.submit.disabled = !this.matches() || this.restore.pending
|
||||||
this.submit.replaceChildren(this.restore.pending ? glyph('state.wait', 'Restoring…') : glyph('backup.restore', 'Restore'))
|
this.submit.replaceChildren(this.restore.pending ? glyph('⏳', 'Restoring…') : glyph('⏮️', 'Restore'))
|
||||||
this.failure.replaceChildren(...(this.restore.error ? [errorNotice(this.restore.error)] : []))
|
this.failure.replaceChildren(...(this.restore.error ? [errorNotice(this.restore.error)] : []))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +101,7 @@ export class RestoreDialog {
|
|||||||
'div',
|
'div',
|
||||||
{ class: 'stack' },
|
{ class: 'stack' },
|
||||||
hx('job-progress', { 'job-id': out.value.id }),
|
hx('job-progress', { 'job-id': out.value.id }),
|
||||||
h('div', { class: 'actions' }, h('button', { type: 'button', class: 'btn btn-ghost', onclick: onClose }, glyph('action.cancel', 'Close'))),
|
h('div', { class: 'actions' }, h('button', { type: 'button', class: 'btn btn-ghost', onclick: onClose }, glyph('✖️', 'Close'))),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
this.modal.focusFirst()
|
this.modal.focusFirst()
|
||||||
@ -117,7 +114,7 @@ export class BackupsCardElement extends LiveElement {
|
|||||||
private readonly root = card(
|
private readonly root = card(
|
||||||
'State backups',
|
'State backups',
|
||||||
[h('p', { class: 'sr-only' }, 'Reset takes a timestamped backup first, so it can be undone here.'), this.status, this.list],
|
[h('p', { class: 'sr-only' }, 'Reset takes a timestamped backup first, so it can be undone here.'), this.status, this.list],
|
||||||
{ aside: hx('command-button', { name: 'reset', label: 'Reset all state…' }), icon: 'backup.item' },
|
{ aside: hx('command-button', { name: 'reset', label: 'Reset all state…' }), icon: '🗄️' },
|
||||||
)
|
)
|
||||||
private dialog: RestoreDialog | null = null
|
private dialog: RestoreDialog | null = null
|
||||||
private shownKey = ''
|
private shownKey = ''
|
||||||
@ -164,7 +161,7 @@ export class BackupsCardElement extends LiveElement {
|
|||||||
this.open(b)
|
this.open(b)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
glyph('backup.restore', 'Restore…'),
|
glyph('⏮️', 'Restore…'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
// focus from a button or yanks the journal while it is being read.
|
// focus from a button or yanks the journal while it is being read.
|
||||||
|
|
||||||
import { q } from '../../api/queries'
|
import { q } from '../../api/queries'
|
||||||
import type { IconId } from '../../icons/registry'
|
|
||||||
import { iconInline } from '../../icons/render'
|
|
||||||
import { define, h } from '../../lib/dom'
|
import { define, h } from '../../lib/dom'
|
||||||
import { LiveElement } from '../../lib/element'
|
import { LiveElement } from '../../lib/element'
|
||||||
import { runner } from '../../lib/runner'
|
import { runner } from '../../lib/runner'
|
||||||
@ -27,11 +25,7 @@ export function restartWaitMs(availableAt: string | null, now: number = Date.now
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Daemon state: glyph painted, the state word spoken. */
|
/** Daemon state: glyph painted, the state word spoken. */
|
||||||
const STATE_ICON = {
|
const STATE_ICON: Record<DaemonState, string> = { running: '🟢', restarting: '🔄', unreachable: '🔴' }
|
||||||
running: 'daemon.running',
|
|
||||||
restarting: 'daemon.restarting',
|
|
||||||
unreachable: 'daemon.unreachable',
|
|
||||||
} as const satisfies Record<DaemonState, IconId>
|
|
||||||
|
|
||||||
function unreachableNotice(): HTMLDivElement {
|
function unreachableNotice(): HTMLDivElement {
|
||||||
// Textgate: ⛔ + the command to run are painted; the explanation is spoken only.
|
// Textgate: ⛔ + the command to run are painted; the explanation is spoken only.
|
||||||
@ -72,16 +66,16 @@ export class DaemonCardElement extends LiveElement {
|
|||||||
runner.run('enforce', { demo: 1 })
|
runner.run('enforce', { demo: 1 })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
glyph('daemon.demo_run', 'Demo run (enforce --demo)…'),
|
glyph('🧪', 'Demo run (enforce --demo)…'),
|
||||||
)
|
)
|
||||||
private readonly parts = [
|
private readonly parts = [
|
||||||
this.alert,
|
this.alert,
|
||||||
this.factsSlot,
|
this.factsSlot,
|
||||||
h('div', { class: 'actions' }, this.restart, this.demo),
|
h('div', { class: 'actions' }, this.restart, this.demo),
|
||||||
h('h3', { class: 'h3' }, glyph('daemon.journal', 'Journal')),
|
h('h3', { class: 'h3' }, glyph('📜', 'Journal')),
|
||||||
this.journal,
|
this.journal,
|
||||||
]
|
]
|
||||||
private readonly root = card('Enforcer daemon', [this.status, this.body], { icon: 'daemon.heading' })
|
private readonly root = card('Enforcer daemon', [this.status, this.body], { icon: '🛡️' })
|
||||||
private shown = false
|
private shown = false
|
||||||
private canRestart = false
|
private canRestart = false
|
||||||
private unreachable = false
|
private unreachable = false
|
||||||
@ -110,19 +104,19 @@ export class DaemonCardElement extends LiveElement {
|
|||||||
}
|
}
|
||||||
this.factsSlot.replaceChildren(
|
this.factsSlot.replaceChildren(
|
||||||
facts([
|
facts([
|
||||||
[glyph('daemon.state', 'State'), h('span', { 'data-state': data.state }, glyph(STATE_ICON[data.state], data.state))],
|
[glyph('📡', 'State'), h('span', { 'data-state': data.state }, glyph(STATE_ICON[data.state], data.state))],
|
||||||
[glyph('daemon.pid', 'PID'), data.pid ?? '—'],
|
[glyph('#️⃣', 'PID'), data.pid ?? '—'],
|
||||||
[glyph('daemon.up_since', 'Up since'), data.started_at ? since(data.started_at) : '—'],
|
[glyph('⏱️', 'Up since'), data.started_at ? since(data.started_at) : '—'],
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
this.canRestart = waitMs === 0 && data.state === 'running'
|
this.canRestart = waitMs === 0 && data.state === 'running'
|
||||||
this.restart.setAttribute('aria-disabled', String(!this.canRestart))
|
this.restart.setAttribute('aria-disabled', String(!this.canRestart))
|
||||||
// Rate limited: the busy icon + the clock counting down; free: the restart icon. Words spoken only.
|
// Rate limited: ⏳ + the clock counting down; free: 🔄. Words spoken only.
|
||||||
const wait = clock(waitMs / 1000)
|
const wait = clock(waitMs / 1000)
|
||||||
this.restart.replaceChildren(
|
this.restart.replaceChildren(
|
||||||
waitMs > 0
|
waitMs > 0
|
||||||
? h('span', { 'aria-label': `Restart available in ${wait}` }, h('span', { 'aria-hidden': 'true' }, iconInline('state.wait'), ` ${wait}`))
|
? h('span', { 'aria-label': `Restart available in ${wait}` }, h('span', { 'aria-hidden': 'true' }, `⏳ ${wait}`))
|
||||||
: glyph('daemon.restart', 'Restart daemon…'),
|
: glyph('🔄', 'Restart daemon…'),
|
||||||
)
|
)
|
||||||
this.fillJournal(data.journal_tail)
|
this.fillJournal(data.journal_tail)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
// The system page paints every icon through the registry: the user's word
|
|
||||||
// shows right of the icon, a chosen alternative glyph replaces the default,
|
|
||||||
// and the spoken names stay as they were.
|
|
||||||
|
|
||||||
import { screen, waitFor } from '@testing-library/dom'
|
|
||||||
import { beforeEach, describe, expect, it } from 'vitest'
|
|
||||||
import type { DaemonStatus } from '../../api/contract'
|
|
||||||
import { makeSpec } from '../../test/fixtures'
|
|
||||||
import { installEventSource, mount, stubApi } from '../../test/harness'
|
|
||||||
import { useIcons } from '../../test/iconLedger'
|
|
||||||
import './backupsCard'
|
|
||||||
import './daemonCard'
|
|
||||||
import './serverCard'
|
|
||||||
import './setupCard'
|
|
||||||
|
|
||||||
const daemon = (over: Partial<DaemonStatus> = {}): DaemonStatus => ({
|
|
||||||
state: 'running',
|
|
||||||
started_at: '2026-10-10T10:00:00Z',
|
|
||||||
pid: 4242,
|
|
||||||
journal_tail: [],
|
|
||||||
restart_available_at: null,
|
|
||||||
...over,
|
|
||||||
})
|
|
||||||
const words = (root: Element) => [...root.querySelectorAll('.icon-word')].map((w) => w.textContent)
|
|
||||||
const marks = (root: Element) => [...root.querySelectorAll('[data-icon]')].map((m) => m.textContent)
|
|
||||||
|
|
||||||
beforeEach(installEventSource)
|
|
||||||
|
|
||||||
describe('system page icons', () => {
|
|
||||||
it('daemon card: state, pid and restart icons carry words and glyphs, names spoken', async () => {
|
|
||||||
useIcons({ 'daemon.running': { word: 'alive', glyph: '💚' }, 'daemon.pid': { word: 'process' }, 'daemon.restart': { word: 'restart' } })
|
|
||||||
stubApi({ 'GET /api/daemon': daemon() })
|
|
||||||
const el = mount('<daemon-card></daemon-card>')
|
|
||||||
await screen.findByText('4242')
|
|
||||||
expect(words(el)).toEqual(expect.arrayContaining(['Alive', 'Process', 'Restart']))
|
|
||||||
expect(marks(el)).toContain('💚')
|
|
||||||
expect(screen.getByText('PID')).toHaveClass('sr-only')
|
|
||||||
expect(screen.getByRole('button', { name: /Restart daemon/ })).toBeInTheDocument()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('daemon card: the rate-limit countdown keeps the busy icon and its word', async () => {
|
|
||||||
useIcons({ 'state.wait': { word: 'busy' } })
|
|
||||||
const later = new Date(Date.now() + 90_000).toISOString()
|
|
||||||
stubApi({ 'GET /api/daemon': daemon({ restart_available_at: later }) })
|
|
||||||
const el = mount('<daemon-card></daemon-card>')
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(words(el)).toEqual(['Busy'])
|
|
||||||
})
|
|
||||||
expect(screen.getByLabelText(/Restart available in/)).toBeInTheDocument()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('server card: version, code state and restart carry the chosen icons', async () => {
|
|
||||||
useIcons({ 'server.version': { word: 'build' }, 'state.yes': { word: 'fresh' }, 'server.restart': { glyph: '🚀' } })
|
|
||||||
stubApi({ 'GET /api/server': { stale: false, started_at: '2026-10-10T10:00:00Z', version: '9.9.9' } })
|
|
||||||
const el = mount('<server-card></server-card>')
|
|
||||||
await screen.findByText('9.9.9')
|
|
||||||
expect(words(el)).toEqual(['Build', 'Fresh'])
|
|
||||||
expect(screen.getByRole('button', { name: 'Restart server' }).querySelector('[data-icon]')?.textContent).toBe('🚀')
|
|
||||||
expect(screen.getByText('current')).toHaveClass('sr-only')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('backups card: reason, restore and cancel icons go through the registry', async () => {
|
|
||||||
useIcons({ 'backup.reason.reset': { word: 'wipe' }, 'backup.restore': { glyph: '⏪' }, 'action.cancel': { word: 'cancel' } })
|
|
||||||
stubApi({
|
|
||||||
'GET /api/backups': [{ id: '20261010-100000', created_at: '2026-10-10T10:00:00Z', reason: 'before reset', size_bytes: 2048 }],
|
|
||||||
'GET /api/commands': [makeSpec('reset')],
|
|
||||||
'GET /api/jobs': [],
|
|
||||||
})
|
|
||||||
const el = mount('<backups-card></backups-card>')
|
|
||||||
await screen.findByText('20261010-100000')
|
|
||||||
expect(words(el)).toEqual(['Wipe'])
|
|
||||||
expect(screen.getByRole('button', { name: 'Restore…' }).querySelector('[data-icon]')?.textContent).toBe('⏪')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('setup card: key, stored and edit icons carry the words, sentences stay spoken', async () => {
|
|
||||||
useIcons({ 'setup.api-key': { word: 'key' }, 'setup.key-stored': { word: 'safe' },'syssetup.edit': { glyph: '📝' } })
|
|
||||||
stubApi({ 'GET /api/setup': { configured: true, has_api_key: true, steam_id: '7656119800000000' } })
|
|
||||||
const el = mount('<setup-card></setup-card>')
|
|
||||||
await screen.findByText('Stored (never shown)')
|
|
||||||
expect(words(el)).toEqual(['Key', 'Safe'])
|
|
||||||
expect(screen.getByRole('link', { name: 'Open setup' }).querySelector('[data-icon]')?.textContent).toBe('📝')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -19,7 +19,7 @@ export class ServerCardElement extends LiveElement {
|
|||||||
void this.restart.action.run()
|
void this.restart.action.run()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
private readonly root = card('Web server', [this.info, this.failure, h('div', { class: 'actions' }, this.button)], { icon: 'server.heading' })
|
private readonly root = card('Web server', [this.info, this.failure, h('div', { class: 'actions' }, this.button)], { icon: '🌐' })
|
||||||
private readonly restart = new ServerRestart(() => {
|
private readonly restart = new ServerRestart(() => {
|
||||||
this.update()
|
this.update()
|
||||||
})
|
})
|
||||||
@ -41,9 +41,9 @@ export class ServerCardElement extends LiveElement {
|
|||||||
...(data
|
...(data
|
||||||
? [
|
? [
|
||||||
facts([
|
facts([
|
||||||
[glyph('server.version', 'Version'), h('span', { class: 'mono' }, data.version)],
|
[glyph('🏷️', 'Version'), h('span', { class: 'mono' }, data.version)],
|
||||||
[glyph('server.started', 'Started'), h('span', { 'aria-label': `${dateTime(data.started_at)} (${ago(data.started_at)})` }, dateTime(data.started_at))],
|
[glyph('🕒', 'Started'), h('span', { 'aria-label': `${dateTime(data.started_at)} (${ago(data.started_at)})` }, dateTime(data.started_at))],
|
||||||
[glyph('server.code', 'Code'), data.stale ? glyph('state.warn', 'stale') : glyph('state.yes', 'current')],
|
[glyph('💾', 'Code'), data.stale ? glyph('⚠️', 'stale') : glyph('✅', 'current')],
|
||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
@ -52,7 +52,7 @@ export class ServerCardElement extends LiveElement {
|
|||||||
this.failure.replaceChildren(...(action.error ? [errorNotice(action.error)] : []))
|
this.failure.replaceChildren(...(action.error ? [errorNotice(action.error)] : []))
|
||||||
this.button.disabled = restarting || action.pending
|
this.button.disabled = restarting || action.pending
|
||||||
this.button.dataset.restarting = String(restarting)
|
this.button.dataset.restarting = String(restarting)
|
||||||
this.button.replaceChildren(restarting ? glyph('state.wait', 'Restarting… the page reloads when it is back') : glyph('server.restart', 'Restart server'))
|
this.button.replaceChildren(restarting ? glyph('⏳', 'Restarting… the page reloads when it is back') : glyph('🔄', 'Restart server'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,11 +18,11 @@ export class SetupCardElement extends LiveElement {
|
|||||||
card(
|
card(
|
||||||
'Setup',
|
'Setup',
|
||||||
facts([
|
facts([
|
||||||
[glyph('syssetup.configured', 'Configured'), data ? (data.configured ? glyph('state.yes', 'Yes') : glyph('state.no', 'No')) : '…'],
|
[glyph('⚙️', 'Configured'), data ? (data.configured ? glyph('✅', 'Yes') : glyph('❌', 'No')) : '…'],
|
||||||
[glyph('setup.api-key', 'Steam API key'), data ? (data.has_api_key ? glyph('setup.key-stored','Stored (never shown)') : glyph('state.no', 'Missing')) : '…'],
|
[glyph('🔑', 'Steam API key'), data ? (data.has_api_key ? glyph('🔒', 'Stored (never shown)') : glyph('❌', 'Missing')) : '…'],
|
||||||
[glyph('setup.steam-id', 'Steam ID'), h('span', { class: 'mono' }, data?.steam_id ?? '—')],
|
[glyph('🆔', 'Steam ID'), h('span', { class: 'mono' }, data?.steam_id ?? '—')],
|
||||||
]),
|
]),
|
||||||
{ aside: link(pageHref('/setup'), glyph('syssetup.edit', 'Open setup')), icon: 'cmd.setup' },
|
{ aside: link(pageHref('/setup'), glyph('✏️', 'Open setup')), icon: '🔧' },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,53 +0,0 @@
|
|||||||
// Pass-2 icon wiring for the health badges and the stale banner: subject and
|
|
||||||
// state are separate ids, the user's words show right of them, the spoken
|
|
||||||
// text (pill text, aria-label) stays.
|
|
||||||
|
|
||||||
import { describe, expect, it, vi } from 'vitest'
|
|
||||||
import { button } from '../test/events'
|
|
||||||
import { mount, stubApi } from '../test/harness'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { painted } from '../test/painted'
|
|
||||||
import { visibleWords } from '../test/visibleWords'
|
|
||||||
import './health'
|
|
||||||
|
|
||||||
const server = (over = {}) => ({ stale: false, started_at: '2026-10-10T10:00:00Z', version: '1.2.3', ...over })
|
|
||||||
const daemon = (state: string) => ({ state, started_at: null, pid: null, journal_tail: [], restart_available_at: null })
|
|
||||||
|
|
||||||
describe('health badges by id', () => {
|
|
||||||
it('draws the subject and the state with their words and glyphs', async () => {
|
|
||||||
useIcons({
|
|
||||||
'server.heading': { word: 'web' },
|
|
||||||
'health.ok': { word: 'fine', glyph: '🟢' },
|
|
||||||
'daemon.heading': { word: 'guard' },
|
|
||||||
'health.warn': { word: 'shaky' },
|
|
||||||
})
|
|
||||||
stubApi({ 'GET /api/server': server(), 'GET /api/daemon': daemon('restarting') })
|
|
||||||
const el = mount('<health-badges></health-badges>')
|
|
||||||
await vi.waitFor(() => { expect(el.querySelector('[data-state="Daemon restarting"]')).not.toBeNull() })
|
|
||||||
const pills = [...el.querySelectorAll<HTMLElement>('.pill')]
|
|
||||||
expect(painted(pills[0])).toBe('🌐Web🟢Fine')
|
|
||||||
expect(painted(pills[1])).toBe('🛡️Guard⚠️Shaky')
|
|
||||||
expect(pills[0]?.querySelector('.sr-only')?.textContent).toContain('Server ok')
|
|
||||||
expect(pills[1]).toHaveAttribute('data-state', 'Daemon restarting')
|
|
||||||
expect(visibleWords(el)).toEqual([])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('keeps the plain glyphs without words, the unknown state as the ellipsis', () => {
|
|
||||||
stubApi({ 'GET /api/server': () => new Promise(() => undefined), 'GET /api/daemon': () => new Promise(() => undefined) })
|
|
||||||
const el = mount('<health-badges></health-badges>')
|
|
||||||
expect(painted(el.querySelector('[data-state="Daemon …"]'))).toBe('🛡️…')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('stale banner by id', () => {
|
|
||||||
it('draws the stale mark and the restart icon from the ledger', async () => {
|
|
||||||
useIcons({ 'health.stale': { word: 'old' }, 'server.restart': { word: 'reload', glyph: '♻️' } })
|
|
||||||
stubApi({ 'GET /api/server': server({ stale: true }) })
|
|
||||||
const el = mount('<stale-banner></stale-banner>')
|
|
||||||
await vi.waitFor(() => { expect(el).toHaveTextContent('The web server is running stale code.') })
|
|
||||||
const banner = el.firstElementChild
|
|
||||||
expect(banner?.querySelector('.glyph [data-icon="health.stale"]')?.textContent).toBe('⚠️🌐')
|
|
||||||
expect(banner?.querySelector('.glyph .icon-word')?.textContent).toBe('Old')
|
|
||||||
expect(button(el, 'Restart server').textContent).toBe('♻️Reload')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -2,22 +2,20 @@
|
|||||||
// every page while the running server is older than the code on disk).
|
// every page while the running server is older than the code on disk).
|
||||||
|
|
||||||
import { q } from '../api/queries'
|
import { q } from '../api/queries'
|
||||||
import type { IconId } from '../icons/registry'
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { define, h } from '../lib/dom'
|
import { define, h } from '../lib/dom'
|
||||||
import { LiveElement } from '../lib/element'
|
import { LiveElement } from '../lib/element'
|
||||||
import { errorNotice, glyph } from '../ui/build'
|
import { errorNotice, glyph } from '../ui/build'
|
||||||
import { ServerRestart } from './serverRestart'
|
import { ServerRestart } from './serverRestart'
|
||||||
|
|
||||||
const DAEMON_TONE = { running: 'success', restarting: 'warning', unreachable: 'danger' } as const
|
const DAEMON_TONE = { running: 'success', restarting: 'warning', unreachable: 'danger' } as const
|
||||||
const STATE_ICON = { success: 'health.ok', warning: 'health.warn', danger: 'health.bad', neutral: 'health.unknown' } as const satisfies Record<string, IconId>
|
const STATE_GLYPH: Record<string, string> = { success: '✅', warning: '⚠️', danger: '⛔', neutral: '…' }
|
||||||
|
|
||||||
/** A health pill: the subject and state icons painted, `text` (+ `extra`) spoken. `data-state` holds the words for tests. */
|
/** A health pill: glyphs painted, `text` (+ `extra`) spoken. `data-state` holds the words for tests. */
|
||||||
function badge(tone: keyof typeof STATE_ICON, subject: IconId, text: string, extra = ''): HTMLSpanElement {
|
function badge(tone: string, icons: string, text: string, extra = ''): HTMLSpanElement {
|
||||||
return h(
|
return h(
|
||||||
'span',
|
'span',
|
||||||
{ class: `pill pill-${tone}`, 'data-state': text },
|
{ class: `pill pill-${tone}`, 'data-state': text },
|
||||||
h('span', { class: 'has-word', 'aria-hidden': 'true' }, iconInline(subject), iconInline(STATE_ICON[tone])),
|
h('span', { 'aria-hidden': 'true' }, icons),
|
||||||
h('span', { class: 'sr-only' }, text + extra),
|
h('span', { class: 'sr-only' }, text + extra),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -33,15 +31,15 @@ export class HealthBadgesElement extends LiveElement {
|
|||||||
const d = q.daemon.state.data?.state
|
const d = q.daemon.state.data?.state
|
||||||
const serverTone = server.error ? 'danger' : server.data?.stale ? 'warning' : 'success'
|
const serverTone = server.error ? 'danger' : server.data?.stale ? 'warning' : 'success'
|
||||||
const serverText = server.error ? 'Server down' : server.data?.stale ? 'Server stale' : 'Server ok'
|
const serverText = server.error ? 'Server down' : server.data?.stale ? 'Server stale' : 'Server ok'
|
||||||
// Textgate: the server / daemon icon + a state icon, on the tone colour;
|
// Textgate: 🌐 server / 🛡️ daemon + a state glyph, on the tone colour; the
|
||||||
// the words (and the version, formerly a tooltip) are spoken only.
|
// words (and the version, formerly a tooltip) are spoken only.
|
||||||
const version = server.data ? ` v${server.data.version}` : ''
|
const version = server.data ? ` v${server.data.version}` : ''
|
||||||
this.replaceChildren(
|
this.replaceChildren(
|
||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'health', 'aria-label': 'Health' },
|
{ class: 'health', 'aria-label': 'Health' },
|
||||||
badge(serverTone, 'server.heading', serverText, version),
|
badge(serverTone, `🌐${STATE_GLYPH[serverTone]}`, serverText, version),
|
||||||
badge(d ? DAEMON_TONE[d] : 'neutral', 'daemon.heading',`Daemon ${d ?? '…'}`),
|
badge(d ? DAEMON_TONE[d] : 'neutral', `🛡️${STATE_GLYPH[d ? DAEMON_TONE[d] : 'neutral']}`, `Daemon ${d ?? '…'}`),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -69,7 +67,7 @@ export class StaleBannerElement extends LiveElement {
|
|||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ class: 'banner banner-warning', role: 'status' },
|
{ class: 'banner banner-warning', role: 'status' },
|
||||||
glyph('health.stale', 'The web server is running stale code. Restart it to pick up the new version.'),
|
glyph('⚠️🌐', 'The web server is running stale code. Restart it to pick up the new version.'),
|
||||||
h(
|
h(
|
||||||
'button',
|
'button',
|
||||||
{
|
{
|
||||||
@ -79,7 +77,7 @@ export class StaleBannerElement extends LiveElement {
|
|||||||
onclick: () => void action.run(),
|
onclick: () => void action.run(),
|
||||||
'aria-label': this.restart.restarting ? 'Restarting…' : 'Restart server',
|
'aria-label': this.restart.restarting ? 'Restarting…' : 'Restart server',
|
||||||
},
|
},
|
||||||
iconInline(this.restart.restarting ? 'state.wait' : 'server.restart'),
|
h('span', { 'aria-hidden': 'true' }, this.restart.restarting ? '⏳' : '🔄'),
|
||||||
),
|
),
|
||||||
action.error ? errorNotice(action.error) : null,
|
action.error ? errorNotice(action.error) : null,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export function jobChip(job: Job): HTMLAnchorElement {
|
|||||||
'span',
|
'span',
|
||||||
{ class: 'jobchip-label' },
|
{ class: 'jobchip-label' },
|
||||||
glyph(commandIcon(job.command), label),
|
glyph(commandIcon(job.command), label),
|
||||||
h('span', { class: 'jobchip-sub' }, waiting ? glyph('jobchip.needs-input', 'needs input') : p?.total ? `${p.step}/${p.total}` : '…'),
|
h('span', { class: 'jobchip-sub' }, waiting ? glyph('✋', 'needs input') : p?.total ? `${p.step}/${p.total}` : '…'),
|
||||||
),
|
),
|
||||||
progressBar(fraction, label, waiting ? 'warning' : 'accent', true),
|
progressBar(fraction, label, waiting ? 'warning' : 'accent', true),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -27,9 +27,10 @@ export interface PalettePage {
|
|||||||
to: string
|
to: string
|
||||||
label: string
|
label: string
|
||||||
blurb: string
|
blurb: string
|
||||||
icon: IconId
|
/** A raw glyph: these pages are not in the icon registry yet. */
|
||||||
|
icon: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PALETTE_PAGES: PalettePage[] = [
|
export const PALETTE_PAGES: PalettePage[] = [
|
||||||
{ to: '/words', label: 'Icon words', blurb: 'Pick the word shown next to each icon', icon: 'words.page' },
|
{ to: '/words', label: 'Icon words', blurb: 'Pick the word shown next to each icon', icon: '🏷️' },
|
||||||
]
|
]
|
||||||
|
|||||||
@ -75,13 +75,22 @@ describe('small builders', () => {
|
|||||||
expect(el.querySelector('.empty-icon')?.textContent).toBe('📭')
|
expect(el.querySelector('.empty-icon')?.textContent).toBe('📭')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('pill paints the registered icon it is given and speaks its text', () => {
|
it('pill has an icon for known tones', () => {
|
||||||
const el = pill('danger', 'odd one', 'notice.danger')
|
const el = pill('danger', 'x')
|
||||||
expect(el.className).toBe('pill pill-danger')
|
expect(el.className).toBe('pill pill-danger')
|
||||||
expect(el.querySelector('.pill-icon')?.textContent).toBe('⛔')
|
expect(el.querySelector('.pill-icon')).not.toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('pill paints a bullet for an unknown tone and speaks its text', () => {
|
||||||
|
const el = pill('mystery', 'odd one')
|
||||||
|
expect(el.querySelector('.pill-icon')?.textContent).toBe('•')
|
||||||
expect(el.querySelector('.sr-only')?.textContent).toBe('odd one')
|
expect(el.querySelector('.sr-only')?.textContent).toBe('odd one')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('pill paints the icon it is given over the tone glyph', () => {
|
||||||
|
expect(pill('danger', 'x', '🔥').querySelector('.pill-icon')?.textContent).toBe('🔥')
|
||||||
|
})
|
||||||
|
|
||||||
it('link is an anchor', () => {
|
it('link is an anchor', () => {
|
||||||
const a = link('/library/', 'Open')
|
const a = link('/library/', 'Open')
|
||||||
expect(a.getAttribute('href')).toBe('/library/')
|
expect(a.getAttribute('href')).toBe('/library/')
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
// for content a custom element renders from live data.
|
// for content a custom element renders from live data.
|
||||||
|
|
||||||
import { explain } from '../api/errors'
|
import { explain } from '../api/errors'
|
||||||
import type { IconId } from '../icons/registry'
|
import { isIconId, type IconId } from '../icons/registry'
|
||||||
import { iconFor, iconInline, iconMark, iconWord } from '../icons/render'
|
import { iconFor, iconMark, iconWord } from '../icons/render'
|
||||||
import { h, type Child } from '../lib/dom'
|
import { h, type Child } from '../lib/dom'
|
||||||
|
|
||||||
export type Tone = 'info' | 'success' | 'warning' | 'danger'
|
export type Tone = 'info' | 'success' | 'warning' | 'danger'
|
||||||
@ -47,14 +47,14 @@ export function errorNotice(error: unknown, ...children: Child[]): HTMLDivElemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function copyButton(text: string): HTMLButtonElement {
|
export function copyButton(text: string): HTMLButtonElement {
|
||||||
const btn = h('button', { type: 'button', class: 'btn btn-ghost btn-small', 'aria-label': 'Copy command' }, iconInline('copy.command'))
|
const btn = h('button', { type: 'button', class: 'btn btn-ghost btn-small', 'aria-label': 'Copy command' }, '📋')
|
||||||
btn.addEventListener('click', () => {
|
btn.addEventListener('click', () => {
|
||||||
if (!('clipboard' in navigator)) return
|
if (!('clipboard' in navigator)) return
|
||||||
void navigator.clipboard.writeText(text).then(() => {
|
void navigator.clipboard.writeText(text).then(() => {
|
||||||
btn.replaceChildren(iconInline('copy.done'))
|
btn.textContent = '✅'
|
||||||
btn.setAttribute('aria-label', 'Copied')
|
btn.setAttribute('aria-label', 'Copied')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
btn.replaceChildren(iconInline('copy.command'))
|
btn.textContent = '📋'
|
||||||
btn.setAttribute('aria-label', 'Copy command')
|
btn.setAttribute('aria-label', 'Copy command')
|
||||||
}, 2000)
|
}, 2000)
|
||||||
})
|
})
|
||||||
@ -71,12 +71,12 @@ export function loading(what: string): HTMLParagraphElement {
|
|||||||
return h('p', { class: 'loading', role: 'status' }, h('span', { class: 'spinner', 'aria-hidden': 'true' }), h('span', { class: 'sr-only' }, `Loading ${what}`))
|
return h('p', { class: 'loading', role: 'status' }, h('span', { class: 'spinner', 'aria-hidden': 'true' }), h('span', { class: 'sr-only' }, `Loading ${what}`))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Empty-state marker: the empty icon painted, the caller's sentence spoken only. */
|
/** Empty-state marker: 📭 painted, the caller's sentence spoken only. */
|
||||||
export function empty(label: string): HTMLParagraphElement {
|
export function empty(label: string): HTMLParagraphElement {
|
||||||
return h(
|
return h(
|
||||||
'p',
|
'p',
|
||||||
{ class: 'empty', 'aria-label': label },
|
{ class: 'empty', 'aria-label': label },
|
||||||
iconInline('state.empty', 'empty-icon'),
|
h('span', { class: 'empty-icon', 'aria-hidden': 'true' }, '📭'),
|
||||||
h('span', { class: 'sr-only' }, label),
|
h('span', { class: 'sr-only' }, label),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -84,21 +84,27 @@ export function empty(label: string): HTMLParagraphElement {
|
|||||||
export interface CardOptions {
|
export interface CardOptions {
|
||||||
aside?: Child
|
aside?: Child
|
||||||
className?: string
|
className?: string
|
||||||
icon?: IconId
|
icon?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A painted glyph whose meaning is spoken (.sr-only). The glyph comes from the
|
* A painted glyph whose meaning is spoken (.sr-only). With a registered id the
|
||||||
* registry (the user's alternative applied) and his word, if any, is drawn
|
* glyph comes from the registry (the user's alternative applied) and his word,
|
||||||
* right of it; `spoken` defaults to the registry name.
|
* if any, is drawn right of it; `spoken` then defaults to the registry name.
|
||||||
|
* A raw glyph (`glyph('🧭', 'navigate')`) paints just that, as before.
|
||||||
*/
|
*/
|
||||||
export function glyph(id: IconId, spoken?: string, className = 'glyph'): HTMLSpanElement {
|
export function glyph(id: IconId, spoken?: string, className?: string): HTMLSpanElement
|
||||||
const { glyph: painted, spoken: name } = iconFor(id)
|
export function glyph(icon: string, spoken: string, className?: string): HTMLSpanElement
|
||||||
const word = iconWord(id)
|
export function glyph(icon: string, spoken?: string, className = 'glyph'): HTMLSpanElement {
|
||||||
|
if (!isIconId(icon)) {
|
||||||
|
return h('span', { class: className }, h('span', { 'aria-hidden': 'true' }, icon), h('span', { class: 'sr-only' }, spoken))
|
||||||
|
}
|
||||||
|
const { glyph: painted, spoken: name } = iconFor(icon)
|
||||||
|
const word = iconWord(icon)
|
||||||
return h(
|
return h(
|
||||||
'span',
|
'span',
|
||||||
{ class: word ? `${className} has-word` : className },
|
{ class: word ? `${className} has-word` : className },
|
||||||
h('span', { 'aria-hidden': 'true', 'data-icon': id }, painted),
|
h('span', { 'aria-hidden': 'true', 'data-icon': icon }, painted),
|
||||||
word,
|
word,
|
||||||
h('span', { class: 'sr-only' }, spoken ?? name),
|
h('span', { class: 'sr-only' }, spoken ?? name),
|
||||||
)
|
)
|
||||||
@ -120,13 +126,23 @@ export function facts(rows: readonly (readonly [Child, Child])[]): HTMLDListElem
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A tone badge: the registered `icon` (and its word) painted, `text` spoken only. */
|
const TONE_PILL_ICON: Record<string, string> = {
|
||||||
export function pill(tone: string, text: string, icon: IconId): HTMLSpanElement {
|
info: 'ℹ️',
|
||||||
|
success: '✅',
|
||||||
|
warning: '⚠️',
|
||||||
|
danger: '⛔',
|
||||||
|
kept: '📌',
|
||||||
|
excluded: '🚫',
|
||||||
|
idle: '⏸️',
|
||||||
|
running: '▶️',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A tone badge: `icon` (else the tone's glyph) painted, `text` spoken only. */
|
||||||
|
export function pill(tone: string, text: string, icon = TONE_PILL_ICON[tone] ?? '•'): HTMLSpanElement {
|
||||||
return h(
|
return h(
|
||||||
'span',
|
'span',
|
||||||
{ class: `pill pill-${tone}` },
|
{ class: `pill pill-${tone}` },
|
||||||
iconMark(icon, 'pill-icon'),
|
h('span', { class: 'pill-icon', 'aria-hidden': 'true' }, icon),
|
||||||
iconWord(icon),
|
|
||||||
h('span', { class: 'sr-only' }, text),
|
h('span', { class: 'sr-only' }, text),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
// The dialog's close button is a registered icon: his word beside it, his
|
|
||||||
// glyph in place of the default, the aria-label stays "Close".
|
|
||||||
|
|
||||||
import { describe, expect, it, vi } from 'vitest'
|
|
||||||
import { useIcons } from '../test/iconLedger'
|
|
||||||
import { Modal } from './dialog'
|
|
||||||
|
|
||||||
describe('Modal close button by id', () => {
|
|
||||||
it('paints the default cross, spoken name Close', () => {
|
|
||||||
const modal = new Modal({ title: 'Hello', onClose: vi.fn() })
|
|
||||||
const close = modal.el.querySelector('.dialog-close')
|
|
||||||
expect(close?.textContent).toBe('×')
|
|
||||||
expect(close).toHaveAttribute('aria-label', 'Close')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('paints the user word right of his chosen glyph', () => {
|
|
||||||
useIcons({ 'dialog.close': { word: 'exit', glyph: '❌' } })
|
|
||||||
const modal = new Modal({ title: 'Hello', onClose: vi.fn() })
|
|
||||||
const close = modal.el.querySelector('.dialog-close')
|
|
||||||
expect(close?.textContent).toBe('❌Exit')
|
|
||||||
expect(close?.querySelector('.icon-word')).toHaveAttribute('data-icon-word', 'dialog.close')
|
|
||||||
expect(close).toHaveAttribute('aria-label', 'Close')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -2,7 +2,6 @@
|
|||||||
// inert background and Escape (routed through `onClose` so the owner decides
|
// inert background and Escape (routed through `onClose` so the owner decides
|
||||||
// what closing means). Focus returns to the opener when it closes.
|
// what closing means). Focus returns to the opener when it closes.
|
||||||
|
|
||||||
import { iconInline } from '../icons/render'
|
|
||||||
import { append, h, type Child } from '../lib/dom'
|
import { append, h, type Child } from '../lib/dom'
|
||||||
|
|
||||||
export interface ModalOptions {
|
export interface ModalOptions {
|
||||||
@ -24,7 +23,7 @@ export class Modal {
|
|||||||
const close = h(
|
const close = h(
|
||||||
'button',
|
'button',
|
||||||
{ type: 'button', class: 'btn btn-ghost btn-icon dialog-close', 'aria-label': 'Close', onclick: onClose },
|
{ type: 'button', class: 'btn btn-ghost btn-icon dialog-close', 'aria-label': 'Close', onclick: onClose },
|
||||||
iconInline('dialog.close'),
|
h('span', { 'aria-hidden': 'true' }, '×'),
|
||||||
)
|
)
|
||||||
this.head = h('header', { class: 'dialog-head' }, this.heading, close)
|
this.head = h('header', { class: 'dialog-head' }, this.heading, close)
|
||||||
this.body = h('div', { class: 'dialog-body' }, this.head)
|
this.body = h('div', { class: 'dialog-body' }, this.head)
|
||||||
|
|||||||
@ -1,81 +1,5 @@
|
|||||||
{
|
{
|
||||||
"icons": {
|
"icons": {
|
||||||
"action.cancel": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "cancel"
|
|
||||||
},
|
|
||||||
"action.confirm": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "confirm"
|
|
||||||
},
|
|
||||||
"action.open": {
|
|
||||||
"glyph": "🔗",
|
|
||||||
"word": "open"
|
|
||||||
},
|
|
||||||
"assigned.game": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "assigned"
|
|
||||||
},
|
|
||||||
"backlog.any": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "any"
|
|
||||||
},
|
|
||||||
"backlog.cli": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "cli"
|
|
||||||
},
|
|
||||||
"backlog.filters": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "filters"
|
|
||||||
},
|
|
||||||
"backlog.in-scope": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "scope"
|
|
||||||
},
|
|
||||||
"backlog.sort-asc": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "ascending"
|
|
||||||
},
|
|
||||||
"backlog.sort-desc": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "descending"
|
|
||||||
},
|
|
||||||
"backup.item": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "backup"
|
|
||||||
},
|
|
||||||
"backup.reason.nightly": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "nightly"
|
|
||||||
},
|
|
||||||
"backup.reason.other": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "other"
|
|
||||||
},
|
|
||||||
"backup.reason.reset": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "reset"
|
|
||||||
},
|
|
||||||
"backup.restore": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "restore"
|
|
||||||
},
|
|
||||||
"basis.leisure": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "leisure"
|
|
||||||
},
|
|
||||||
"basis.pace": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "pace"
|
|
||||||
},
|
|
||||||
"basis.rush": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "rush"
|
|
||||||
},
|
|
||||||
"basis.worst": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "worst"
|
|
||||||
},
|
|
||||||
"cmd.abandon-pick": {
|
"cmd.abandon-pick": {
|
||||||
"glyph": null,
|
"glyph": null,
|
||||||
"word": "abandon"
|
"word": "abandon"
|
||||||
@ -180,342 +104,6 @@
|
|||||||
"glyph": null,
|
"glyph": null,
|
||||||
"word": "remove"
|
"word": "remove"
|
||||||
},
|
},
|
||||||
"cmdflag.cancellable": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "stoppable"
|
|
||||||
},
|
|
||||||
"cmdflag.countdown": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "countdown"
|
|
||||||
},
|
|
||||||
"cmdflag.mutating": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "changes"
|
|
||||||
},
|
|
||||||
"cmdflag.readonly": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "readonly"
|
|
||||||
},
|
|
||||||
"cmdflag.root": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "root"
|
|
||||||
},
|
|
||||||
"cmdpal.go": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "navigate"
|
|
||||||
},
|
|
||||||
"cmdpal.open": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "page"
|
|
||||||
},
|
|
||||||
"cmdpal.run-phrase": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "confirm"
|
|
||||||
},
|
|
||||||
"cmdpal.search": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "search"
|
|
||||||
},
|
|
||||||
"copy.command": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "copy"
|
|
||||||
},
|
|
||||||
"copy.done": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "done"
|
|
||||||
},
|
|
||||||
"daemon.demo_run": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "demo"
|
|
||||||
},
|
|
||||||
"daemon.heading": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "daemon"
|
|
||||||
},
|
|
||||||
"daemon.journal": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "journal"
|
|
||||||
},
|
|
||||||
"daemon.pid": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "process"
|
|
||||||
},
|
|
||||||
"daemon.restart": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "restart"
|
|
||||||
},
|
|
||||||
"daemon.restarting": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "restarting"
|
|
||||||
},
|
|
||||||
"daemon.running": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "running"
|
|
||||||
},
|
|
||||||
"daemon.state": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "state"
|
|
||||||
},
|
|
||||||
"daemon.unreachable": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unreachable"
|
|
||||||
},
|
|
||||||
"daemon.up_since": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "uptime"
|
|
||||||
},
|
|
||||||
"dash.ago": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "ago"
|
|
||||||
},
|
|
||||||
"dash.billing": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "playing"
|
|
||||||
},
|
|
||||||
"dash.block-left": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "left"
|
|
||||||
},
|
|
||||||
"dash.blocked-today": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "blocked"
|
|
||||||
},
|
|
||||||
"dash.budget": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "budget"
|
|
||||||
},
|
|
||||||
"dash.elapsed": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "elapsed"
|
|
||||||
},
|
|
||||||
"dash.fast-failed": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "failed"
|
|
||||||
},
|
|
||||||
"dash.fast-install": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "fast"
|
|
||||||
},
|
|
||||||
"dash.finished": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "finished"
|
|
||||||
},
|
|
||||||
"dash.games": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "games"
|
|
||||||
},
|
|
||||||
"dash.installed": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "installed"
|
|
||||||
},
|
|
||||||
"dash.not-billing": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "idle"
|
|
||||||
},
|
|
||||||
"dash.outlook": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "backlog"
|
|
||||||
},
|
|
||||||
"dash.recent-jobs": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "jobs"
|
|
||||||
},
|
|
||||||
"dash.steam-took-over": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "fallback"
|
|
||||||
},
|
|
||||||
"dash.store": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "store"
|
|
||||||
},
|
|
||||||
"dash.store-blocked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "blocked"
|
|
||||||
},
|
|
||||||
"dash.store-open": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "open"
|
|
||||||
},
|
|
||||||
"dash.total-block": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "block"
|
|
||||||
},
|
|
||||||
"dialog.close": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "close"
|
|
||||||
},
|
|
||||||
"filter.advanced": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "advanced"
|
|
||||||
},
|
|
||||||
"filter.basis": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "basis"
|
|
||||||
},
|
|
||||||
"filter.clear-date": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "clear"
|
|
||||||
},
|
|
||||||
"filter.daily": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "daily"
|
|
||||||
},
|
|
||||||
"filter.fallback": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "guess"
|
|
||||||
},
|
|
||||||
"filter.max-time": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "cap"
|
|
||||||
},
|
|
||||||
"filter.min-confidence": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "confidence"
|
|
||||||
},
|
|
||||||
"filter.min-polled": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "polled"
|
|
||||||
},
|
|
||||||
"filter.min-tier": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "minimum"
|
|
||||||
},
|
|
||||||
"filter.no-cap": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unlimited"
|
|
||||||
},
|
|
||||||
"filter.proton-missing": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unrated"
|
|
||||||
},
|
|
||||||
"filter.reset": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "reset"
|
|
||||||
},
|
|
||||||
"filter.started": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "started"
|
|
||||||
},
|
|
||||||
"filter.target-date": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "deadline"
|
|
||||||
},
|
|
||||||
"filter.untouched": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "untouched"
|
|
||||||
},
|
|
||||||
"gaming.billed_last": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "previous"
|
|
||||||
},
|
|
||||||
"gaming.billing_to": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "charging"
|
|
||||||
},
|
|
||||||
"gaming.budget": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "budget"
|
|
||||||
},
|
|
||||||
"gaming.by_game": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "games"
|
|
||||||
},
|
|
||||||
"gaming.cutoff.masked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "cutoff"
|
|
||||||
},
|
|
||||||
"gaming.cutoff.unmasked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unmasked"
|
|
||||||
},
|
|
||||||
"gaming.day": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "date"
|
|
||||||
},
|
|
||||||
"gaming.day_start": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "sunrise"
|
|
||||||
},
|
|
||||||
"gaming.demo": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "demo"
|
|
||||||
},
|
|
||||||
"gaming.enforcement": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "enforcement"
|
|
||||||
},
|
|
||||||
"gaming.history": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "history"
|
|
||||||
},
|
|
||||||
"gaming.launcher": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "launcher"
|
|
||||||
},
|
|
||||||
"gaming.masked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "masked"
|
|
||||||
},
|
|
||||||
"gaming.mode": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "mode"
|
|
||||||
},
|
|
||||||
"gaming.production": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "production"
|
|
||||||
},
|
|
||||||
"gaming.qualifying": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "processes"
|
|
||||||
},
|
|
||||||
"gaming.right_now": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "live"
|
|
||||||
},
|
|
||||||
"gaming.rules": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "rules"
|
|
||||||
},
|
|
||||||
"gaming.series.other": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "other"
|
|
||||||
},
|
|
||||||
"gaming.series.unattributed": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unattributed"
|
|
||||||
},
|
|
||||||
"gaming.today": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "today"
|
|
||||||
},
|
|
||||||
"gaming.warn.none": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "silent"
|
|
||||||
},
|
|
||||||
"gaming.warning": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "warning"
|
|
||||||
},
|
|
||||||
"health.bad": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "down"
|
|
||||||
},
|
|
||||||
"health.ok": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "healthy"
|
|
||||||
},
|
|
||||||
"health.stale": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "stale"
|
|
||||||
},
|
|
||||||
"health.unknown": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unknown"
|
|
||||||
},
|
|
||||||
"health.warn": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "degraded"
|
|
||||||
},
|
|
||||||
"job.state.cancelled": {
|
"job.state.cancelled": {
|
||||||
"glyph": null,
|
"glyph": null,
|
||||||
"word": "stopped"
|
"word": "stopped"
|
||||||
@ -540,146 +128,6 @@
|
|||||||
"glyph": null,
|
"glyph": null,
|
||||||
"word": "question"
|
"word": "question"
|
||||||
},
|
},
|
||||||
"jobchip.needs-input": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "answer"
|
|
||||||
},
|
|
||||||
"jobs.all": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "all"
|
|
||||||
},
|
|
||||||
"jobs.cancel": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "stop"
|
|
||||||
},
|
|
||||||
"jobs.command": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "command"
|
|
||||||
},
|
|
||||||
"jobs.job": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "job"
|
|
||||||
},
|
|
||||||
"jobs.log": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "log"
|
|
||||||
},
|
|
||||||
"jobs.not-found": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "missing"
|
|
||||||
},
|
|
||||||
"jobs.started": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "started"
|
|
||||||
},
|
|
||||||
"jobs.state": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "state"
|
|
||||||
},
|
|
||||||
"jobs.took": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "took"
|
|
||||||
},
|
|
||||||
"jobs.waiting": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "waiting"
|
|
||||||
},
|
|
||||||
"keep.excluded": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "excluded"
|
|
||||||
},
|
|
||||||
"keep.kept": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "kept"
|
|
||||||
},
|
|
||||||
"lib.completion": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "completion"
|
|
||||||
},
|
|
||||||
"lib.count": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "games"
|
|
||||||
},
|
|
||||||
"lib.hide-completed": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "hide"
|
|
||||||
},
|
|
||||||
"lib.hltb": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "hltb"
|
|
||||||
},
|
|
||||||
"lib.name": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "name"
|
|
||||||
},
|
|
||||||
"lib.pickable": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "pickable"
|
|
||||||
},
|
|
||||||
"lib.played": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "played"
|
|
||||||
},
|
|
||||||
"lib.recent": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "recent"
|
|
||||||
},
|
|
||||||
"lib.relevance": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "relevance"
|
|
||||||
},
|
|
||||||
"lib.search": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "search"
|
|
||||||
},
|
|
||||||
"lib.sort": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "sort"
|
|
||||||
},
|
|
||||||
"lib.why.blocked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "blocked"
|
|
||||||
},
|
|
||||||
"lib.why.complete": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "complete"
|
|
||||||
},
|
|
||||||
"lib.why.noach": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "none"
|
|
||||||
},
|
|
||||||
"lib.why.skipped": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "skipped"
|
|
||||||
},
|
|
||||||
"libpage.all": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "all"
|
|
||||||
},
|
|
||||||
"libpage.app-id": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "number"
|
|
||||||
},
|
|
||||||
"libpage.candidate": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "removable"
|
|
||||||
},
|
|
||||||
"libpage.game": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "game"
|
|
||||||
},
|
|
||||||
"libpage.protected": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "protected"
|
|
||||||
},
|
|
||||||
"libpage.role": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "role"
|
|
||||||
},
|
|
||||||
"libpage.size": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "size"
|
|
||||||
},
|
|
||||||
"nav.backlog": {
|
"nav.backlog": {
|
||||||
"glyph": null,
|
"glyph": null,
|
||||||
"word": "backlog"
|
"word": "backlog"
|
||||||
@ -731,326 +179,6 @@
|
|||||||
"palette.open": {
|
"palette.open": {
|
||||||
"glyph": null,
|
"glyph": null,
|
||||||
"word": "search"
|
"word": "search"
|
||||||
},
|
|
||||||
"params.app_id": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "game"
|
|
||||||
},
|
|
||||||
"params.backup_id": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "backup"
|
|
||||||
},
|
|
||||||
"params.days": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "days"
|
|
||||||
},
|
|
||||||
"params.demo": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "demo"
|
|
||||||
},
|
|
||||||
"params.minutes": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "minutes"
|
|
||||||
},
|
|
||||||
"params.other": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "field"
|
|
||||||
},
|
|
||||||
"params.reason": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "reason"
|
|
||||||
},
|
|
||||||
"params.replace": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "replace"
|
|
||||||
},
|
|
||||||
"pending.beat": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "heartbeat"
|
|
||||||
},
|
|
||||||
"pending.beat-lost": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "failing"
|
|
||||||
},
|
|
||||||
"pending.leave": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "leaving"
|
|
||||||
},
|
|
||||||
"pending.rearm": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "rearm"
|
|
||||||
},
|
|
||||||
"phrase.field": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "type"
|
|
||||||
},
|
|
||||||
"picks.age": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "picked"
|
|
||||||
},
|
|
||||||
"picks.kept": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "kept"
|
|
||||||
},
|
|
||||||
"picks.manual": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "manual"
|
|
||||||
},
|
|
||||||
"planner.candidates": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "candidates"
|
|
||||||
},
|
|
||||||
"planner.completion": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "completion"
|
|
||||||
},
|
|
||||||
"planner.completions": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "completions"
|
|
||||||
},
|
|
||||||
"planner.game": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "game"
|
|
||||||
},
|
|
||||||
"planner.keep": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "keep"
|
|
||||||
},
|
|
||||||
"planner.no-data": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "blank"
|
|
||||||
},
|
|
||||||
"planner.playing": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "playing"
|
|
||||||
},
|
|
||||||
"planner.playtime": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "playtime"
|
|
||||||
},
|
|
||||||
"planner.proton": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "proton"
|
|
||||||
},
|
|
||||||
"planner.since": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "since"
|
|
||||||
},
|
|
||||||
"prompt.answer": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "send"
|
|
||||||
},
|
|
||||||
"prompt.back": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "back"
|
|
||||||
},
|
|
||||||
"prompt.games": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "choices"
|
|
||||||
},
|
|
||||||
"prompt.no": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "no"
|
|
||||||
},
|
|
||||||
"prompt.own-game": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "own"
|
|
||||||
},
|
|
||||||
"prompt.pick": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "pick"
|
|
||||||
},
|
|
||||||
"prompt.question": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "question"
|
|
||||||
},
|
|
||||||
"prompt.yes": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "yes"
|
|
||||||
},
|
|
||||||
"runner.arm": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "arm"
|
|
||||||
},
|
|
||||||
"runner.fill": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "fill"
|
|
||||||
},
|
|
||||||
"runner.run": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "run"
|
|
||||||
},
|
|
||||||
"runner.terminal": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "terminal"
|
|
||||||
},
|
|
||||||
"server.code": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "code"
|
|
||||||
},
|
|
||||||
"server.heading": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "server"
|
|
||||||
},
|
|
||||||
"server.restart": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "restart"
|
|
||||||
},
|
|
||||||
"server.started": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "started"
|
|
||||||
},
|
|
||||||
"server.version": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "version"
|
|
||||||
},
|
|
||||||
"setup.api-key": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "key"
|
|
||||||
},
|
|
||||||
"setup.help": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "link"
|
|
||||||
},
|
|
||||||
"setup.key-stored": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "stored"
|
|
||||||
},
|
|
||||||
"setup.steam-id": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "id"
|
|
||||||
},
|
|
||||||
"state.empty": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "empty"
|
|
||||||
},
|
|
||||||
"state.locked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "locked"
|
|
||||||
},
|
|
||||||
"state.no": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "no"
|
|
||||||
},
|
|
||||||
"state.off": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "off"
|
|
||||||
},
|
|
||||||
"state.unknown": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unknown"
|
|
||||||
},
|
|
||||||
"state.unlocked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unlocked"
|
|
||||||
},
|
|
||||||
"state.wait": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "busy"
|
|
||||||
},
|
|
||||||
"state.warn": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "attention"
|
|
||||||
},
|
|
||||||
"state.yes": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "yes"
|
|
||||||
},
|
|
||||||
"stats.card": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "estimates"
|
|
||||||
},
|
|
||||||
"store.blocked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "blocked"
|
|
||||||
},
|
|
||||||
"store.open": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "open"
|
|
||||||
},
|
|
||||||
"style.between": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "between"
|
|
||||||
},
|
|
||||||
"style.fast": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "fast"
|
|
||||||
},
|
|
||||||
"style.slow": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "slow"
|
|
||||||
},
|
|
||||||
"summary.estimated-total": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "total"
|
|
||||||
},
|
|
||||||
"summary.games-per-day": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "rate"
|
|
||||||
},
|
|
||||||
"summary.interpolation": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "blend"
|
|
||||||
},
|
|
||||||
"summary.match": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "match"
|
|
||||||
},
|
|
||||||
"summary.need": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "needs"
|
|
||||||
},
|
|
||||||
"summary.no-start": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "unset"
|
|
||||||
},
|
|
||||||
"summary.style": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "style"
|
|
||||||
},
|
|
||||||
"summary.to-finish": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "remaining"
|
|
||||||
},
|
|
||||||
"syssetup.configured": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "configured"
|
|
||||||
},
|
|
||||||
"syssetup.edit": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "edit"
|
|
||||||
},
|
|
||||||
"tier.borked": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "borked"
|
|
||||||
},
|
|
||||||
"tier.bronze": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "bronze"
|
|
||||||
},
|
|
||||||
"tier.gold": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "gold"
|
|
||||||
},
|
|
||||||
"tier.native": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "native"
|
|
||||||
},
|
|
||||||
"tier.pending": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "pending"
|
|
||||||
},
|
|
||||||
"tier.platinum": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "platinum"
|
|
||||||
},
|
|
||||||
"tier.silver": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "silver"
|
|
||||||
},
|
|
||||||
"words.page": {
|
|
||||||
"glyph": null,
|
|
||||||
"word": "words"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": 1
|
"version": 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user