fix: progress bar for offline notes

This commit is contained in:
Julien Calixte
2025-11-29 13:11:52 +01:00
parent f98ac48fe4
commit 80f4f39006

View File

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