feat(manager): the floor plan editor reworked; Management -> Tables on the page rule; area colours

- Floor editor: one toolbar over the map and the panels (grid on / off, grid resolution Ultra high
  ... Very low, edit the shape, Fit width / Whole plan, undo, save), panels top-aligned and sticky.
- The floor's shape: a '+' on the edge under the pointer, press to add a corner (and drag it);
  resting on a corner shows a bubble to remove it (never below 3).
- Areas: resize handles on the sides and corners, a colour (pastel, see-through; floor_items.color,
  migration 0041), the name repeated in the corner when tables cover it (live maps too).
- Labels can be clicked again after they're placed (transparent fill, not none).
- Management -> Tables: <Page> with the tabs above (?tab=), the list as a container, toolbar
  buttons one height.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 15:17:45 +02:00
co-authored by Claude Opus 5.5
parent 476c55abc0
commit 244e93f827
17 changed files with 389 additions and 111 deletions
+17 -7
View File
@@ -1,7 +1,7 @@
// The pieces of a floor plan as SVG (plan step 6.8): the floor (outline, grid, background
// picture), the walls / bar / labels / areas, and a table with its chairs and what it shows.
// Colours are @xenia/ui tokens (CSS variables), so the same drawing works in every app.
import { chairs, durationText, outlineOf, peopleText, pointsAttr, TONES, toneOf } from './geometry.js'
import { chairs, durationText, itemFontSize, outlineOf, peopleText, pointsAttr, TONES, toneOf } from './geometry.js'
/** The floor: background picture, the floor's shape, and the grid (when asked). */
export function Floor({ plan, showGrid = false, mediaBase = '' }) {
@@ -31,25 +31,35 @@ export function Floor({ plan, showGrid = false, mediaBase = '' }) {
const ITEM_LOOK = {
wall: { fill: 'var(--x-ink-2)', stroke: 'none' },
bar: { fill: 'var(--x-surface-3)', stroke: 'var(--x-ink-3)' },
label: { fill: 'none', stroke: 'none' },
label: { fill: 'transparent', stroke: 'none' }, // transparent, not none: a label can be clicked
area: { fill: 'var(--x-surface-2)', stroke: 'var(--x-line-strong)', dash: '8 6' },
}
/** A wall, the bar, a label or an area. */
export function Item({ item, selected = false, label, ...rest }) {
/**
* A wall, the bar, a label or an area. An area may have a colour (drawn see-through, 2026-11-20);
* `corner`: its name is covered by tables, so it shows in the top-left corner as well.
*/
export function Item({ item, selected = false, label, corner = false, ...rest }) {
const look = ITEM_LOOK[item.kind] ?? ITEM_LOOK.area
const w = item.width
const h = item.height
const text = item.text || (item.kind === 'bar' ? label : '')
const colour = item.kind === 'area' && item.color ? item.color : null
const fs = text ? itemFontSize(item, text) : 0
return (
<g transform={`translate(${item.x} ${item.y}) rotate(${item.rotation || 0})`} {...rest}>
<rect x={-w / 2} y={-h / 2} width={w} height={h} rx={item.kind === 'wall' ? 2 : 8}
fill={look.fill} stroke={selected ? 'var(--x-accent)' : look.stroke} strokeWidth={selected ? 4 : 2} strokeDasharray={selected ? undefined : look.dash} />
fill={colour ?? look.fill} fillOpacity={colour ? 0.3 : undefined}
stroke={selected ? 'var(--x-accent)' : colour ?? look.stroke} strokeOpacity={colour && !selected ? 0.9 : undefined}
strokeWidth={selected ? 4 : 2} strokeDasharray={selected ? undefined : look.dash} />
{item.kind === 'label' && selected && <rect x={-w / 2} y={-h / 2} width={w} height={h} fill="none" stroke="var(--x-accent)" strokeWidth="2" strokeDasharray="6 4" />}
{text && (
<text x="0" y="0" textAnchor="middle" dominantBaseline="central" fill="var(--x-ink-2)" pointerEvents="none"
fontSize={Math.max(12, Math.min(28, h * 0.5, (w / Math.max(text.length, 1)) * 1.6))} fontWeight="600"
transform={`rotate(${-(item.rotation || 0)})`}>{text}</text>
fontSize={fs} fontWeight="600" transform={`rotate(${-(item.rotation || 0)})`}>{text}</text>
)}
{text && corner && (
<text x={-w / 2 + 10} y={-h / 2 + 10 + Math.min(16, fs) / 2} dominantBaseline="central" fill="var(--x-ink-2)" pointerEvents="none"
fontSize={Math.min(16, fs)} fontWeight="700" data-testid="floor-area-corner">{text}</text>
)}
</g>
)