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:
Generated
+45
-1
@@ -14,8 +14,12 @@
|
||||
"@radix-ui/react-switch": "^1.3.0",
|
||||
"@radix-ui/react-tabs": "^1.1.14",
|
||||
"@tailwindcss/vite": "^4.3.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^1.18.0",
|
||||
"react": "^19.2.6",
|
||||
"react-dom": "^19.2.6"
|
||||
"react-dom": "^19.2.6",
|
||||
"tailwind-merge": "^3.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
@@ -2228,6 +2232,27 @@
|
||||
],
|
||||
"license": "CC-BY-4.0"
|
||||
},
|
||||
"node_modules/class-variance-authority": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz",
|
||||
"integrity": "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"clsx": "^2.1.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://polar.sh/cva"
|
||||
}
|
||||
},
|
||||
"node_modules/clsx": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/convert-source-map": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||
@@ -3105,6 +3130,15 @@
|
||||
"yallist": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/lucide-react": {
|
||||
"version": "1.18.0",
|
||||
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.18.0.tgz",
|
||||
"integrity": "sha512-LZDb7H/0YfM+RJncD0hDQRCAu+vSGODqpe35TuVI8EuXaRjkczbsx7p8dY4J87F/MUSj6bpYqeI8nw8qXaAdmA==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.21",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
||||
@@ -3479,6 +3513,16 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tailwind-merge": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.6.0.tgz",
|
||||
"integrity": "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/dcastil"
|
||||
}
|
||||
},
|
||||
"node_modules/tailwindcss": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.1.tgz",
|
||||
|
||||
+5
-1
@@ -16,8 +16,12 @@
|
||||
"@radix-ui/react-switch": "^1.3.0",
|
||||
"@radix-ui/react-tabs": "^1.1.14",
|
||||
"@tailwindcss/vite": "^4.3.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^1.18.0",
|
||||
"react": "^19.2.6",
|
||||
"react-dom": "^19.2.6"
|
||||
"react-dom": "^19.2.6",
|
||||
"tailwind-merge": "^3.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"module": "esnext",
|
||||
"types": ["vite/client"],
|
||||
"skipLibCheck": true,
|
||||
"ignoreDeprecations": "6.0",
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
@@ -14,6 +15,10 @@
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
|
||||
@@ -4,6 +4,7 @@ import tailwindcss from '@tailwindcss/vite'
|
||||
import path from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
base: '/ui/',
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user