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:
@@ -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('')
|
||||
|
||||
Reference in New Issue
Block a user