feat(ui): readable order card — status as background tint, corner ✕
Tests · UI / test (push) Waiting to run
Tests · UI / test (pull_request) Successful in 2m48s

The order-tab row now wraps long labels (`overflow-wrap: anywhere`),
encodes status into the card background via the design-token subtle
palette (applied → success-subtle, invalid/rejected/conflict →
danger-subtle, draft/valid/submitting → warning-subtle), and exposes
a small framed `✕` delete button absolutely positioned in the
card's top-right corner — always visible, labelled by
`game.sidebar.order.command_delete` for assistive tech. The textual
status name remains in the DOM as an `.sr-only` node so screen
readers and the existing testids still observe it.

Refs #46
This commit is contained in:
Ilia Denisov
2026-05-26 07:23:44 +02:00
parent 1f6791549a
commit 5ca30df334
3 changed files with 76 additions and 45 deletions
+44 -45
View File
@@ -7,10 +7,14 @@ button.
Phase 14 wires the auto-sync pipeline directly into the draft
store: every successful `add` / `remove` / `move` triggers a
`submitOrder` call so the server always mirrors the local draft.
This view shows the resulting per-command status (`valid`,
`submitting`, `applied`, `rejected`) and a small status bar at the
bottom that surfaces the latest sync result. The earlier explicit
Submit button is gone — there is no separate "send" step anymore.
Per-command status (`valid`, `submitting`, `applied`, `rejected`,
`conflict`, `invalid`) is conveyed by the card's background tint
(`status-{status}` class → `--color-{success,danger,warning}-subtle`),
while the textual status name stays in the DOM as an `sr-only`
node so screen readers and the existing tests still observe it.
A small status bar at the bottom surfaces the latest sync result.
The earlier explicit Submit button is gone — there is no separate
"send" step anymore.
Tests exercise the tab through `__galaxyDebug.seedOrderDraft`
(Playwright) and via direct store / mocked-client construction
@@ -188,7 +192,7 @@ Tests exercise the tab through `__galaxyDebug.seedOrderDraft`
{#each draft.commands as cmd, index (cmd.id)}
{@const status = statusOf(cmd)}
<li
class="command"
class="command status-{status}"
data-testid="order-command-{index}"
data-command-status={status}
>
@@ -197,7 +201,7 @@ Tests exercise the tab through `__galaxyDebug.seedOrderDraft`
{describe(cmd)}
</span>
<span
class="status status-{status}"
class="sr-only"
data-testid="order-command-status-{index}"
>
{i18n.t(statusKeyMap[status])}
@@ -206,9 +210,11 @@ Tests exercise the tab through `__galaxyDebug.seedOrderDraft`
type="button"
class="delete"
data-testid="order-command-delete-{index}"
aria-label={i18n.t("game.sidebar.order.command_delete")}
title={i18n.t("game.sidebar.order.command_delete")}
onclick={() => draft?.remove(cmd.id)}
>
{i18n.t("game.sidebar.order.command_delete")}
<span aria-hidden="true"></span>
</button>
</li>
{/each}
@@ -275,53 +281,36 @@ Tests exercise the tab through `__galaxyDebug.seedOrderDraft`
gap: 0.25rem;
}
.command {
position: relative;
display: grid;
grid-template-columns: auto 1fr auto auto;
align-items: center;
grid-template-columns: auto 1fr;
align-items: baseline;
gap: 0.5rem;
padding: 0.4rem 0.5rem;
padding: 0.4rem 1.9rem 0.4rem 0.5rem;
background: var(--color-surface-overlay);
border: 1px solid var(--color-border-subtle);
border-radius: 4px;
}
.command.status-applied {
background: var(--color-success-subtle);
}
.command.status-invalid,
.command.status-rejected,
.command.status-conflict {
background: var(--color-danger-subtle);
}
.command.status-draft,
.command.status-valid,
.command.status-submitting {
background: var(--color-warning-subtle);
}
.index {
color: var(--color-text-muted);
font-variant-numeric: tabular-nums;
}
.label {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 0.1rem 0.4rem;
border-radius: 999px;
border: 1px solid var(--color-border);
color: var(--color-text-muted);
}
.status-applied {
color: var(--color-success);
border-color: var(--color-success);
}
.status-rejected {
color: var(--color-danger);
border-color: var(--color-danger);
}
.status-invalid {
color: var(--color-warning);
border-color: var(--color-warning);
}
.status-submitting {
color: var(--color-accent);
border-color: var(--color-border);
}
.status-conflict {
color: var(--color-warning);
border-color: var(--color-warning);
overflow-wrap: anywhere;
}
.banner {
margin: 0 0 0.5rem;
@@ -341,16 +330,26 @@ Tests exercise the tab through `__galaxyDebug.seedOrderDraft`
border: 1px solid var(--color-border);
}
.delete {
position: absolute;
top: 0.2rem;
right: 0.2rem;
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.5rem;
height: 1.5rem;
padding: 0;
font: inherit;
font-size: 0.85rem;
padding: 0.2rem 0.55rem;
font-size: 0.95rem;
line-height: 1;
background: transparent;
color: var(--color-text-muted);
border: 1px solid var(--color-border);
border-radius: 3px;
cursor: pointer;
}
.delete:hover {
.delete:hover,
.delete:focus-visible {
color: var(--color-text);
border-color: var(--color-accent);
}