-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: save NMRium preferences by workspace #1393
Conversation
✔️ Deploy Preview for nmrium ready! 🔨 Explore the source changes: 4603504 🔍 Inspect the deploy log: https://app.netlify.com/sites/nmrium/deploys/622091ea54b31a000802b632 😎 Browse the preview: https://deploy-preview-1393--nmrium.netlify.app/ |
@lpatiny |
The functionality is ok for me. @targos Here is the context of this PR. Currently on www.nmrium.org the exercises show all the options of NMRium which is not ok. The reason for this is that preferences are stored in local storage and when we reload the preferences it ignores the one specific to exercises (ie the exercise 'mode'). However there is also a nice feature in NMRium that is the 'mode'. You can define a preset of settings that will configure NMRium in the mode you like. With this PR the goal is that settings are related to the mode. In the future this would allow a user to create its own mode in the general preferences depending if he prefers to make an assignment of 2D or just a prediction. This PR also allows to hide the 'general settings' so that in the exercise mode there is no way for the student to add more features. Finally this mode approach will allow to have our NMRium version specific to prediction as we discussed. @targos could you review the implementation ? |
I see issues with the implementation (mostly that the state update functions are not pure, since they interact with localstorage), but that's not new from this PR, so it looks ok. |
return useMemo(() => { | ||
return preferences.formatting.panels[key] || null; | ||
}, [key, preferences.formatting.panels]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing takes time or risks creating a new object here, the useMemo is counterproductive (comparing the dependencies is not costless)
change name from mode to workspace move hideExperimentalFeatures object under display>general object increment local storage version number
No description provided.