Skip to content

Commit

Permalink
Add notification of new content
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuvonen committed Sep 11, 2024
1 parent fe83181 commit 2d6b143
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@ import {watchEffect} from 'vue';
import {storeToRefs} from 'pinia';
import {useI18n} from 'vue-i18n';
import {RouterView, useRoute} from 'vue-router';
import {useRegisterSW} from 'virtual:pwa-register/vue';
import {useActivityStore} from '@/stores/activityStore';
import {useAppStateStore} from '@/stores/appStateStore';
import NavBar from '@/components/NavBar.vue';
import ToastContainer from '@/components/ToastContainer.vue';
const {addToastMessage} = useAppStateStore();
const {t, locale} = useI18n();
const route = useRoute();
const {allVeggies} = storeToRefs(useActivityStore());
const {settings} = storeToRefs(useAppStateStore());
const {updateServiceWorker} = useRegisterSW({
immediate: true,
async onNeedRefresh() {
addToastMessage(t('general.updateReady'));
await updateServiceWorker();
window.location.reload();
},
});
watchEffect(() => {
locale.value = settings.value.locale;
});
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"clickToAdd": "Add {0}",
"clickToRemove": "Remove {0}",
"close": "Close",
"start": "Start"
"start": "Start",
"updateReady": "The app has been updated with latest content."
},
"home": {
"info": "Learn more",
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"clickToAdd": "Lisää {0}",
"clickToRemove": "Poista {0}",
"close": "Sulje",
"start": "Aloita"
"start": "Aloita",
"updateReady": "Sovellus on päivitetty uuteen versioon."
},
"home": {
"info": "Lue lisää",
Expand Down

0 comments on commit 2d6b143

Please sign in to comment.