From 39dfd080674632b57f7436d7e9b4905c83a38af5 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 24 Sep 2022 16:09:39 +0200 Subject: Use PreviewFile also in model index page --- pages/models/_id/index.vue | 55 ++++------------------------------------------ 1 file changed, 4 insertions(+), 51 deletions(-) (limited to 'pages') diff --git a/pages/models/_id/index.vue b/pages/models/_id/index.vue index 6c5bbd4..238aea7 100644 --- a/pages/models/_id/index.vue +++ b/pages/models/_id/index.vue @@ -70,21 +70,7 @@ .block.gap-4.h-full(class="md:flex") .w-full(class="md:w-4/5") .image.bg-gray-900.border-2.rounded-xl.w-full.h-full.overflow-hidden(v-if="model.uploads && model.uploads[selectedUpload]") - img.h-full.block.mx-auto( - v-if="isImage(model.uploads[selectedUpload].filepath)" - :src="baseAPI + '' + model.uploads[selectedUpload].filepath" - ) - model-stl( - v-else-if="isStl(model.uploads[selectedUpload].filepath)" - :rotate="rotate" - :src="baseAPI + '' + model.uploads[selectedUpload].filepath" - :backgroundColor="'#111827'" - ) - model-obj( - v-else-if="isObj(model.uploads[selectedUpload].filepath)" - :src="baseAPI + '' + model.uploads[selectedUpload].filepath" - :backgroundColor="'#111827'" - ) + file-preview(:path="model.uploads[selectedUpload].filepath" bg="#111827" controls="1") .w-full.mt-8.h-auto(class="md:w-1/5 md:mt-0" v-if="model") .grid.grid-cols-3.gap-4.h-full.overflow-y-auto.grid-mini(class="md:grid-cols-2") .border-2.border-gray-300.bg-gray-300.w-20.h-20.rounded-xl.grid.items-center.justify-items-center.overflow-hidden.cursor-pointer( @@ -93,22 +79,7 @@ :class="{'md:w-24 md:h-24': true, 'border-green-700': selectedUpload == i}" @click="selectedUpload = i" ) - img( - v-if="isImage(upload.filepath)" - :src="baseAPI + '' + upload.filepath" - ) - model-stl( - v-else-if="isStl(upload.filepath)" - :rotate="rotate" - :src="baseAPI + '' + upload.filepath" - :backgroundColor="'#D1D5DB'" - :controlsOptions="{'enablePan': false, 'enableZoom': false, 'enableRotate': false}" - ) - model-obj( - v-else-if="isObj(upload.filepath)" - :src="baseAPI + '' + upload.filepath" - :backgroundColor="'#D1D5DB'" - ) + file-preview(:path="upload.filepath") section.mt-5 .grid.grid-cols-2.gap-5.mb-5(class="md:grid-cols-6") @@ -170,7 +141,7 @@