This PR adds a local storage a setting for whether the app side bar is open or closed and uses it to update the app to reflect that value. CoreUI controls the side bar with a class added to or removed from the body tag of index.html. This falls outside of the DOM node that the React app is appended to so we can't use React refs here. But, we can use the MutationObserver API and query selectors to reach outside the app and watch the class changes.
Check your local storage for a key called isAppSideBarOpen. On the first time this key is initialized, it should have a value of true and the sidebar should be open.
Refresh the page, the local storage value should remain true.
Now click on the hamburger icon on the side bar header to close the side bar. The local storage value should now be false.
Refresh the page or close the app and come back. When the app loads, it should load with the side bar closed.
Try updating the value of isAppSideBarOpen in your browser settings manually to either true or false and refresh. The app will use this value to either hide or show the side bar on load.
Try out different combinations, and your local storage value should always match the status of the side bar.
Ship list
[x] Check migrations for any conflicts with latest migrations in master branch
[x] Confirm Hasura role permissions for necessary access
Associated issues
https://github.com/cityofaustin/atd-data-tech/issues/16006
This PR adds a local storage a setting for whether the app side bar is open or closed and uses it to update the app to reflect that value. CoreUI controls the side bar with a class added to or removed from the
body
tag ofindex.html
. This falls outside of the DOM node that the React app is appended to so we can't use React refs here. But, we can use the MutationObserver API and query selectors to reach outside the app and watch the class changes.Testing
URL to test: https://deploy-preview-1424--atd-vze-staging.netlify.app/
Steps to test:
isAppSideBarOpen
. On the first time this key is initialized, it should have a value oftrue
and the sidebar should be open.true
.false
.isAppSideBarOpen
in your browser settings manually to eithertrue
orfalse
and refresh. The app will use this value to either hide or show the side bar on load.Ship list