adapt kanban images show to new structure
This commit is contained in:
parent
73c78b7658
commit
92007f7161
5 changed files with 48 additions and 16 deletions
|
|
@ -6,7 +6,19 @@
|
||||||
>
|
>
|
||||||
<label for="selector-select" class="text-sm">{{ label }}</label>
|
<label for="selector-select" class="text-sm">{{ label }}</label>
|
||||||
|
|
||||||
|
<MultiSelect
|
||||||
|
v-if="isCompareModeEnabled"
|
||||||
|
v-model="currentValue"
|
||||||
|
:options="items"
|
||||||
|
optionLabel="title"
|
||||||
|
filter
|
||||||
|
placeholder="Select Cities"
|
||||||
|
:maxSelectedLabels="3"
|
||||||
|
class="w-full md:w-80"
|
||||||
|
/>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
v-else
|
||||||
id="selector-select"
|
id="selector-select"
|
||||||
v-model="currentValue"
|
v-model="currentValue"
|
||||||
:options="items"
|
:options="items"
|
||||||
|
|
@ -19,7 +31,7 @@
|
||||||
<p v-if="currentValue && !Array.isArray(currentValue)">
|
<p v-if="currentValue && !Array.isArray(currentValue)">
|
||||||
{{ currentValue.title }}
|
{{ currentValue.title }}
|
||||||
</p>
|
</p>
|
||||||
<p v-else>Select...</p>
|
<p v-else>Selectionnez</p>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,12 @@
|
||||||
:data-plus="images.length > 3 ? images.length - 3 : undefined"
|
:data-plus="images.length > 3 ? images.length - 3 : undefined"
|
||||||
>
|
>
|
||||||
<template v-for="image in images.slice(0, 3)" :key="image.uuid">
|
<template v-for="image in images.slice(0, 3)" :key="image.uuid">
|
||||||
<img v-if="image.url" :src="image.url" :alt="image.alt" loading="lazy">
|
<img
|
||||||
|
v-if="image.url"
|
||||||
|
:src="image.url"
|
||||||
|
:alt="image.alt"
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
<div v-else class="card__images" data-icon="document"></div>
|
<div v-else class="card__images" data-icon="document"></div>
|
||||||
</template>
|
</template>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
@ -35,6 +40,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import DateTime from './DateTime.vue';
|
import DateTime from './DateTime.vue';
|
||||||
import { useDesignToLightStore } from '../../../stores/designToLight';
|
import { useDesignToLightStore } from '../../../stores/designToLight';
|
||||||
|
import { useVirtualSampleStore } from '../../../stores/virtualSample';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
const { images, step, uri } = defineProps({
|
const { images, step, uri } = defineProps({
|
||||||
|
|
@ -44,6 +50,7 @@ const { images, step, uri } = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const { isDesignToLightStep } = useDesignToLightStore();
|
const { isDesignToLightStep } = useDesignToLightStore();
|
||||||
|
const { allVariations } = useVirtualSampleStore();
|
||||||
|
|
||||||
const commentsCount = computed(() => {
|
const commentsCount = computed(() => {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
@ -54,8 +61,8 @@ const commentsCount = computed(() => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (step.files?.dynamic) {
|
if (step.files?.dynamic) {
|
||||||
for (const track of step.files.dynamic) {
|
for (const variation of allVariations) {
|
||||||
for (const file of track.files) {
|
for (const file of variation.files) {
|
||||||
count += file?.comments?.length || 0;
|
count += file?.comments?.length || 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import Images from './Images.vue';
|
import Images from './Images.vue';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useVirtualSampleStore } from '../../../stores/virtualSample';
|
||||||
|
|
||||||
const { step } = defineProps({ step: Object });
|
const { step } = defineProps({ step: Object });
|
||||||
|
|
||||||
|
const { allVariations } = storeToRefs(useVirtualSampleStore());
|
||||||
|
|
||||||
const images = computed(() => {
|
const images = computed(() => {
|
||||||
if (!step.files.dynamic) {
|
if (!step.files.dynamic) {
|
||||||
return [
|
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;
|
const uri = '/' + step.uri;
|
||||||
|
|
||||||
function getFrontView(track) {
|
function getFrontView(variation) {
|
||||||
if (track.files.length === 1) return track.files[0];
|
if (variation.files.length === 1) return variation.files[0];
|
||||||
const xMax = parseInt(
|
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 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 frontViewName = '0_' + xFrontView + '.' + extension;
|
||||||
const frontView = track.files.find((file) => file.name === frontViewName);
|
const frontView = variation.files.find((file) => file.name === frontViewName);
|
||||||
return frontView;
|
return frontView;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,6 @@ const tracks = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const isSingleImage = computed(() => {
|
const isSingleImage = computed(() => {
|
||||||
console.log(activeTracks.value);
|
|
||||||
return (
|
return (
|
||||||
activeTracks.value?.length === 1 &&
|
activeTracks.value?.length === 1 &&
|
||||||
activeTracks.value[0]?.files?.length === 1
|
activeTracks.value[0]?.files?.length === 1
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,31 @@ import { useDialogStore } from './dialog';
|
||||||
export const useVirtualSampleStore = defineStore('virtual-sample', () => {
|
export const useVirtualSampleStore = defineStore('virtual-sample', () => {
|
||||||
const { page } = storeToRefs(usePageStore());
|
const { page } = storeToRefs(usePageStore());
|
||||||
const { openedFile } = storeToRefs(useDialogStore());
|
const { openedFile } = storeToRefs(useDialogStore());
|
||||||
const step = computed(() => {
|
|
||||||
return page.value.steps.find((step) => step.id === 'virtualSample');
|
|
||||||
});
|
|
||||||
const isCompareModeEnabled = ref(false);
|
|
||||||
|
|
||||||
const activeTab = ref(step.value.files.dynamic ? 'dynamic' : 'static');
|
const isCompareModeEnabled = ref(false);
|
||||||
const currentFile = ref(null);
|
const currentFile = ref(null);
|
||||||
const isLoopAnimationEnabled = ref(false);
|
const isLoopAnimationEnabled = ref(false);
|
||||||
const isDownloadTriggered = ref(false);
|
const isDownloadTriggered = ref(false);
|
||||||
|
|
||||||
|
const step = computed(() => {
|
||||||
|
return page.value.steps.find((step) => step.id === 'virtualSample');
|
||||||
|
});
|
||||||
|
|
||||||
|
const activeTab = computed(() =>
|
||||||
|
step.value.files.dynamic ? 'dynamic' : 'static'
|
||||||
|
);
|
||||||
|
|
||||||
|
const allVariations = computed(() =>
|
||||||
|
Object.values(step.value.files?.dynamic).flat(1)
|
||||||
|
);
|
||||||
|
|
||||||
watch(activeTab, () => (currentFile.value = null));
|
watch(activeTab, () => (currentFile.value = null));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeTab,
|
activeTab,
|
||||||
currentFile,
|
currentFile,
|
||||||
step,
|
step,
|
||||||
|
allVariations,
|
||||||
isLoopAnimationEnabled,
|
isLoopAnimationEnabled,
|
||||||
isCompareModeEnabled,
|
isCompareModeEnabled,
|
||||||
isDownloadTriggered,
|
isDownloadTriggered,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue