feat(waiter): English-first texts, part a: shell, sign-in, tables, settings, venues (platform-v2 step 4.5a)

- @xenia/i18n: new `waiter` namespace (en + el); the waiter's Greek texts become keys
  with English written fresh (Greek kept as the translation).
- App gates, side drawer / nav bars / notifications, user menu, login, table list and
  cards, settings, venues + pairing errors, install dialog, lock screen, update banners,
  QR scanner, favourites setup.
- Money and times through useFormat() (venue time, the language's number format):
  table cards, quick table view, user menu, notifications.
- waiter i18n.js: tw() for code outside components (pairing errors).
- The table-list's FavoritesSetupPage `.map(t => …)` renamed so it doesn't shadow t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 03:50:33 +02:00
co-authored by Claude Opus 5.5
parent 8e0a786bbc
commit 37155c0457
20 changed files with 1229 additions and 375 deletions
+34 -27
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react'
import { useNavigate, useLocation } from 'react-router-dom'
import { useCan, useModule } from '@xenia/access'
import { useFormat, useTranslation } from '@xenia/i18n'
import UserMenu from './UserMenu'
import { useNotifications } from '../context/NotificationContext'
import useNotificationSettingsStore from '../store/notificationSettingsStore'
@@ -16,8 +17,8 @@ import useFailedPrintCount from '../hooks/useFailedPrintCount'
const NAV_REGISTRY = {
tables: {
key: 'tables',
label: 'Τραπέζια',
shortLabel: 'Τραπέζια',
label: 'nav.tables',
shortLabel: 'nav.tables',
href: '/tables?tab=tables',
match: (loc) => loc.pathname === '/tables' && loc.search !== '?tab=orders',
icon: (
@@ -31,8 +32,8 @@ const NAV_REGISTRY = {
},
orders: {
key: 'orders',
label: 'Ενεργές Παραγγελίες',
shortLabel: 'Παραγγελίες',
label: 'nav.activeOrders',
shortLabel: 'nav.orders',
href: '/tables?tab=orders',
match: (loc) => loc.pathname === '/tables' && loc.search === '?tab=orders',
icon: (
@@ -44,8 +45,8 @@ const NAV_REGISTRY = {
},
messages: {
key: 'messages',
label: 'Μηνύματα',
shortLabel: 'Μηνύματα',
label: 'nav.messages',
shortLabel: 'nav.messages',
href: '/messages',
match: (loc) => loc.pathname === '/messages',
icon: (
@@ -56,8 +57,8 @@ const NAV_REGISTRY = {
},
standalone: {
key: 'standalone',
label: 'Takeaway',
shortLabel: 'Takeaway',
label: 'nav.takeaway',
shortLabel: 'nav.takeaway',
href: '/tables',
match: () => false,
icon: (
@@ -70,8 +71,8 @@ const NAV_REGISTRY = {
},
'shift-overview': {
key: 'shift-overview',
label: 'Βάρδια',
shortLabel: 'Βάρδια',
label: 'nav.shift',
shortLabel: 'nav.shift',
href: '/shift-overview',
match: (loc) => loc.pathname === '/shift-overview',
icon: (
@@ -83,8 +84,8 @@ const NAV_REGISTRY = {
},
'order-log': {
key: 'order-log',
label: 'Αρχείο',
shortLabel: 'Αρχείο',
label: 'nav.log',
shortLabel: 'nav.log',
href: '/order-log',
match: (loc) => loc.pathname === '/order-log',
icon: (
@@ -206,14 +207,16 @@ function BellButton({ onClick, count }) {
// ─── Notification drawer ──────────────────────────────────────────────────────
function NotificationDrawer({ messages, onClose }) {
const { t } = useTranslation('waiter')
const { formatTime } = useFormat()
return (
<div className="modal-overlay" onClick={onClose}>
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ maxHeight: '80svh' }}>
<div className="modal-handle" />
<h2 className="modal-title" style={{ marginBottom: 8 }}>Ειδοποιήσεις</h2>
<h2 className="modal-title" style={{ marginBottom: 8 }}>{t('shell.notifications')}</h2>
{messages.length === 0 && (
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '24px 0' }}>
Δεν υπάρχουν ειδοποιήσεις
{t('shell.noNotifications')}
</p>
)}
<div style={{ display: 'flex', flexDirection: 'column', overflowY: 'auto', flex: 1 }}>
@@ -231,17 +234,17 @@ function NotificationDrawer({ messages, onClose }) {
)}
<div style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{msg.body}</div>
{tableIds.length > 0 && (
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>Τραπέζι: {tableIds.join(', ')}</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>{t('shell.notificationTables', { tables: tableIds.join(', ') })}</div>
)}
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 2 }}>
{new Date(msg.created_at).toLocaleTimeString('el-GR', { hour: '2-digit', minute: '2-digit' })}
{formatTime(msg.created_at)}
</div>
</div>
</div>
)
})}
</div>
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 4 }} onClick={onClose}>Κλείσιμο</button>
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 4 }} onClick={onClose}>{t('common.close')}</button>
</div>
</div>
)
@@ -253,7 +256,7 @@ const DRAWER_NAV_ITEMS = [
{ ...NAV_REGISTRY.tables },
{
key: 'standalone',
label: 'Takeaway / Delivery',
label: 'nav.takeawayDelivery',
href: '/tables',
match: () => false, // active state handled separately in SideDrawer
icon: (
@@ -268,7 +271,7 @@ const DRAWER_NAV_ITEMS = [
{ ...NAV_REGISTRY.messages },
{
key: 'shift-overview',
label: 'Σύνοψη Βάρδιας',
label: 'nav.shiftSummary',
href: '/shift-overview',
match: (loc) => loc.pathname === '/shift-overview',
icon: (
@@ -280,7 +283,7 @@ const DRAWER_NAV_ITEMS = [
},
{
key: 'order-log',
label: 'Αρχείο Παραγγελιών',
label: 'nav.orderLog',
href: '/order-log',
match: (loc) => loc.pathname === '/order-log',
icon: (
@@ -295,7 +298,7 @@ const DRAWER_NAV_ITEMS = [
const DRAWER_SETTINGS_ITEM = {
key: 'settings',
label: 'Settings',
label: 'nav.settings',
href: '/settings',
match: (loc) => loc.pathname.startsWith('/settings'),
icon: (
@@ -308,7 +311,7 @@ const DRAWER_SETTINGS_ITEM = {
const DRAWER_INSTALL_ITEM = {
key: 'install-app',
label: 'Εγκατάσταση εφαρμογής',
label: 'nav.installApp',
match: () => false,
icon: (
<svg width="22" height="22" viewBox="0 0 24 24" fill="none">
@@ -338,6 +341,7 @@ function InstallAppDrawerButton({ location, onClose }) {
}
function DrawerButton({ item, location, onNavigate, active: activeProp, onClick }) {
const { t } = useTranslation('waiter')
const active = activeProp ?? item.match(location)
return (
<button
@@ -353,7 +357,7 @@ function DrawerButton({ item, location, onNavigate, active: activeProp, onClick
}}
>
<span style={{ opacity: active ? 1 : 0.6, flexShrink: 0 }}>{item.icon}</span>
{item.label}
{t(item.label)}
{active && (
<div style={{ marginLeft: 'auto', width: 6, height: 6, borderRadius: '50%', background: 'var(--accent)' }} />
)}
@@ -362,6 +366,7 @@ function DrawerButton({ item, location, onNavigate, active: activeProp, onClick
}
function SideDrawer({ open, onClose }) {
const { t } = useTranslation('waiter')
const navigate = useNavigate()
const chatOn = useChatOn()
const location = useLocation()
@@ -406,13 +411,13 @@ function SideDrawer({ open, onClose }) {
{/* Drawer header */}
<div style={{ padding: '20px 20px 16px', borderBottom: '1px solid var(--border)' }}>
<div style={{ fontSize: 22, fontWeight: 800, color: 'var(--accent)', letterSpacing: -0.5 }}>Xenia</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>POS System</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>{t('shell.posSystem')}</div>
</div>
{/* Main nav items */}
<div style={{ flex: 1, padding: '12px 10px', display: 'flex', flexDirection: 'column', gap: 4, overflowY: 'auto' }}>
<div style={{ fontSize: 10, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 1, padding: '4px 10px 8px' }}>
Πλοήγηση
{t('shell.navigation')}
</div>
{DRAWER_NAV_ITEMS.filter(shown(chatOn)).map(item => {
const isStandaloneActive = location.pathname === '/tables' && activeZoneTab === 'standalone'
@@ -461,6 +466,7 @@ function PillBadge({ count, color = '#ef4444' }) {
}
function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems }) {
const { t } = useTranslation('waiter')
const { activeZoneTab, setActiveZoneTab } = useTableViewStore()
const chatOn = useChatOn()
const items = (tripleItems || ['tables', 'orders', 'messages']).map(k => NAV_REGISTRY[k]).filter(Boolean).filter(shown(chatOn))
@@ -513,7 +519,7 @@ function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems })
{item.key === 'orders' && <svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"/><path d="M9 12h6M9 16h4" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"/></svg>}
{item.key === 'messages' && <svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg>}
</span>
{item.shortLabel ?? item.label}
{t(item.shortLabel ?? item.label)}
{badge && <PillBadge count={badge.count} color={badge.color} />}
</button>
)
@@ -526,6 +532,7 @@ function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems })
// ─── Icon navbar footer ───────────────────────────────────────────────────────
function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
const { t } = useTranslation('waiter')
const { activeZoneTab, setActiveZoneTab } = useTableViewStore()
const chatOn = useChatOn()
const items = navItems
@@ -597,7 +604,7 @@ function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
)}
</span>
<span style={{ fontSize: 10, fontWeight: active ? 700 : 500, letterSpacing: 0.2 }}>
{item.shortLabel ?? item.label}
{t(item.shortLabel ?? item.label)}
</span>
</button>
)