wikitree / wikitree-dynamic-tree

Dynamically generated and browsed graphical family tree
MIT License
23 stars 15 forks source link

Settings integrated in the core #84

Open MichalVasut opened 1 year ago

MichalVasut commented 1 year ago

It was only matter of time when the views start to be somehow configurable. I'm thinking about it for some time, but there wasn't need nor time to realize those thoughts. In the meantime Greg (@Clarke-11007) already implemented own version of settings in his 2 or 3 views and I must say, I'm IMPRESSED! He did great and the his implementation very closely follows my thoughts and ideas (we never talked about this ๐Ÿ˜Š).

What I'm proposing is the integration to the ViewsRegistry - it's very useful feature that have potential to be widely used and it's a pity that it's kept ob views level (imho already duplicated, maybe I'm wrong ๐Ÿค”).

Of course, contribution should be fully credited!

Benefits

Ideas

Settings storage

https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Clarke-11007 commented 1 year ago

Thanks Michal for the shoutout. That's funny (and encouraging!) that you were thinking along the same lines. But - I do have to give full credit to Rob Pavey for the original code that I used as the basis for the SettingsObject class. I did tweak it to make it a class - and if you look at it - huge gobs are commented out where he used a chrome.storage to save settings.

I'd be totally fine if this Class (and a few others) were moved into a /common directory - since I already am using it for 3 of my Views, it really doesn't belong solely in the FanChart directory anymore.

IF we want to build on that Class - there is one serious thing that still needs to be added to it:

On Thu, Oct 27, 2022 at 10:19 AM Michal Vaลกut @.***> wrote:

It was only matter of time when the views start to be somehow configurable. I'm thinking about it for some time, but there wasn't need nor time to realize those thoughts. In the meantime Greg @.*** https://github.com/Clarke-11007) already implemented own version of settings in his 2 or 3 views and I must say, I'm IMPRESSED! He did great and the his implementation very closely follows my thoughts and ideas (we never talked about this ๐Ÿ˜Š).

What I'm proposing is the integration to the ViewsRegistry - it's very useful feature that have potential to be widely used and it's a pity that it's kept ob views level (imho already duplicated, maybe I'm wrong ๐Ÿค”).

Of course, contribution should be fully credited! Benefits

  • code is in single place - easily maintainable
  • same visual look & feel
  • possibility to create some storage mechanism, that would store settings between sessions

Ideas Settings storage

  • could be implemented using localStorage and serialized JSON, under the keys in form of wt-settings.. IMHO it's not good idea to store it in cookies when we are not exchanging info with the server.

https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

โ€” Reply to this email directly, view it on GitHub https://github.com/wikitree/wikitree-dynamic-tree/issues/84, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3JDGBRCI6JF7RC7CTZYR3LWFKFQNANCNFSM6AAAAAARQDUJA4 . You are receiving this because you were mentioned.Message ID: @.***>

MichalVasut commented 1 year ago

Yeah that's exactly this

But there are few other things on my stack, that imho needs to be done before that

I've opened this discussion just to bring some attention to the topic and I'll let it life it's own live for some time.