Includes all work to date: - local_backend: FastAPI backend with products, orders, tables, shifts, cloud sync - manager_dashboard: React manager UI with product/category management, reports, settings - waiter_pwa: React PWA for waiter devices - Category reparent endpoint and UI - Waiter domain: local_ip sent on heartbeat, waiter_domain persisted from cloud response - QR code modal in AppInfoTab for waiter domain - Product form: number input spinners removed, category pre-selected on new product - Category row: count badge moved to far right Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.1 KiB
React
41 lines
1.1 KiB
React
import { useEffect, useState } from 'react'
|
|
import useConnectionStore from '../store/connectionStore'
|
|
|
|
export default function EmergencyBar() {
|
|
const { status, lostAt } = useConnectionStore()
|
|
const [elapsed, setElapsed] = useState('')
|
|
|
|
useEffect(() => {
|
|
if (status !== 'emergency' || !lostAt) return
|
|
function tick() {
|
|
const secs = Math.floor((Date.now() - lostAt.getTime()) / 1000)
|
|
const m = Math.floor(secs / 60)
|
|
const s = secs % 60
|
|
setElapsed(`${m}:${String(s).padStart(2, '0')}`)
|
|
}
|
|
tick()
|
|
const id = setInterval(tick, 1000)
|
|
return () => clearInterval(id)
|
|
}, [status, lostAt])
|
|
|
|
if (status !== 'emergency') return null
|
|
|
|
return (
|
|
<div style={{
|
|
background: '#dc2626',
|
|
color: '#fef08a',
|
|
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
gap: 8,
|
|
padding: '8px 16px',
|
|
fontSize: 13, fontWeight: 700,
|
|
letterSpacing: 0.5,
|
|
userSelect: 'none',
|
|
}}>
|
|
<span>EMERGENCY MODE</span>
|
|
{elapsed && (
|
|
<span style={{ opacity: 0.85, fontWeight: 400 }}>({elapsed})</span>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|