import { useState } from 'preact/hooks'; import type { Bar } from '@wutzcalc/shared'; import { getTheme, setTheme } from '../api'; import { VersionFooter } from '../VersionFooter'; interface Props { bars: Bar[] | null; onPick: (id: number) => void; } export function BarPicker({ bars, onPick }: Props) { const [theme, setThemeState] = useState(getTheme()); function toggleTheme() { const next = theme === 'dark' ? 'light' : 'dark'; setTheme(next); setThemeState(next); } return (

Bar auswählen

{bars == null ? (

Lade…

) : bars.length === 0 ? ( // A fresh install (or every bar deleted) otherwise renders nothing // but the header here — indistinguishable from "still loading".

Keine Bars angelegt — bitte im Backoffice anlegen.

) : ( bars.map(b => ( )) )}
); }