diff --git a/src/App.tsx b/src/App.tsx index bc2fc0da..4f6889a0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -114,8 +114,8 @@ function App() { } } - const handleEffectChange = (parameterId: string, value: number) => { - effectSettings.setKey(parameterId as keyof typeof effectValues, value) + const handleEffectChange = (parameterId: string, value: number | boolean) => { + effectSettings.setKey(parameterId as any, value as any) if (playbackManagerRef.current) { playbackManagerRef.current.setEffects(effectValues) } diff --git a/src/components/EffectsBar.tsx b/src/components/EffectsBar.tsx index 8a3dc86a..7207c1f2 100644 --- a/src/components/EffectsBar.tsx +++ b/src/components/EffectsBar.tsx @@ -1,11 +1,12 @@ import { Slider } from './Slider' +import { Switch } from './Switch' import { EFFECTS } from '../config/effects' import { getClipModeLabel } from '../utils/formatters' import type { EffectValues } from '../types/effects' interface EffectsBarProps { values: EffectValues - onChange: (parameterId: string, value: number) => void + onChange: (parameterId: string, value: number | boolean) => void } export function EffectsBar({ values, onChange }: EffectsBarProps) { @@ -18,23 +19,39 @@ export function EffectsBar({ values, onChange }: EffectsBarProps) { return (
-
- {EFFECTS.flatMap(effect => - effect.parameters.map(param => ( - onChange(param.id, value)} - formatValue={param.id === 'clipMode' ? formatValue : undefined} - valueId={param.id} - /> - )) - )} +
+ {EFFECTS.map(effect => ( +
+
+

+ {effect.name.toUpperCase()} +

+ {effect.bypassable && ( + onChange(`${effect.id}Bypass`, !checked)} + label={Boolean(values[`${effect.id}Bypass`]) ? 'OFF' : 'ON'} + /> + )} +
+
+ {effect.parameters.map(param => ( + onChange(param.id, value)} + formatValue={param.id === 'clipMode' ? formatValue : undefined} + valueId={param.id} + /> + ))} +
+
+ ))}
) diff --git a/src/components/EngineControls.tsx b/src/components/EngineControls.tsx index 20109295..36e4c0b6 100644 --- a/src/components/EngineControls.tsx +++ b/src/components/EngineControls.tsx @@ -31,7 +31,7 @@ export function EngineControls({ values, onChange }: EngineControlsProps) { {param.label.toUpperCase()} - {formatValue(param.id, values[param.id] ?? param.default)} + {formatValue(param.id, (values[param.id] as number) ?? param.default)}
onChange(param.id, Number(e.target.value))} className="w-full h-[2px] bg-white appearance-none cursor-pointer" /> diff --git a/src/components/Switch.tsx b/src/components/Switch.tsx new file mode 100644 index 00000000..1b5df511 --- /dev/null +++ b/src/components/Switch.tsx @@ -0,0 +1,29 @@ +interface SwitchProps { + checked: boolean + onChange: (checked: boolean) => void + label?: string +} + +export function Switch({ checked, onChange, label }: SwitchProps) { + return ( +