// VMAX prototype — shared Tweaks dock. A gear FAB opens an in-app panel for flipping
// review states: day state, populated vs first-run data, connection,
// quick role/active-user jump, and (POS) simulate-idle.
(function () {
const { Icon, Overline } = window.VMAXUI;
const { Avatar, Toggle } = window.VMAXW;
const { useVMAX } = window.VMAXStore;
function Seg({ value, onChange, options }) {
return (
{options.map((o) => { const v = typeof o === 'string' ? o : o.value; const l = typeof o === 'string' ? o : o.label; const on = value === v; return (
onChange(v)} style={{ flex: 1, padding: '8px 6px', border: 'none', borderRadius: 'var(--radius-sm)', cursor: 'pointer', fontFamily: 'var(--font-body)', fontWeight: 700, fontSize: 12, background: on ? 'var(--surface-card)' : 'transparent', color: on ? 'var(--vmax-ink)' : 'var(--vmax-ink-soft)', boxShadow: on ? 'var(--shadow-sm)' : 'none' }}>{l}
); })}
);
}
function Section({ title, children }) {
return {title} {children}
;
}
function TweakDock({ app, roles, onJump, onSimulateIdle }) {
const [s, a] = useVMAX();
const [open, setOpen] = React.useState(false);
const tw = s.tweaks;
const confirmReset = (mode) => { a.reset(mode); };
return (
setOpen((o) => !o)} title="Tweaks" style={{ position: 'fixed', right: 18, bottom: 18, width: 50, height: 50, borderRadius: '50%', background: 'var(--vmax-ink)', color: '#fff', border: 'none', cursor: 'pointer', display: 'grid', placeItems: 'center', boxShadow: 'var(--shadow-pop)', zIndex: 150 }}>
{open && (
setOpen(false)} style={{ position: 'fixed', inset: 0, zIndex: 150 }} />
Tweaks
setOpen(false)} style={{ border: 'none', background: 'transparent', cursor: 'pointer', color: 'var(--vmax-ink-soft)' }}>
{roles && roles.length > 0 && (
{roles.map((r) => (
onJump(r.person)} style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '9px 10px', border: '1.5px solid var(--vmax-line)', background: 'var(--surface-card)', borderRadius: 'var(--radius-md)', cursor: 'pointer', textAlign: 'left' }}>
{r.label} {r.person.name}
))}
)}
a.setTweak('dayState', v)} options={[{ value: 'clean', label: 'Clean' }, { value: 'flagged', label: 'Flagged' }, { value: 'closing', label: 'Mid-close' }]} />
confirmReset('populated')} style={{ flex: 1, padding: '9px 6px', borderRadius: 'var(--radius-md)', cursor: 'pointer', fontWeight: 700, fontSize: 12, border: '1.5px solid ' + (s.mode === 'populated' ? 'var(--vmax-red)' : 'var(--vmax-line)'), background: s.mode === 'populated' ? 'var(--vmax-mint)' : 'var(--surface-card)', color: 'var(--vmax-ink)' }}>Running shop
confirmReset('firstrun')} style={{ flex: 1, padding: '9px 6px', borderRadius: 'var(--radius-md)', cursor: 'pointer', fontWeight: 700, fontSize: 12, border: '1.5px solid ' + (s.mode === 'firstrun' ? 'var(--vmax-red)' : 'var(--vmax-line)'), background: s.mode === 'firstrun' ? 'var(--vmax-mint)' : 'var(--surface-card)', color: 'var(--vmax-ink)' }}>Fresh / first-run
Switching reseeds the demo and clears accumulated records.
a.setTweak('net', v)} options={[{ value: 'online', label: 'Online' }, { value: 'syncing', label: 'Syncing' }, { value: 'offline', label: 'Offline' }]} />
{onSimulateIdle && (
{ onSimulateIdle(); setOpen(false); }} style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8, padding: '11px', borderRadius: 'var(--radius-md)', border: '1.5px solid var(--vmax-line)', background: 'var(--surface-card)', cursor: 'pointer', fontWeight: 600, fontSize: 13 }}> Simulate idle till
Marks the active user stale — the next receipt print will ask for a PIN to re-verify.
)}
)}
);
}
window.VMAXTWEAKS = { TweakDock };
})();