diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 8f71c50..0b825c9 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -50,10 +50,10 @@ Every page is on `` except Inventory → Stock (a placeholder). Two-column | Choose one / several | `Dropdown` (`multiple`) | **never a native ` onSelect(p.id)} aria-label={t('products.select', { name: p.name })} /> + + {/* edit and archive / delete: centred on the card (2026-11-21) */} + onEdit(p)}> onRemove(p)}>{archived ? : } diff --git a/manager_dashboard/src/pages/products/productsLogic.js b/manager_dashboard/src/pages/products/productsLogic.js index 67e037c..8758fc8 100644 --- a/manager_dashboard/src/pages/products/productsLogic.js +++ b/manager_dashboard/src/pages/products/productsLogic.js @@ -123,6 +123,15 @@ export function moveId(ids, fromId, toId) { return next } +/** Move `fromId` to just before (or, `after`, just after) `toId`: where the drop line showed. */ +export function moveIdTo(ids, fromId, toId, after = false) { + if (fromId === toId || !ids.includes(fromId) || !ids.includes(toId)) return null + const rest = ids.filter(id => id !== fromId) + const at = rest.indexOf(toId) + (after ? 1 : 0) + const next = [...rest.slice(0, at), fromId, ...rest.slice(at)] + return next.every((id, i) => id === ids[i]) ? null : next +} + /** What it costs the venue (the breakdown's sum, else the simple cost) and the margin; null without a cost. */ export function costOf(p) { const cost = p.cost_breakdown?.length ? p.cost_breakdown.reduce((s, e) => s + (Number(e.amount) || 0), 0) diff --git a/manager_dashboard/src/pages/staff/StaffPage.jsx b/manager_dashboard/src/pages/staff/StaffPage.jsx index 455de9a..ae0722d 100644 --- a/manager_dashboard/src/pages/staff/StaffPage.jsx +++ b/manager_dashboard/src/pages/staff/StaffPage.jsx @@ -108,8 +108,8 @@ export default function StaffPage() { {!support && ( open('edit', m)}> - open('pin', m)} data-testid="staff-pin"> - open('password', m)} data-testid="staff-password"> + open('pin', m)} data-testid="staff-pin"> + open('password', m)} data-testid="staff-password"> open('zones', m)}> {m.id !== me?.id && (<> { + const { moveIdTo } = await import('../src/pages/products/productsLogic.js') + assert.deepEqual(moveIdTo([1, 2, 3, 4], 1, 3, false), [2, 1, 3, 4]) // above 3 + assert.deepEqual(moveIdTo([1, 2, 3, 4], 1, 3, true), [2, 3, 1, 4]) // below 3 + assert.deepEqual(moveIdTo([1, 2, 3, 4], 4, 2, false), [1, 4, 2, 3]) + assert.equal(moveIdTo([1, 2, 3], 1, 2, false), null) // already there + assert.equal(moveIdTo([1, 2, 3], 2, 2, true), null) +}) diff --git a/packages/ui/src/components.css b/packages/ui/src/components.css index 8a25af8..e5ee6a3 100644 --- a/packages/ui/src/components.css +++ b/packages/ui/src/components.css @@ -60,7 +60,7 @@ .x-btn--icon.x-btn--tone { background: var(--x-surface-2); } /* a toned toggle that is on (a favourite's heart) keeps its colour */ .x-btn--tone[aria-pressed="true"] { color: rgb(var(--x-tone-ink)); } -.x-btn--icon.x-btn--tone:hover:not(:disabled) { background: var(--x-surface-3); } +.x-btn--icon.x-btn--tone:hover:not(:disabled) { background: rgb(var(--x-tone-soft)); } /* brighter under the pointer */ .x-btn--tone-danger { --x-tone: var(--x-danger-rgb); --x-tone-soft: var(--x-danger-soft-rgb); --x-tone-ink: var(--x-danger-ink-rgb); } .x-btn--tone-warning { --x-tone: var(--x-warning-rgb); --x-tone-soft: var(--x-warning-soft-rgb); --x-tone-ink: var(--x-warning-ink-rgb); } .x-btn--tone-info { --x-tone: var(--x-info-rgb); --x-tone-soft: var(--x-info-soft-rgb); --x-tone-ink: var(--x-info-ink-rgb); } @@ -543,7 +543,8 @@ .x-tabs__badge--warn { background: var(--x-danger-soft); color: var(--x-danger-ink); } .x-tabs__end { flex-shrink: 0; display: flex; align-items: center; gap: var(--x-space-2); } .x-tabs--inset { align-items: stretch; padding-inline: var(--x-pad-card); min-height: calc(var(--x-control-sm) + 2 * var(--x-pad-card)); } -.x-tabs--inset .x-tabs__list { align-items: flex-end; } +.x-tabs--inset { box-shadow: none; } /* a card's header: no line under it (2026-11-21) */ +.x-tabs--inset .x-tabs__list { align-items: center; } /* the labels level with the end button */ .x-tabs--inset .x-tabs__end { padding-block: var(--x-pad-card); } .x-tabs--fill .x-tabs__tab { flex: 1 1 0; justify-content: center; }