/* ===== VLUE SALAMANCA — Tweaks for Nuestra Carta ===== */
/* Controls the newly added "Carpaccio de gamba roja" dish in ENTRANTES. */

const CARTA_TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "carpaccioShow": true,
  "carpaccioPrice": "30€",
  "carpaccioGroup": "frios",
  "carpaccioSignature": false
}/*EDITMODE-END*/;

function CartaTweaksApp() {
  const [t, setTweak] = useTweaks(CARTA_TWEAK_DEFAULTS);

  // Push every tweak change into the vanilla menu renderer.
  React.useEffect(() => {
    if (window.setCartaTweaks) window.setCartaTweaks(t);
  }, [t]);

  return (
    <TweaksPanel title="Tweaks">
      <TweakSection label="Carpaccio de gamba roja" />
      <TweakToggle label="Mostrar plato" value={t.carpaccioShow}
                   onChange={(v) => setTweak('carpaccioShow', v)} />
      <TweakText label="Precio" value={t.carpaccioPrice}
                 onChange={(v) => setTweak('carpaccioPrice', v)} />
      <TweakRadio label="Grupo" value={t.carpaccioGroup}
                  options={[{ value: 'frios', label: 'Fríos' },
                            { value: 'calientes', label: 'Calientes' }]}
                  onChange={(v) => setTweak('carpaccioGroup', v)} />
      <TweakToggle label="Plato estrella" value={t.carpaccioSignature}
                   onChange={(v) => setTweak('carpaccioSignature', v)} />
    </TweaksPanel>
  );
}

ReactDOM.createRoot(document.getElementById('tweaksRoot')).render(<CartaTweaksApp />);
