This PR splits out state management from how to display the UI/DOM. Now, for the scorecard accordion and about popup, we have two distinct functions:
how to display the UI element given a boolean state
how to update the boolean state via event listeners, and what the initial value is
Those two functions no longer have tight coupling, which makes them much easier to understand.
Specifically, we use the "Observable" design pattern (aka pub-sub). I also considered switching to Svelte, which has reactivity built-in, but I wanted to start with this simpler approach.
A follow up will use this pattern for the rest of the app.
This PR splits out state management from how to display the UI/DOM. Now, for the scorecard accordion and about popup, we have two distinct functions:
Those two functions no longer have tight coupling, which makes them much easier to understand.
Specifically, we use the "Observable" design pattern (aka pub-sub). I also considered switching to Svelte, which has reactivity built-in, but I wanted to start with this simpler approach.
A follow up will use this pattern for the rest of the app.