Open MichalVasut opened 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:
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
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: @.***>
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.
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
localStorage
and serialized JSON, under the keys in form ofwt-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