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"> <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>