feat: bump client-services (accumulated feature work + deploy fixes)

Snapshot of in-progress work across local_backend, manager_dashboard,
and waiter_pwa (pricing, chat, fiscal, prep zones, recovery codes, CRM,
inventory, permissions), plus the nginx/docker-compose deploy fixes for
the Unraid + NPM reverse-proxy setup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 10:00:14 +03:00
co-authored by Claude Sonnet 5
parent 02ec1aa28f
commit 34ae328b0d
182 changed files with 34874 additions and 3556 deletions
+93 -5
View File
@@ -6,6 +6,7 @@ import useShiftStore from './store/shiftStore'
import useThemeStore from './store/themeStore'
import useTableColourStore from './store/tableColourStore'
import useConnectionStore from './store/connectionStore'
import useWaiterFavoritesStore from './store/waiterFavoritesStore'
import client from './api/client'
import LoginPage from './pages/LoginPage'
import TableListPage from './pages/TableListPage'
@@ -13,9 +14,16 @@ import TableDetailPage from './pages/TableDetailPage'
import AddItemsPage from './pages/AddItemsPage'
import OfflinePage from './pages/OfflinePage'
import SettingsPage from './pages/SettingsPage'
import FavoritesSetupPage from './pages/FavoritesSetupPage'
import ChatListPage from './pages/ChatListPage'
import ChatThreadPage from './pages/ChatThreadPage'
import ShiftOverviewPage from './pages/ShiftOverviewPage'
import OrderLogPage from './pages/OrderLogPage'
import { NotificationProvider } from './context/NotificationContext'
import { SSEProvider } from './context/SSEContext'
import ConnectionLostModal from './components/ConnectionLostModal'
import ConnectivityBar from './components/ConnectivityBar'
import AppShell from './components/AppShell'
import UpdatePrompt from './components/UpdatePrompt'
// ─── Utility ─────────────────────────────────────────────────────────────────
@@ -278,7 +286,7 @@ function OfflineListener() {
const { status } = useConnectionStore()
useEffect(() => {
function handler() {
// If user is logged in, ConnectionLostModal handles it — don't redirect to /offline
// If user is logged in, ConnectivityBar handles it — don't redirect to /offline
if (token && status !== 'online') return
// Not logged in and server is down → redirect to offline page
if (!token) navigate('/offline')
@@ -297,6 +305,46 @@ function ThemeApplier() {
return null
}
// Prevents the Android back gesture/button from exiting the PWA.
//
// Strategy: whenever the browser lands on /tables (the root screen), immediately
// push a sentinel entry so there is always one history entry behind it. If the
// user backs into the sentinel we push it again — they can never back past /tables.
//
// Only active when running as an installed PWA (standalone display mode).
function AndroidBackGuard() {
useEffect(() => {
const isStandalone = window.matchMedia('(display-mode: standalone)').matches
|| window.navigator.standalone === true
if (!isStandalone) return
function pushSentinel() {
history.pushState({ pwaGuard: true }, '')
}
// If we're already on the root screen at mount time, push the sentinel now.
if (window.location.pathname === '/tables' || window.location.pathname === '/') {
pushSentinel()
}
function onPopState(e) {
if (e.state?.pwaGuard) {
// User backed into the sentinel — push it again so there's always one more.
pushSentinel()
return
}
// User backed to /tables (the real root screen) — push the sentinel behind it.
if (window.location.pathname === '/tables' || window.location.pathname === '/') {
pushSentinel()
}
}
window.addEventListener('popstate', onPopState)
return () => window.removeEventListener('popstate', onPopState)
}, [])
return null
}
function ColourLoader() {
const loadFromBackend = useTableColourStore(s => s.loadFromBackend)
useEffect(() => {
@@ -310,6 +358,15 @@ function ColourLoader() {
return null
}
function FavoritesLoader() {
const { token } = useAuthStore()
const loadFromServer = useWaiterFavoritesStore(s => s.loadFromServer)
useEffect(() => {
if (token) loadFromServer()
}, [token])
return null
}
// ─── Login guard — redirect to /tables if already authenticated ───────────────
function LoginGuard({ children }) {
@@ -318,6 +375,26 @@ function LoginGuard({ children }) {
return children
}
// ─── ChatListPage wrapper — owns showNewChat state so pencil can live in AppShell ──
function ChatListRoute() {
return (
<AppShell>
<ChatListPage />
</AppShell>
)
}
// ─── TableListPage wrapper ────────────────────────────────────────────────────
function TableListRoute() {
return (
<AppShell>
<TableListPage />
</AppShell>
)
}
// ─── App ──────────────────────────────────────────────────────────────────────
const queryClient = new QueryClient()
@@ -327,22 +404,33 @@ export default function App() {
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<ThemeApplier />
<AndroidBackGuard />
<ColourLoader />
<FavoritesLoader />
<AuthRehydrator />
<OfflineListener />
<SSEProvider>
<NotificationProvider>
<ConnectionLostModal />
<ConnectivityBar />
<UpdatePrompt />
<Routes>
<Route path="/login" element={<LoginGuard><LoginPage /></LoginGuard>} />
<Route path="/offline" element={<OfflinePage />} />
<Route element={<AppLayout />}>
<Route path="/tables" element={<TableListPage />} />
<Route index element={<Navigate to="/tables?tab=tables" replace />} />
<Route path="/tables" element={<TableListRoute />} />
<Route path="/tables/:tableId" element={<TableDetailPage />} />
<Route path="/tables/:tableId/add" element={<AddItemsPage />} />
<Route path="/standalone/:orderType/add" element={<AddItemsPage />} />
<Route path="/orders/:orderId" element={<TableDetailPage />} />
<Route path="/settings" element={<SettingsPage />} />
<Route path="/settings/favorites" element={<FavoritesSetupPage />} />
<Route path="/shift-overview" element={<ShiftOverviewPage />} />
<Route path="/order-log" element={<OrderLogPage />} />
<Route path="/messages" element={<ChatListRoute />} />
<Route path="/messages/:conversationId" element={<ChatThreadPage />} />
</Route>
<Route path="*" element={<Navigate to="/tables" replace />} />
<Route path="*" element={<Navigate to="/tables?tab=tables" replace />} />
</Routes>
</NotificationProvider>
</SSEProvider>