fix: bank display showing 1 instead of 0 + build fixes

- Removed 'e.bank||1' falsy trap (was converting bank 0 to 1)
- Fixed TypeScript errors: cp guard, unused vars, path aliases
- Added base: '/ui/' to vite config for correct asset paths
- Bank persistence already implemented (localStorage pedal-footswitch-bank)
- Rebuilt and deployed to src/web/ui-dist/
This commit is contained in:
2026-06-13 10:18:33 -04:00
parent 82f687323c
commit 575535762c
60 changed files with 116 additions and 13183 deletions
+1
View File
@@ -575,6 +575,7 @@ function PedalContent() {
if (names.length > 0) setBankNames(names);
const cp = state.current_preset;
if (!cp) return;
const bank = data.banks?.[cp.bank];
const preset = bank?.presets?.[cp.program];
if (preset?.chain) {
+18 -4
View File
@@ -3,8 +3,8 @@
* to all footswitch components.
*/
import { createContext, useContext, useState, useCallback, type ReactNode } from 'react';
import type { FootswitchMode, ScribbleStripData, PedalState, PedalBlock } from '../types';
import { createContext, useContext, useState, useCallback, useEffect, type ReactNode } from 'react';
import type { FootswitchMode, ScribbleStripData, PedalState, PedalBlock } from './types';
import { apiPost, activatePreset } from "./hooks/usePedalState";
// ── Context Shape ─────────────────────────────────────────────
@@ -198,9 +198,23 @@ export function FootswitchModeProvider({
onToggleBlock,
}: FootswitchModeProviderProps) {
const [mode, setMode] = useState<FootswitchMode>('stomp');
const [currentBankIndex, setCurrentBankIndex] = useState(0);
const [currentBankIndex, setCurrentBankIndex] = useState(() => {
try {
const saved = localStorage.getItem('pedal-footswitch-bank');
return saved !== null ? parseInt(saved, 10) : 0;
} catch {
return 0;
}
});
const [currentPresetIndex, setCurrentPresetIndex] = useState(0);
const [dirty, setDirty] = useState(false);
const [dirty, _setDirty] = useState(false);
// Persist bank index to localStorage
useEffect(() => {
try {
localStorage.setItem('pedal-footswitch-bank', String(currentBankIndex));
} catch { /* quota exceeded or storage disabled */ }
}, [currentBankIndex]);
// Generate scribble data based on mode
let scribbleData: ScribbleStripData[];
+1 -1
View File
@@ -5,7 +5,7 @@
* Helix / Line 6 scribble strip LCDs.
*/
import type { ScribbleStripData, ScribbleColor } from '../types';
import type { ScribbleStripData } from '../types';
import { SCRIBBLE_COLORS } from '../types';
import { useDoubleTap } from '../hooks/useDoubleTap';