Skip to content

Restaurant Floor Plan Editor

Status: built, November 2026. This records the design of the Floor plan card on the admin dining room page (admin/dining/room.html, drawn by admin-dining-room.js, styled in admin-dining.css under dr-plan). A manager lays the room out here. Badger POS will show the same plan on the Floor (planned: until then the app's Floor still lays tables out as a grid). How the floor plan data works (units, shapes, checks, overlaps, MCP) is in Table service; the shop owner's guide is Table bookings.

Decisions

  • One room object, three views of it. The page already loads the room as JSON, keeps every edit in that one object and saves it whole. The plan, the side panel and the Tables list all edit the same table objects, and each redraws the others after a change (the panel isn't redrawn by its own edits, so the field being typed in keeps its focus). There is no new endpoint and no second save: the page's save bar, problems callout and floor-plan warnings callout cover the plan too.
  • Tables are buttons, not a canvas. Each placed table is an absolutely positioned <button> named like "Table 8, seats 4 to 6", so it can be reached with Tab, selected with Enter or Space and read by a screen reader. Arrow keys move the selected table 10 cm (50 cm with Shift), R turns it by 15° (Shift+R back), and Escape clears the selection. Moves and turns are announced in a polite live region. Width and depth are fields in the panel, so resizing doesn't need a pointer.
  • The plan is quiet. Grey tables on a dotted inset, dashed area outlines, and the brand colour only on the selected table and its handles, as on the rest of the admin. A table's label stays upright when it is turned, and a table too small to show its seats at the current zoom shows only its name.
  • Areas are drawn from their tables. An area has no geometry of its own: its outline is the box round its placed tables (turned tables included), plus 30 cm, with room above for its name. Moving a table moves its area's outline. Tables with no area get no outline.
  • The plane grows with the room. It is at least 1000 × 640 cm and reaches 200 cm past the furthest table, so dragging a table to the edge makes room. A 48 px margin is drawn round the room at every zoom, so the turn handle and corner grips of a table against the top or left wall can still be grabbed. Zoom is 50% to 200% in 10% steps, starting at the zoom that fits the card's width (never above 100%) and refitting as the window changes width until a zoom button is used; a zoom button keeps the middle of the view where it was. The viewport keeps room for its scrollbar (scrollbar-gutter: stable), so a scrollbar appearing doesn't change the width and refit the zoom back and forth. The zoom figure is only rewritten when it changes, so a screen reader doesn't read it out after every move.
  • Snapping is on by default. Moving and resizing snap to 10 cm, which is fine enough for a restaurant and keeps tables in line. The toolbar's Snap to 10 cm turns it off (1 cm steps). Turning is always in 15° steps.
  • Round, square and bar-seat tables stay square. Resizing one keeps its width and depth equal, and changing a table to one of those shapes makes it square. Rectangles and booths resize freely. A table with no shape is drawn as a rectangle.
  • Positions stay inside what a save accepts. Sizes are clamped to 20 to 2000 cm and positions to 0 to 10000 cm while dragging, so the editor can't make a room the server refuses. Every move, turn and resize also keeps the turned table off the plan's top and left edges, so no end of it is cut off. A run of turns (R or the Turn slider) starts each turn from where the table stood before the run, so a table pushed off the wall by a turn comes back when it is turned back. Resizing from a corner keeps the opposite corner where it was, in the table's own turned axes, and stops at the wall rather than growing the table the other way. The server's overlap warning uses the same turned boxes as the editor's clash check. This geometry has no DOM and lives in dining-floor-plan.js, loaded before the editor and tested with node:test (web-mvc/src/test/js/dining-floor-plan.test.js).
  • A save doesn't undo work done while it runs. If the room changed while the save was on its way (a drag, a nudge, a new table), the editor keeps those changes, takes the room's new version from the save so the next save isn't refused as someone else's, and the save bar still shows unsaved changes; a save that comes back mid-drag waits for the drag to end. While a save is on its way, a second save (Cmd/Ctrl+S) and Discard do nothing. Only a drag's own pointer moves, drops or cancels it, so a second finger on an iPad does nothing to it. A save that brings back overlap warnings says so in its toast ("Check 2 floor plan warnings") and scrolls the warnings callout into view.
  • New tables land where the manager is looking. The toolbar adds a table in the middle of the visible part of the plane, in the selected table's area (or the first area), with a size and seats for its shape. It takes the next free number as its name and also appears in the list. A table placed this way (or dropped from the tray, or made with Duplicate, which starts beside the original) that would cover another table moves out a table's width at a time, right, down, left, up and then diagonally, to the first clear spot, so placing one doesn't bring an overlap warning on the next save.
    • Round: 90 × 90 cm, 2 to 4 guests.
    • Square: 70 × 70 cm, 1 to 2 guests.
    • Rectangle: 120 × 80 cm, 2 to 4 guests.
    • Booth: 160 × 110 cm, 4 to 6 guests.
    • Bar seat: 45 × 45 cm, 1 guest.
  • "Not placed yet" is how old rooms arrive. Every table without a full position waits in a tray under the plane. A table is dragged in, or placed in the middle of the view with its Place button (the keyboard way), and gets its shape's size, or 70 × 70 / 120 × 80 by its seats if it has no shape. Take off the plan clears its position, size and turn and sends it back to the tray. The card's header badge says "12 of 14 tables placed": amber until every table is placed, then green.
  • Narrow screens. The panel sits beside the plane when the card's body is at least 680 px wide (a container query, since the booking tester takes a 360 px column beside the page in windows 1400 px and wider, leaving the card about 750 px wide) and under it otherwise. The threshold is set so a wide desktop, the commonest case, keeps the panel beside a plane of about 400 px rather than dropping it under a 70vh plane. The panel's five shapes sit in two rows of three. The plane scrolls in its own box, sideways on a phone. The editor is usable on a phone but not designed for one. On a phone or a touch screen the tray's chips, the zoom buttons and the tray and panel buttons are 44 px tall, and the corner grips and turn handle have 44 px invisible targets, as the admin's touch-target guideline asks.

Not done

  • Fixtures (walls, the bar counter, the kitchen pass) aren't modelled. They would be a list on the room with the same geometry fields and no booking meaning.
  • A traced background: keeping a photo of the paper plan faint behind the plane would need an admin upload (a media id on the room).
  • Selecting several tables to move them together, and undo beyond Discard.
  • The plan in Badger POS. The app's Floor still lays tables out as a grid; showing this plan there is the next phase.

Mock-ups

  • Floor plan mock-up, November 2026: the admin editor beside the Badger POS plan view on an iPad and a phone, using the Ember demo room. Working material; this page records what shipped.