chore: update frontend configuration
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
<div class="w-full max-w-[1600px] h-full max-h-[94vh] bg-base-100 rounded-2xl shadow-2xl flex flex-col overflow-hidden">
|
||||
<header class="flex items-start justify-between gap-4 p-6 border-b border-base-200">
|
||||
<div class="min-w-0">
|
||||
<h3 class="font-bold text-xl truncate">Prévisualisation</h3>
|
||||
<h3 class="font-bold text-xl truncate">
|
||||
Prévisualisation
|
||||
</h3>
|
||||
<p class="text-sm text-gray-500 truncate">
|
||||
{{ document?.name || document?.filename }}<span v-if="documentDescription"> • {{ documentDescription }}</span>
|
||||
</p>
|
||||
@@ -21,7 +23,7 @@
|
||||
<section class="flex-1 bg-base-200/40 px-6 py-5 overflow-hidden">
|
||||
<div class="h-full w-full rounded-xl border border-base-300 bg-base-100 flex items-center justify-center overflow-hidden">
|
||||
<template v-if="previewType === 'image'">
|
||||
<img :src="document?.path" alt="preview" class="max-h-full max-w-full object-contain" />
|
||||
<img :src="document?.path" alt="preview" class="max-h-full max-w-full object-contain">
|
||||
</template>
|
||||
|
||||
<template v-else-if="previewType === 'pdf'">
|
||||
@@ -30,21 +32,21 @@
|
||||
class="w-full h-full bg-white"
|
||||
frameborder="0"
|
||||
title="Aperçu PDF"
|
||||
></iframe>
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template v-else-if="previewType === 'audio'">
|
||||
<audio :src="document?.path" controls class="w-full"></audio>
|
||||
<audio :src="document?.path" controls class="w-full" />
|
||||
</template>
|
||||
|
||||
<template v-else-if="previewType === 'video'">
|
||||
<video :src="document?.path" controls class="w-full h-full bg-black"></video>
|
||||
<video :src="document?.path" controls class="w-full h-full bg-black" />
|
||||
</template>
|
||||
|
||||
<template v-else-if="previewType === 'text'">
|
||||
<div class="w-full h-full overflow-auto">
|
||||
<div v-if="textLoading" class="flex items-center justify-center py-10 text-sm text-gray-500">
|
||||
<span class="loading loading-spinner loading-md mr-2"></span>
|
||||
<span class="loading loading-spinner loading-md mr-2" />
|
||||
Chargement du document...
|
||||
</div>
|
||||
<div v-else-if="textError" class="alert alert-error text-sm">
|
||||
@@ -65,7 +67,9 @@
|
||||
</section>
|
||||
|
||||
<footer class="border-t border-base-200 px-6 py-4 flex flex-wrap gap-2 justify-end bg-base-100">
|
||||
<button type="button" class="btn" @click="close">Fermer</button>
|
||||
<button type="button" class="btn" @click="close">
|
||||
Fermer
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" @click="download">
|
||||
Télécharger
|
||||
</button>
|
||||
@@ -82,12 +86,12 @@ import { getPreviewType, describeDocument } from '~/utils/documentPreview'
|
||||
const props = defineProps({
|
||||
document: {
|
||||
type: Object,
|
||||
default: null,
|
||||
default: null
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
@@ -106,8 +110,8 @@ watch(
|
||||
textError.value = ''
|
||||
textLoading.value = false
|
||||
|
||||
if (!doc) return
|
||||
if (getPreviewType(doc) !== 'text') return
|
||||
if (!doc) { return }
|
||||
if (getPreviewType(doc) !== 'text') { return }
|
||||
|
||||
try {
|
||||
textLoading.value = true
|
||||
@@ -142,7 +146,7 @@ const close = () => {
|
||||
}
|
||||
|
||||
const download = () => {
|
||||
if (!props.document?.path) return
|
||||
if (!props.document?.path) { return }
|
||||
const link = document.createElement('a')
|
||||
link.href = props.document.path
|
||||
link.download = props.document.filename || props.document.name || 'document'
|
||||
|
||||
Reference in New Issue
Block a user