Port of the manager's KdsPage.jsx into terminal/src/apps/kds, split into pure logic (layout packing, age, buckets, rounds, totals, status cycle, settings; unit-tested) and components (card, item, action bars, dialogs, item totals, rails, settings panel). - Settings are the device's config; the settings panel saves them (managers only), zoom changes the size for the session. - Orders reload on live events and every reconnect; polling only while the live connection is down (DeviceProvider exposes liveUp; useLiveEvents helper). - "Tap to start" unlocks sound; venue clock via useFormat; English-first texts. - Undo of an item recomputes the order status at once; undo/redo clear the selection. - Tests: terminal unit +15, terminal.mjs +12 KDS checks (no polling, live order + chime, item/undo/prepare/decline, settings permission, change made elsewhere), backend regression for an item back to pending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
// ESLint for the terminal (plan step 3.1b): the same rules as the manager and the waiter.
|
|
// All of src is checked (new code).
|
|
import js from '@eslint/js'
|
|
import globals from 'globals'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
|
|
export default defineConfig([
|
|
globalIgnores(['dist', 'dev-dist']),
|
|
{
|
|
files: ['**/*.{js,jsx}'],
|
|
extends: [
|
|
js.configs.recommended,
|
|
reactHooks.configs.flat.recommended,
|
|
reactRefresh.configs.vite,
|
|
],
|
|
languageOptions: {
|
|
ecmaVersion: 2020,
|
|
globals: globals.browser,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
ecmaFeatures: { jsx: true },
|
|
sourceType: 'module',
|
|
},
|
|
},
|
|
rules: {
|
|
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]', argsIgnorePattern: '^[A-Z_]' }], // components passed as props (Icon)
|
|
// Loading data in an effect (`useEffect(() => { load() }, [load])`, setState after the
|
|
// await) is flagged too; it's what the screens do, so a warning, as in the manager.
|
|
'react-hooks/set-state-in-effect': 'warn',
|
|
},
|
|
},
|
|
{
|
|
files: ['tests/**/*.mjs', '*.config.js'],
|
|
languageOptions: { globals: globals.node },
|
|
},
|
|
])
|