feat(manager): remove the KDS page; app cards lead to pairing a screen (platform-v2 3.2d)

- Deleted pages/KdsPage.jsx, its /kds route, nav entry and text: the kitchen display
  runs only on paired screens (D-25).
- Apps: cards of apps that run on a screen get "Set up a screen" (core.devices.manage)
  → /devices?pair=<app>, which opens the pair dialog on that app.
- manager.mjs: no "Open" on the KDS card, "Set up a screen" lands on the pair dialog,
  /kds is gone; the module-off rule stays covered by the Notes checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 20:46:50 +02:00
co-authored by Claude Opus 5.5
parent 6b237fd169
commit b1112b249e
9 changed files with 36 additions and 3049 deletions
File diff suppressed because it is too large Load Diff
@@ -9,6 +9,7 @@
// - Per-app settings (3.1a): each app's device_app.config fields are rendered by
// DeviceConfigFields in the pair and edit dialogs and sent as `config`.
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useSearchParams } from 'react-router-dom'
import toast from 'react-hot-toast'
import { MonitorSmartphone, Plus } from 'lucide-react'
import { errorMessage, parseError } from '@xenia/api'
@@ -52,6 +53,15 @@ export default function DevicesPage() {
useEffect(() => { load() }, [load])
const apps = useMemo(() => (modules || []).filter(m => m.device_app), [modules])
// /devices?pair=<app> (Apps → "Set up a screen", 3.2d): open the pair dialog on that app
const [params, setParams] = useSearchParams()
const pairApp = params.get('pair')
useEffect(() => {
if (!pairApp || !modules) return
setDialog({ kind: 'pair', app: pairApp })
setParams({}, { replace: true })
}, [pairApp, modules, setParams])
const appOn = key => !!apps.find(a => a.key === key)?.effective
const usage = useMemo(() => (devices && modules ? deviceUsage(devices, modules) : {}), [devices, modules])
const appName = key => t(`modules:${key}.name`, { defaultValue: key })
@@ -159,7 +169,7 @@ export default function DevicesPage() {
</label>
{dialog?.kind === 'pair' && (
<PairDialog apps={apps} usage={usage} devices={live} appName={appName} limitLabel={limitLabel}
<PairDialog apps={apps} usage={usage} devices={live} appName={appName} limitLabel={limitLabel} initialApp={dialog.app}
onClose={() => setDialog(null)}
onPair={body => act(() => client.post('/api/devices', body), t('devices.paired', { name: body.name }))} />
)}
@@ -200,11 +210,11 @@ function useSubmit(fn) {
return { busy, error, run }
}
function PairDialog({ apps, usage, devices, appName, limitLabel, onClose, onPair }) {
function PairDialog({ apps, usage, devices, appName, limitLabel, initialApp, onClose, onPair }) {
const { t } = useTranslation('manager')
const usable = apps.filter(a => a.effective)
const [code, setCode] = useState('')
const [appKey, setAppKey] = useState(usable.find(a => hasRoom(usage, a.key))?.key || usable[0]?.key || '')
const [appKey, setAppKey] = useState(usable.find(a => a.key === initialApp)?.key || usable.find(a => hasRoom(usage, a.key))?.key || usable[0]?.key || '')
const [name, setName] = useState('')
const [mode, setMode] = useState('')
const [link, setLink] = useState('')
@@ -13,8 +13,9 @@ import { Button, Dialog, EmptyState, Spinner, Switch } from '@xenia/ui'
import client from '../../api/client'
import { moduleState, stoppedBy } from './modulesLogic'
// Modules with a page in the manager: the card gets an "Open" button
const OPEN_PATH = { kds: '/kds', caller_id: '/apps/phone' }
// Modules with a page in the manager: the card gets an "Open" button. Apps that run on a paired
// screen (the KDS since 3.2d) get "Set up a screen" instead → Devices, pair dialog on that app.
const OPEN_PATH = { caller_id: '/apps/phone' }
export function AppsPage() {
const { t } = useTranslation('manager')
@@ -118,6 +119,7 @@ function ModulesPage({ kinds, intro }) {
function ModuleCard({ m, modules, canManage, busy, onToggle }) {
const { t } = useTranslation('manager')
const canPair = useCan('core.devices.manage')
const navigate = useNavigate()
const name = t(`modules:${m.key}.name`)
const state = moduleState(m)
@@ -164,6 +166,9 @@ function ModuleCard({ m, modules, canManage, busy, onToggle }) {
{OPEN_PATH[m.key] && state === 'on' && (
<div><Button size="sm" variant="secondary" onClick={() => navigate(OPEN_PATH[m.key])}>{t('modules.open')}</Button></div>
)}
{m.device_app && state === 'on' && canPair && (
<div><Button size="sm" variant="secondary" onClick={() => navigate(`/devices?pair=${m.key}`)}>{t('modules.setUpScreen')}</Button></div>
)}
</div>
)
}