fix: ajout d'un loader sur certaines pages pour pas avoir des trucs par default qui s'affiche

This commit is contained in:
MasutaYunikon committed 2026-04-14 20:30:18 +02:00
1 parent 4e8487967c
commit 203df7576c
2 files changed
+21 -1

No files matched your search

+11
View File
@@ -8,6 +8,13 @@
</p> </p>
</div> </div>
<!-- Loading -->
<div v-if="!loaded" class="flex items-center justify-center gap-2 py-16 text-muted text-sm">
<div class="w-4 h-4 border border-border border-t-accent rounded-full animate-spin" />
</div>
<template v-else>
<!-- Bannière données manquantes --> <!-- Bannière données manquantes -->
<div <div
v-if="status.empty" v-if="status.empty"
@@ -41,6 +48,8 @@
<p class="text-xs text-muted mt-2">Force la synchronisation sans attendre le cache de 6h.</p> <p class="text-xs text-muted mt-2">Force la synchronisation sans attendre le cache de 6h.</p>
</div> </div>
</template>
</div> </div>
</template> </template>
@@ -51,11 +60,13 @@ import { useToast } from '@/composables/useToast'
const { add: toast } = useToast() const { add: toast } = useToast()
const updating = ref(false) const updating = ref(false)
const loaded = ref(false)
const status = ref({ exists: false, count: 0, empty: true }) const status = ref({ exists: false, count: 0, empty: true })
onMounted(async () => { onMounted(async () => {
const res = await fetch('/api/torrents/status', { credentials: 'include' }) const res = await fetch('/api/torrents/status', { credentials: 'include' })
if (res.ok) status.value = await res.json() if (res.ok) status.value = await res.json()
loaded.value = true
}) })
async function update() { async function update() {
+10 -1
View File
@@ -6,7 +6,12 @@
<p class="text-sm text-muted mt-1">Configuration des dossiers et du comportement d'import.</p> <p class="text-sm text-muted mt-1">Configuration des dossiers et du comportement d'import.</p>
</div> </div>
<!-- Dossiers --> <!-- Loading -->
<div v-if="!loaded" class="flex items-center justify-center gap-2 py-16 text-muted text-sm">
<div class="w-4 h-4 border border-border border-t-accent rounded-full animate-spin" />
</div>
<template v-else>
<div class="settings-card flex flex-col gap-5"> <div class="settings-card flex flex-col gap-5">
<div> <div>
@@ -137,6 +142,8 @@
</span> </span>
</div> </div>
</template><!-- fin v-else loaded -->
</div> </div>
<!-- Folder Picker --> <!-- Folder Picker -->
@@ -159,6 +166,7 @@ const { add: toast } = useToast()
const saving = ref(false) const saving = ref(false)
const scanning = ref(false) const scanning = ref(false)
const isDocker = ref(false) const isDocker = ref(false)
const loaded = ref(false)
const scanResult = ref<{ found: number; added: number } | null>(null) const scanResult = ref<{ found: number; added: number } | null>(null)
const form = ref({ const form = ref({
@@ -204,6 +212,7 @@ onMounted(async () => {
if (settingsRes.ok) Object.assign(form.value, await settingsRes.json()) if (settingsRes.ok) Object.assign(form.value, await settingsRes.json())
if (systemRes.ok) isDocker.value = (await systemRes.json()).isDocker if (systemRes.ok) isDocker.value = (await systemRes.json()).isDocker
if (infoRes.ok) picker.value.currentPath = (await infoRes.json()).defaultPath ?? '/' if (infoRes.ok) picker.value.currentPath = (await infoRes.json()).defaultPath ?? '/'
loaded.value = true
}) })
async function save() { async function save() {