- The waiter's --bg/--text/--accent… are made of @xenia/ui tokens: light / dark (user menu) and the venue's accent reach every screen; the 751 colour literals in waiter_pwa/src became tokens (by hue family and lightness), hex-alpha suffixes became fade() (color-mix), fixing 'var(--accent)18' tints that never showed. - @xenia/ui: new `special` (violet: offers, discounts, deals; contrast-tested) and `on-colour` tokens. - Setting venue.theme (teal | amber | blue | violet | rose, default amber), bootstrap venue.theme, manager Settings → Venue → Colour; the waiter sets data-venue-theme and the theme before the first render. - Guard tests/no-colours.test.mjs; tests/e2e/waiter_look.mjs (every page light + dark, side-by-side compare page); waiter e2e +3; backend test_venue_theme.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
110 lines
3.8 KiB
React
110 lines
3.8 KiB
React
import { useEffect } from 'react'
|
|
import useInstallPromptStore, { APK_URL, canOfferApp } from '../store/installPromptStore'
|
|
import { useTranslation } from '@xenia/i18n'
|
|
|
|
const BENEFITS = [
|
|
{ icon: '⚡', title: 'install.fast', text: 'install.fastText' },
|
|
{ icon: '📶', title: 'install.wifi', text: 'install.wifiText' },
|
|
{ icon: '🔒', title: 'install.secure', text: 'install.secureText' },
|
|
{ icon: '🔄', title: 'install.noSetup', text: 'install.noSetupText' },
|
|
]
|
|
|
|
const STEPS = [
|
|
'install.step1',
|
|
'install.step2',
|
|
'install.step3',
|
|
]
|
|
|
|
/**
|
|
* Dialog offering the Android app to browser users (see installPromptStore).
|
|
* Opens by itself once; afterwards from the side drawer.
|
|
*/
|
|
export default function InstallAppDialog() {
|
|
const { t } = useTranslation('waiter')
|
|
const { open, dismiss, autoOpen } = useInstallPromptStore()
|
|
|
|
useEffect(() => {
|
|
if (canOfferApp()) autoOpen()
|
|
}, [autoOpen])
|
|
|
|
if (!open) return null
|
|
|
|
return (
|
|
<div
|
|
onClick={dismiss}
|
|
style={{
|
|
position: 'fixed', inset: 0, zIndex: 10000, background: 'rgb(var(--x-scrim-rgb) / 0.6)',
|
|
display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16,
|
|
}}
|
|
>
|
|
<div
|
|
role="dialog"
|
|
aria-modal="true"
|
|
aria-labelledby="install-app-title"
|
|
onClick={e => e.stopPropagation()}
|
|
style={{
|
|
width: '100%', maxWidth: 360, maxHeight: '92vh', overflowY: 'auto',
|
|
background: 'var(--bg2)', border: '1px solid var(--border)', borderRadius: 22,
|
|
boxShadow: '0 16px 48px rgb(var(--x-scrim-rgb) / 0.5)', padding: '26px 22px 20px',
|
|
display: 'flex', flexDirection: 'column', gap: 18,
|
|
}}
|
|
>
|
|
<div style={{ textAlign: 'center' }}>
|
|
<img
|
|
src="/icons/icon-192.png"
|
|
alt=""
|
|
width={76}
|
|
height={76}
|
|
style={{ borderRadius: 18, boxShadow: '0 6px 20px rgb(var(--x-scrim-rgb) / 0.35)' }}
|
|
/>
|
|
<h2 id="install-app-title" style={{ fontSize: 20, fontWeight: 800, color: 'var(--text)', margin: '14px 0 4px' }}>
|
|
{t('install.title')}
|
|
</h2>
|
|
<p style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.45 }}>
|
|
{t('install.intro')}
|
|
</p>
|
|
</div>
|
|
|
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
{BENEFITS.map(b => (
|
|
<div key={b.title} style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
|
|
<span style={{
|
|
fontSize: 18, width: 36, height: 36, flexShrink: 0, borderRadius: 10,
|
|
background: 'var(--bg3)', display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
}}>
|
|
{b.icon}
|
|
</span>
|
|
<div>
|
|
<div style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{t(b.title)}</div>
|
|
<div style={{ fontSize: 12.5, color: 'var(--muted)', lineHeight: 1.4 }}>{t(b.text)}</div>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
<ol style={{
|
|
margin: 0, padding: '12px 14px 12px 32px', borderRadius: 12, background: 'var(--bg3)',
|
|
fontSize: 12.5, color: 'var(--muted)', lineHeight: 1.55,
|
|
}}>
|
|
{STEPS.map(s => <li key={s}>{t(s)}</li>)}
|
|
</ol>
|
|
|
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
<a
|
|
href={APK_URL}
|
|
download
|
|
onClick={dismiss}
|
|
className="btn btn--accent btn--lg"
|
|
style={{ textDecoration: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center' }}
|
|
>
|
|
{t('install.download')}
|
|
</a>
|
|
<button className="btn btn--secondary" onClick={dismiss} style={{ minHeight: 44 }}>
|
|
{t('install.later')}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|