adapt kanban images show to new structure

This commit is contained in:
isUnknown 2025-06-06 09:33:08 +02:00
parent 73c78b7658
commit 92007f7161
5 changed files with 48 additions and 16 deletions

View file

@ -9,8 +9,13 @@
<script setup>
import Images from './Images.vue';
import { computed } from 'vue';
import { storeToRefs } from 'pinia';
import { useVirtualSampleStore } from '../../../stores/virtualSample';
const { step } = defineProps({ step: Object });
const { allVariations } = storeToRefs(useVirtualSampleStore());
const images = computed(() => {
if (!step.files.dynamic) {
return [
@ -19,20 +24,20 @@ const images = computed(() => {
},
];
}
return step.files?.dynamic?.map((track) => getFrontView(track)) ?? [];
return allVariations.value.map((variation) => getFrontView(variation)) ?? [];
});
const uri = '/' + step.uri;
function getFrontView(track) {
if (track.files.length === 1) return track.files[0];
function getFrontView(variation) {
if (variation.files.length === 1) return variation.files[0];
const xMax = parseInt(
track.files[track.files.length - 1].name.split('_')[1].split('.')[0]
variation.files[variation.files.length - 1].name.split('_')[1].split('.')[0]
);
const xFrontView = (xMax + 1) / 2;
const extension = track.files[0].name.split('.')[1];
const extension = variation.files[0].name.split('.')[1];
const frontViewName = '0_' + xFrontView + '.' + extension;
const frontView = track.files.find((file) => file.name === frontViewName);
const frontView = variation.files.find((file) => file.name === frontViewName);
return frontView;
}
</script>