wikitree-dynamic-tree icon indicating copy to clipboard operation
wikitree-dynamic-tree copied to clipboard

Settings integrated in the core

Open MichalVasut opened this issue 3 years ago • 2 comments

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

  • 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.<view-id>. 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

MichalVasut avatar Oct 27 '22 14:10 MichalVasut

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:

  • currently, if you enter a new WikiTree ID and click GO, it reloads the default settings, it doesn't store the most recent ones that you customized.

  • IS that a feature that your suggestion of incorporating it into the ViewRegistry would solve ? IF SO - then PLEASE MAKE IT SO ! That'd be great!

  • I'd also LOVE to be able to SAVE people's preferences. In my original standalone version of the Fan Chart, there is that option -if they've logged in - and I have in my apps.wikitree.com/ folder a /settings/ subfolder, which has a settings file (using their ID as part of the filename, to keep them unique) for each user who saved their preferences. Would we do something similar here - or - is there a better approach? Is it less creepy to just save it locally with a cookie which they can choose to keep or throw out, but would not be saved on a server somewhere ??

  • I did do some tweaking to Rob's code, added support for radio buttons, and the option to space them vertically, (add <BR> really), some spacing and text options in the settings tab

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: @.***>

Clarke-11007 avatar Oct 27 '22 15:10 Clarke-11007

Yeah that's exactly this

  • moving to commns (or generalizing it)
  • store settings

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

  • mobile friendly user experience
  • toolbar with actions - e. g. print, settings, "view defined" actions,...

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.

MichalVasut avatar Oct 27 '22 19:10 MichalVasut