tablet error screen can recover from a stale bar_id; admin drink reorder gets a non-drag fallback

- App.tsx: the error screen (shown when api.config(barId) fails, e.g.
  an admin deleted/renamed the bar while this tablet was offline)
  only offered 'Neu laden', which re-reads the same stale localStorage
  bar_id and fails again — a permanent stuck loop with no in-app fix.
  Added a 'Bar wechseln' button reusing the existing changeBar()
  logic, which now also clears the error state.
- Admin.tsx BarDrinkEditor: the drag-and-drop reorder is a
  mouse-oriented API that doesn't fire on touch-only input and has no
  keyboard equivalent. Added ▲/▼ buttons alongside the drag handle so
  reordering works regardless of input method.
This commit is contained in:
iris 2026-07-29 20:30:16 +02:00 committed by mara
commit 058c77524a
3 changed files with 30 additions and 1 deletions

View file

@ -36,9 +36,24 @@ export function App() {
localStorage.removeItem(STORAGE_KEY);
setBarId(null);
setConfig(null);
setError(null);
}
if (error) return <div class="bar-picker"><h1>Fehler</h1><p>{error}</p><button onClick={() => location.reload()}>Neu laden</button></div>;
if (error) {
return (
<div class="bar-picker">
<h1>Fehler</h1>
<p>{error}</p>
<button onClick={() => location.reload()}>Neu laden</button>
{/* A stuck-forever loop is otherwise possible here: the stored bar_id
can be permanently invalid (e.g. an admin deleted/renamed the bar
while this tablet was offline), and "Neu laden" alone re-reads
that same stale id and fails again. Route back through the same
changeBar() the working UI uses, which clears it. */}
<button onClick={changeBar}>Bar wechseln</button>
</div>
);
}
if (barId == null) return <BarPicker bars={bars} onPick={pick} />;
if (!config) return <div class="bar-picker"><p>Lade</p></div>;
return <Sale config={config} onChangeBar={changeBar} />;