lumen
lumen copied to clipboard
Prompt Update - UI
Closes https://github.com/lumen-notes/lumen/issues/348
This time taking what was done in the previous PR and adding the visual/interaction side of the process.
There are two ways in which the user is "notified" that there is a new update, the first is through buttons on the interface that only appear when an update is available.
The second is by making use of the sonner library, showing a toast on the screen.
When clicking on the toast the app is immediately updated
In the case of clicking on one of the two buttons in the layout it generates a alert dialog before updating.
In this version only 2 dependencies were installed:
- sonner
- workbox-window
Also I created a context of the service worker state and placed it in the form of a provider to maintain consistency of the data in the app.
I placed this provider in src/index.tsx
, if you don't like the position I gave it you can modify it without problem, the important thing is to keep the <Toaster />
component at the same level or higher than <PromptUpdateProvider />
.
And the icon of "refresh" that was added is taken from featherIcon
Only one issue remains, it is ideal to check before updating that the status is "synchronized" or at least force the synchronization of the notes before refreshing the page. I left a comment to manage this, I could not fully understand the synchronization process and how to integrate it yet.
The above file is
src/components/nav-bar.tsx
line 329
What do you think of the UI and implementation? I look forward to any changes or suggestions.