feat(waiter): English-first texts, part c: shift, log, chat, offline, notifications; language switch; guard (platform-v2 step 4.5c)
- Shift overview, order log, chat list / thread, offline + server search + rediscovery screens, notifications, the refused-lines sheet and the offline queue's reasons become keys; times and dates through useFormat() in the venue's clock. - User menu: the other language(s) (data-testid menu-language-<lng>), saved to the person's profile (PATCH /api/auth/me) and the bootstrap reloaded (D-12). - tests/no-greek.test.mjs: no Greek letter in waiter_pwa/src (the one Greek word the app recognises in staff messages is a \u escape). - e2e: the test venue is English: waiter / browser / android use the English texts; waiter.mjs +3 (English by default, switch to Greek at once and saved, after reload); android bundle checks print what they saw when they fail. - Pack README: the waiter texts rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,14 @@ import { useEffect, useState } from 'react'
|
||||
import db from '../db/posdb'
|
||||
import { clearRefusedLines, refusedLines } from '../services/offlineOrders'
|
||||
import useAuthStore from '../store/authStore'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
// Lines of an order taken offline that the server refused when the phone came back (plan
|
||||
// step 4.4): a product taken off the menu meanwhile, an option deleted, a price change not
|
||||
// allowed. They are never dropped silently: this sheet lists them, with the reason, until the
|
||||
// waiter confirms they've seen them (and dealt with the table).
|
||||
export default function RefusedLines() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const token = useAuthStore(s => s.token)
|
||||
const [lines, setLines] = useState([])
|
||||
|
||||
@@ -30,9 +32,9 @@ export default function RefusedLines() {
|
||||
<div className="modal-overlay" data-testid="refused-lines">
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Δεν στάλθηκαν</h2>
|
||||
<h2 className="modal-title">{t('refused.title')}</h2>
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 14px' }}>
|
||||
Τα παρακάτω πάρθηκαν χωρίς σύνδεση και ο server δεν τα δέχτηκε. Ελέγξτε τα τραπέζια.
|
||||
{t('refused.body')}
|
||||
</p>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginBottom: 16, maxHeight: '45vh', overflowY: 'auto' }}>
|
||||
{lines.map((l, i) => (
|
||||
@@ -46,7 +48,7 @@ export default function RefusedLines() {
|
||||
))}
|
||||
</div>
|
||||
<button className="btn btn--primary" style={{ width: '100%' }} data-testid="refused-lines-ok" onClick={() => clearRefusedLines()}>
|
||||
Το είδα
|
||||
{t('refused.ok')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import useConnectionStore from '../store/connectionStore'
|
||||
import { canRediscover, rediscover, upgradeToTls } from '../native/autoRediscover'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const WATCHDOG_MS = 60_000
|
||||
const RELOAD_DELAY_MS = 1500
|
||||
@@ -20,6 +21,7 @@ const RELOAD_DELAY_MS = 1500
|
||||
* IndexedDB and syncs after the reload.
|
||||
*/
|
||||
export default function ServerRediscovery() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [movedTo, setMovedTo] = useState(null)
|
||||
const enabled = canRediscover()
|
||||
|
||||
@@ -65,10 +67,10 @@ export default function ServerRediscovery() {
|
||||
<div>
|
||||
<div style={{ fontSize: 44, marginBottom: 12 }}>🔄</div>
|
||||
<p style={{ color: '#e2e8f0', fontSize: 17, fontWeight: 600, marginBottom: 6 }}>
|
||||
Ο server άλλαξε διεύθυνση
|
||||
{t('offline.moved')}
|
||||
</p>
|
||||
<p style={{ color: '#94a3b8', fontSize: 14, fontFamily: 'monospace' }}>{movedTo}</p>
|
||||
<p style={{ color: '#94a3b8', fontSize: 14, marginTop: 10 }}>Επανασύνδεση…</p>
|
||||
<p style={{ color: '#94a3b8', fontSize: 14, marginTop: 10 }}>{t('offline.reconnecting')}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user