Persistent menuActive state with Local Storage #3011
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
4 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#3011
Loading…
Reference in New Issue
No description provided.
Delete Branch "davidangel/frontend:persistent-menu-state"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I sometimes do a full page refresh and would prefer the menu state survive that.
Hi davidangel!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://3011-persistent-menu-state--vikunja-frontend-preview.netlify.app
You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.
Have a nice day!
Thanks for the PR. This is a good point, I like this idea very much! 👍
Stumbled upon this already on my own.
One detail where I think the user would benefit if we would to make some small change is if for this case:
This worked on the current version and 'broke' with your change.
What do you think of the following:
Instead of saving the state if the sidebar is open or not for all window widths we only save it for desktop widths (over 770px).
I think most people don't want the sidebar to remember the open state on mobile. If they want that we could introduce a second stored value only for that.
The
onMounted(() => resize())
should be removed.We replace our
useEventListener
forresize
events withuseWindowSize
from vueuse. Now we only watch for changes of the returned width ref.We should consider two cases:
const menuActive = useStorage('menuActive', true)
which will fall back totrue
.I hope that makes sense. Maybe I also oversaw something. Also there should be other / better ways to implement this. I just wanted to give some idea.
@dpschen – Thanks for the feedback! I've taken a stab at an approach approximating what you've suggested. Let me know what you think.
91222c156c
to0ad7924878
Please remove the
yarn.lock
file. We're using pnpm to manage dependencies.Hey @davidangel,
I rebased the branch and abstracted the functionality to a composable.
By using the composable
useMediaQuery
I could simplify the logic a bit, because we are able to watch that as a trigger to set the prefered setting.See here:
https://kolaente.dev/vikunja/frontend/compare/main...dpschen/frontend:persistent-menu-state
What do you think?
@dpschen - I think this makes sense. Shipit?
@konrad anything to add?
@dpschen Looks good. Should we open a new PR with your changes and close this one or override the branch here?
Overwrite seems simpler
@konrad I don't have the right to do so.
8a72cef547
toc502f9b840
Should be overridden now, thanks everyone!