feat: the table map (platform-v2 step 6.8, D-31)
- floor_plans / floor_items (0035), tables' plan_id + width/height/rotation/shape; /api/floor-plans (set-up, catalog.tables.manage, floor_plans.changed) and /api/floor-plans/live (each table's state, guests, waiters, time; zone rule) - @xenia/floorplan: the drawing (Floor, Item, TableShape, FloorView) and its geometry (grid snap in whole cells, outlines, chairs), tested - manager: Management -> Tables -> Floor plans (editor: drag, grid, irregular floor, walls/bar/labels/areas, background picture), Tables page List / Map - counter POS: Tables List / Map; waiter: Map mode, the list stays the default - tests: test_floor_plans.py, floor + geometry unit tests, manager/waiter/terminal e2e Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { useAllowed } from '@xenia/access'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import TableCard from '../components/TableCard'
|
||||
import FloorMapView from '../components/FloorMapView'
|
||||
import useAuthStore from '../store/authStore'
|
||||
import useTableColourStore from '../store/tableColourStore'
|
||||
import useConnectionStore from '../store/connectionStore'
|
||||
@@ -334,6 +335,8 @@ export default function TableListPage() {
|
||||
const PULL_THRESHOLD = 72
|
||||
|
||||
const navigate = useNavigate()
|
||||
const { t: tc } = useTranslation('common')
|
||||
const [mapView, setMapView] = useState(false) // 6.8: the floor plans; the page always opens on the list (D-31)
|
||||
const [searchParams] = useSearchParams()
|
||||
const pageTab = searchParams.get('tab') === 'orders' ? 'orders' : 'tables'
|
||||
const filterBtnRef = useRef(null)
|
||||
@@ -675,10 +678,20 @@ export default function TableListPage() {
|
||||
onClick={() => setActiveZoneTab(effectiveZoneTab === g.id ? 'all' : g.id)}
|
||||
/>
|
||||
))}
|
||||
<span style={{ flex: 1 }} />
|
||||
<button type="button" onClick={() => setMapView(v => !v)} aria-pressed={mapView} data-testid="tables-map-toggle"
|
||||
style={{ flexShrink: 0, padding: '6px 12px', borderRadius: 999, fontWeight: 700, fontSize: 13, cursor: 'pointer',
|
||||
border: `1.5px solid ${mapView ? 'var(--x-accent)' : 'var(--x-line)'}`,
|
||||
background: mapView ? 'var(--x-accent-soft)' : 'var(--x-surface)', color: mapView ? 'var(--x-accent-ink)' : 'var(--x-ink-2)' }}>
|
||||
{mapView ? tc('floorMap.list') : tc('floorMap.map')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* ── Standalone view OR Table grid ────────────────────────────────── */}
|
||||
{effectiveZoneTab === 'standalone' ? (
|
||||
{mapView && effectiveZoneTab !== 'standalone' ? (
|
||||
<FloorMapView zone={effectiveZoneTab === 'all' ? null : effectiveZoneTab}
|
||||
onPick={tb => navigate(tb.order ? `/tables/${tb.id}` : `/tables/${tb.id}/add?new=1`)} />
|
||||
) : effectiveZoneTab === 'standalone' ? (
|
||||
<StandaloneView orders={orders} gridCols={gridCols} navigate={navigate} />
|
||||
) : (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user