From d0d406360e5ab8906f926e0b891216399cfbd290 Mon Sep 17 00:00:00 2001 From: Sterling Archer Date: Sat, 13 Jun 2026 20:53:32 -0700 Subject: [PATCH] Update chord diagrams to match horizontal fretboard style --- index.html | 85 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 24 deletions(-) diff --git a/index.html b/index.html index bbe9388..5d267ef 100644 --- a/index.html +++ b/index.html @@ -150,42 +150,67 @@ const SONG_LIBRARY = [ function ChordDiagram({ name }) { const sh = CHORDS[name]; if (!sh) return null; - const NX=8, NG=14, NS=6, NF=4, NY=18, FH=16; - const W = NX*2 + NG*(NS-1), H = NY + FH*NF + 8; + + const NUM_FRETS=5, NS=6, W=320, H=200; + const TOP=44, BOT=H-24, LEFT=44, RIGHT=W-12; + const strGap=(BOT-TOP)/(NS-1); + const fretGap=(RIGHT-LEFT)/NUM_FRETS; + const STRING_LABELS=["e","B","G","D","A","E"]; + + // Build note list from chord shape: open strings + fretted dots + const notes = []; + sh.open.forEach(s=>{ notes.push({str:s, fret:0, label:"o", muted:false}); }); + sh.muted.forEach(s=>{ notes.push({str:s, fret:-1, label:"x", muted:true}); }); + sh.dots.forEach(({s,f,n})=>{ notes.push({str:s, fret:f, label:n, muted:false, finger:true}); }); + return ( -
-
{name}
- - - {Array.from({length:NF+1},(_,f)=>( - +
+
{name}
+ + + {Array.from({length:NUM_FRETS+1},(_,f)=>( + ))} {Array.from({length:NS},(_,s)=>( - + ))} - {sh.dots.map(({s,f,n},i)=>{ - const cx=NX+s*NG, cy=NY+(f-0.5)*FH; + {STRING_LABELS.map((n,s)=>( + {n} + ))} + {Array.from({length:NUM_FRETS},(_,f)=>( + {f+1} + ))} + {sh.muted.map(s=>{ + const cy=TOP+s*strGap; return ( - - - {n} + + + ); })} {sh.open.map(s=>( - + ))} - {sh.muted.map(s=>{ - const cx=NX+s*NG; + {sh.dots.map(({s,f,n},i)=>{ + const cx = LEFT+(f-0.5)*fretGap; + const cy = TOP+s*strGap; return ( - - - + + + + {n} ); })} -
{sh.label}
+
{sh.label}
); } @@ -903,8 +928,9 @@ function HamburgerMenu({ onTuner, onBasics, onSongSearch, onClose }) { } -function GuitarTuner({ onBack, onMenu }) { +function GuitarTuner({ onBack, onGoTuner, onGoBasics, onGoSongSearch }) { const [listening, setListening] = useState(false); + const [menuOpen, setMenuOpen] = useState(false); const [detectedNote, setDetectedNote] = useState(""); const [detectedFreq, setDetectedFreq] = useState(0); const [cents, setCents] = useState(0); @@ -981,13 +1007,19 @@ function GuitarTuner({ onBack, onMenu }) { GuitarTeacher / Tuner
- + {menuOpen && {setMenuOpen(false);}} + onBasics={()=>{setMenuOpen(false);onGoBasics();}} + onSongSearch={()=>{setMenuOpen(false);onGoSongSearch();}} + onClose={()=>setMenuOpen(false)} + />}
@@ -1227,7 +1259,12 @@ function App() { const css = "*{box-sizing:border-box;margin:0;padding:0} body{background:#1A1A1F} input::placeholder{color:#9A9490} p+p{margin-top:10px}"; - if (showTuner) return setShowTuner(false)} onMenu={()=>setMenuOpen(true)}/>; + if (showTuner) return setShowTuner(false)} + onGoTuner={()=>{}} + onGoBasics={()=>{setShowTuner(false);setSplash(false);setLesson(0);}} + onGoSongSearch={()=>{setShowTuner(false);setSplash(false);setLesson(7);}} + />; if (splash) return (