Files
xenia-pos-local/manager_dashboard/src/pages/Settings/sections/VenueSettings.jsx
T
bonaminandClaude Opus 5.5 e708202f3a feat(manager): help tips on the settings and fields people tend to misread
Owner 2026-11-23 (plan 6F.1b): 26 new tips in English and Greek: Operation (own shifts, hidden
takings, card payments, closing tables, the serve step, courses, quick notes), Sign-in (waiter and
device modes, usernames, one session, idle sign-out), venue language and time zone, the fiscal
device, locking, the server's address, the product editor (unit, available, quick add, VAT group,
cost), a device's sign-in, a person's role, the cash counted at a shift's end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 06:41:37 +02:00

52 lines
3.0 KiB
React

// Venue language and time zone (plan step 2.6f, D-11, D-12): venue.language is the
// language of staff without their own choice and of printed tickets/reports; venue.timezone
// is the zone every time is shown in (applies at once); venue.theme is the staff apps' accent
// colour (plan step 4.6: the waiter's phones; 6R.20: "The venue's identity" = its first colour, for
// the phones and every screen of the terminal). All reload bootstrap after saving.
import { useId, useMemo } from 'react'
import { useAccess } from '@xenia/access'
import { LANGUAGE_NAMES, useTranslation, useFormat } from '@xenia/i18n'
import { Select, Spinner } from '@xenia/ui'
import { SettingRow, SettingsCard } from './SettingsCard'
import { useSettings } from './useSettings'
import { useIdentity } from '../../../shell/useIdentity'
import { timeZones } from './timeZones'
const VENUE_THEMES = ['amber', 'teal', 'blue', 'violet', 'rose', 'identity'] // packages/ui tokens.css data-venue-theme; identity: venueAccent.js
export default function VenueSettings() {
const { t } = useTranslation('manager')
const f = useFormat()
const { languages } = useAccess()
const s = useSettings()
const { data: identity } = useIdentity()
const langId = useId()
const tzId = useId()
const themeId = useId()
const tz = s.get('venue.timezone', 'Europe/Athens')
const zones = useMemo(() => timeZones(tz), [tz])
if (s.loading) return <div className="py-8 flex justify-center"><Spinner /></div>
return (
<SettingsCard title={t('settings.venue.title')} testId="settings-venue">
<SettingRow label={t('settings.venue.language')} htmlFor={langId} hint={t('settings.venue.languageHint')} tip={t('settings.venue.languageTip')}>
<Select id={langId} value={s.get('venue.language', 'en')} disabled={s.saving} data-testid="setting-venue.language"
onChange={e => s.save('venue.language', e.target.value)}
options={(languages || ['en', 'el']).map(l => ({ value: l, label: LANGUAGE_NAMES[l] || l }))} />
</SettingRow>
<SettingRow label={t('settings.venue.timezone')} htmlFor={tzId} tip={t('settings.venue.timezoneTip')}
hint={t('settings.venue.timezoneHint', { time: f.formatTime(new Date()) })}>
<Select id={tzId} value={tz} disabled={s.saving} data-testid="setting-venue.timezone"
onChange={e => s.save('venue.timezone', e.target.value)}
options={zones.map(z => ({ value: z, label: z.replace(/_/g, ' ') }))} />
</SettingRow>
<SettingRow label={t('settings.venue.theme')} htmlFor={themeId} hint={t('settings.venue.themeHint')}
warning={s.get('venue.theme') === 'identity' && !identity?.colours?.length ? t('settings.venue.identityNoColour') : undefined}>
<Select id={themeId} value={s.get('venue.theme', 'amber')} disabled={s.saving} data-testid="setting-venue.theme"
onChange={e => s.save('venue.theme', e.target.value)}
options={VENUE_THEMES.map(v => ({ value: v, label: t(`settings.venue.themes.${v}`) }))} />
</SettingRow>
</SettingsCard>
)
}