From 128da47ae5513a71ca332a3638095d3a95a5bd0e Mon Sep 17 00:00:00 2001 From: Tom Keefe <8655118+MisterKeefe@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:34:25 +0000 Subject: [PATCH] move progression string state to URL --- src/routes/+page.svelte | 18 +++++-- src/routes/ChordPanel.svelte | 8 +-- src/routes/progressionStore.ts | 96 +++++++++++++++------------------- 3 files changed, 58 insertions(+), 64 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 81f4154..e84a7c7 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -4,13 +4,13 @@ import { tonic, progression, - chords, randomizeApp, randomizeTonic, randomizeProgression, setTonic, previousProgression, - nextProgression + nextProgression, + trySetProgressionFromURL } from './progressionStore'; import { relativeChordToString } from '$lib/music/relativeChord'; import Chevron from './Chevron.svelte'; @@ -21,6 +21,14 @@ e.preventDefault(); } }; + + const onHashChange = () => { + trySetProgressionFromURL(); + }; + + const onLoad = () => { + trySetProgressionFromURL(); + }; @@ -46,8 +54,8 @@

Ukulele Chord Progressions

- {#each $chords as _, index} - + {#each $progression as relativeChord} + {/each}
@@ -95,7 +103,7 @@
- +