AceFire6 / ordered-arrowverse

A listing of all shows in the Arrowverse in watch order to ensure continuity and sensible ordering for crossover episodes
https://arrowverse.info
98 stars 33 forks source link

Keep watched state #325

Closed exhuma closed 2 years ago

exhuma commented 3 years ago

Here's a proposal to implement a local-storage based solution for #14 (and #146).

image

As the requirement for local-storage is new, this introduces a new UserPreferences class to abstract that logic away. Should the need arise to store that values somewhere else, only this class needs to be modified.

This adds a checkbox to each episode (1) to flag the "watched" statea and also adds a small toggle-link (2) above the episode list to either show or hide watched episodes.

(3): As a side-effect, I had to replace the click handler on table-rows (which opened the wiki). Otherwise it would not be possible to click the checkboxes without triggering that event. I have replaced this with a new column and an icon. As icon I used a "material-design" icon via https://iconify.design/ I don't mind replacing that dependency with a simple text, but it seemed like an acceptable trade-off.

exhuma commented 3 years ago

A word on implementation I forgot:

I decided to put everything into a single list/array in localstorage instead of keeping one list by series. As values I use a simple string using <series-name>-<episode-id>, so I also did not bother hashing the values as it makes the local-storage values "human-readable" improving maintainability.

This was a trade-off I found usable for this app. We're not talking about millions of entries, and the entries are small, so storing everything in one list should not have a noticable impact on performance. It keeps the code much simpler as a result.

exhuma commented 2 years ago

Is there anything blocking this from getting merged and deployed? If so, can I help with anything?

exhuma commented 2 years ago

Was there anything wrong with this? It got closed without any comment?

Maybe this was a side-effect from deleting the master branch?