- {instrument === 'guitar'
- ?
- :
- }
+ {instrument === 'guitar' &&
}
+ {instrument === 'bass' &&
}
+ {instrument === 'piano' &&
}
diff --git a/src/components/BassFretboard.jsx b/src/components/BassFretboard.jsx
new file mode 100644
index 0000000..fa99e58
--- /dev/null
+++ b/src/components/BassFretboard.jsx
@@ -0,0 +1,149 @@
+import { getPentatonicScale, getFullScale, getChordTones, NOTES } from '../lib/theory'
+
+// Standard bass tuning (top of diagram = highest string)
+const STRINGS = [
+ { label: 'G', root: 7, thickness: 1.5 },
+ { label: 'D', root: 2, thickness: 2 },
+ { label: 'A', root: 9, thickness: 2.5 },
+ { label: 'E', root: 4, thickness: 3 },
+]
+
+const NUM_FRETS = 13
+const FRET_MARKERS = [3, 5, 7, 9]
+const DOUBLE_MARKER = 12
+
+// Layout
+const NUT_X = 40
+const OPEN_X = 18
+const FRET_W = 52
+const STRING_H = 36 // wider spacing than guitar — 4 strings feel more spread
+const PAD_T = 28
+const PAD_B = 18
+const BOARD_W = NUT_X + (NUM_FRETS - 1) * FRET_W + 10
+const BOARD_H = PAD_T + 3 * STRING_H + PAD_B
+const DOT_R = 10
+
+const fretX = f => NUT_X + (f - 0.5) * FRET_W
+const stringY = si => PAD_T + si * STRING_H
+
+function noteColor(isChordTone, isPenta, isScale, mono = false) {
+ if (isChordTone) return { fill: '#a855f7', text: '#fff' }
+ if (isPenta) return mono ? { fill: '#c084fc', text: '#1e1b4b' } : { fill: '#f59e0b', text: '#000' }
+ if (isScale) return mono ? { fill: '#e9d5ff', text: '#581c87' } : { fill: '#374151', text: '#d1d5db' }
+ return null
+}
+
+export default function BassFretboard({ keyInfo, currentChord, monoColor = false }) {
+ const { root, mode } = keyInfo ?? {}
+
+ if (!root) return null
+
+ const pentaSet = new Set(getPentatonicScale(root, mode).map(n => NOTES.indexOf(n)))
+ const scaleSet = new Set(getFullScale(root, mode).map(n => NOTES.indexOf(n)))
+ const chordSet = currentChord
+ ? new Set(getChordTones(currentChord).map(n => NOTES.indexOf(n)))
+ : new Set()
+
+ return (
+
+
+ Bass — {root} {mode}
+ {currentChord && / {currentChord}}
+
+
+
+
+
+
+
+ ● Chord tone
+ ● Pentatonic
+ ● Scale
+
+
+ )
+}