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:
+20
-15
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
|
||||
import { BrowserRouter, Routes, Route, Navigate, Outlet, useNavigate } from 'react-router-dom'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { AccessProvider, useAccess, useCan, useModule } from '@xenia/access'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
import { i18n } from './i18n'
|
||||
import useAuthStore from './store/authStore'
|
||||
import useShiftStore from './store/shiftStore'
|
||||
@@ -40,6 +41,7 @@ import { deliveryMode, getActiveVenue } from './config/server'
|
||||
// ─── Utility ─────────────────────────────────────────────────────────────────
|
||||
|
||||
function Spinner() {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div className="page page--centered" style={{ gap: 12 }}>
|
||||
<div style={{
|
||||
@@ -49,7 +51,7 @@ function Spinner() {
|
||||
borderRadius: '50%',
|
||||
animation: 'gate-spin 0.7s linear infinite',
|
||||
}} />
|
||||
<span style={{ color: 'var(--muted)', fontSize: 14 }}>Φόρτωση…</span>
|
||||
<span style={{ color: 'var(--muted)', fontSize: 14 }}>{t('common.loading')}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -84,30 +86,33 @@ function GateBtn({ onClick, disabled, variant = 'primary', children }) {
|
||||
}
|
||||
|
||||
function ClosedScreen({ onRefresh, onLogout }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<GateCard emoji="🔒" title="Εστιατόριο κλειστό"
|
||||
subtitle={'Δεν υπάρχει ενεργή ημέρα λειτουργίας.\nΖητήστε από τον διαχειριστή να ανοίξει την ημέρα.'}>
|
||||
<GateCard emoji="🔒" title={t('gate.closedTitle')}
|
||||
subtitle={t('gate.closedBody')}>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>Ανανέωση</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>Αποσύνδεση</GateBtn>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>{t('common.refresh')}</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>{t('common.signOut')}</GateBtn>
|
||||
</div>
|
||||
</GateCard>
|
||||
)
|
||||
}
|
||||
|
||||
function WaitingManagerScreen({ onRefresh, onLogout }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<GateCard emoji="⏳" title="Αναμονή για έναρξη βάρδιας"
|
||||
subtitle="Ζητήστε από τον διαχειριστή να ξεκινήσει τη βάρδια σας.">
|
||||
<GateCard emoji="⏳" title={t('gate.waitingTitle')}
|
||||
subtitle={t('gate.waitingBody')}>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>Ανανέωση</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>Αποσύνδεση</GateBtn>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>{t('common.refresh')}</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>{t('common.signOut')}</GateBtn>
|
||||
</div>
|
||||
</GateCard>
|
||||
)
|
||||
}
|
||||
|
||||
function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [startingCash, setStartingCash] = useState('')
|
||||
const [starting, setStarting] = useState(false)
|
||||
const [error, setError] = useState(null)
|
||||
@@ -118,14 +123,14 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
try {
|
||||
await onStart(startingCash ? parseFloat(startingCash) : null)
|
||||
} catch (e) {
|
||||
setError(apiError(e, 'Σφάλμα εκκίνησης βάρδιας'))
|
||||
setError(apiError(e, t('gate.startFailed')))
|
||||
setStarting(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<GateCard emoji="👋" title={`Καλώς ήρθες, ${username}!`}
|
||||
subtitle="Θέλεις να ξεκινήσεις τη βάρδια σου;">
|
||||
<GateCard emoji="👋" title={t('gate.welcome', { name: username })}
|
||||
subtitle={t('gate.startQuestion')}>
|
||||
<div style={{
|
||||
width: '100%', maxWidth: 320,
|
||||
background: 'var(--bg2)', border: '1px solid var(--border)',
|
||||
@@ -134,7 +139,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
}}>
|
||||
<div>
|
||||
<label style={{ fontSize: 13, fontWeight: 600, color: 'var(--muted)', display: 'block', marginBottom: 6 }}>
|
||||
Αρχικά μετρητά (προαιρετικό)
|
||||
{t('gate.startingCash')}
|
||||
</label>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<span style={{ color: 'var(--muted)', fontWeight: 700 }}>€</span>
|
||||
@@ -160,7 +165,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
)}
|
||||
|
||||
<GateBtn onClick={handleStart} disabled={starting}>
|
||||
{starting ? 'Εκκίνηση…' : '▶ Έναρξη Βάρδιας'}
|
||||
{starting ? t('gate.starting') : `▶ ${t('gate.startShift')}`}
|
||||
</GateBtn>
|
||||
</div>
|
||||
|
||||
@@ -168,7 +173,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
style={{ fontSize: 13, color: 'var(--muted)', background: 'none', border: 'none', cursor: 'pointer' }}
|
||||
onClick={onLogout}
|
||||
>
|
||||
Αποσύνδεση
|
||||
{t('common.signOut')}
|
||||
</button>
|
||||
</GateCard>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user