fix: progress bar for offline notes
This commit is contained in:
@@ -1,25 +1,25 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useOfflineNotes } from '@/hooks/useOfflineNotes.hook'
|
import { useOfflineNotes } from "@/hooks/useOfflineNotes.hook"
|
||||||
import { confirmMessage } from '@/utils/notif'
|
import { confirmMessage } from "@/utils/notif"
|
||||||
|
|
||||||
const { cacheAllNotes, isLoading, totalOfNotes, noteCompleted } =
|
const { cacheAllNotes, isLoading, totalOfNotes, noteCompleted } =
|
||||||
useOfflineNotes()
|
useOfflineNotes()
|
||||||
|
|
||||||
const confirmBeforeCachingAllNotes = async () => {
|
const confirmBeforeCachingAllNotes = async () => {
|
||||||
confirm('Do you want to cache all notes?')
|
confirm("Do you want to cache all notes?")
|
||||||
await cacheAllNotes()
|
await cacheAllNotes()
|
||||||
confirmMessage('✅ All notes have been locally saved')
|
confirmMessage("✅ All notes have been locally saved")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="isLoading" class="cache-all-notes">
|
<div v-if="isLoading" class="cache-all-notes">
|
||||||
<div>{{ noteCompleted }}/{{ totalOfNotes }}</div>
|
|
||||||
<progress
|
<progress
|
||||||
:value="noteCompleted"
|
:value="noteCompleted"
|
||||||
class="progress"
|
class="progress progress-accent w-56"
|
||||||
:max="totalOfNotes"
|
:max="totalOfNotes"
|
||||||
></progress>
|
></progress>
|
||||||
|
<div>{{ noteCompleted }}/{{ totalOfNotes }}</div>
|
||||||
</div>
|
</div>
|
||||||
<button v-else class="button" @click="() => confirmBeforeCachingAllNotes()">
|
<button v-else class="button" @click="() => confirmBeforeCachingAllNotes()">
|
||||||
<svg
|
<svg
|
||||||
@@ -45,8 +45,6 @@ const confirmBeforeCachingAllNotes = async () => {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.cache-all-notes {
|
.cache-all-notes {
|
||||||
display: flex;
|
text-align: center;
|
||||||
gap: 1rem;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user