kaban : fix comments count for virtual sample step
This commit is contained in:
parent
66987b5086
commit
57b5ee3949
4 changed files with 78 additions and 51 deletions
|
|
@ -17,12 +17,10 @@
|
|||
</template>
|
||||
</figure>
|
||||
<footer
|
||||
v-if="images[0]?.comments?.length > 0"
|
||||
v-if="commentsCount > 0"
|
||||
class="order-last | text-sm text-primary font-medium"
|
||||
>
|
||||
{{ images[0].comments.length }} commentaire{{
|
||||
images[0].comments.length > 1 ? 's' : ''
|
||||
}}
|
||||
{{ commentsCount }} commentaire{{ commentsCount > 1 ? 's' : '' }}
|
||||
</footer>
|
||||
<div
|
||||
class="btn btn--xs btn--dtl | mt-16"
|
||||
|
|
@ -37,6 +35,7 @@
|
|||
<script setup>
|
||||
import DateTime from './DateTime.vue';
|
||||
import { useDesignToLightStore } from '../../../stores/designToLight';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const { images, step, uri } = defineProps({
|
||||
images: Array,
|
||||
|
|
@ -45,4 +44,30 @@ const { images, step, uri } = defineProps({
|
|||
});
|
||||
|
||||
const { isDesignToLightStep } = useDesignToLightStore();
|
||||
|
||||
const commentsCount = computed(() => {
|
||||
let count = 0;
|
||||
|
||||
if (Array.isArray(step.files)) {
|
||||
for (const file of step.files) {
|
||||
count += file?.comments?.length || 0;
|
||||
}
|
||||
} else {
|
||||
if (step.files?.dynamic) {
|
||||
for (const track of step.files.dynamic) {
|
||||
for (const file of track.files) {
|
||||
count += file?.comments?.length || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (step.files?.static) {
|
||||
for (const element of Object.values(step.files.static)) {
|
||||
count += element?.comments?.length || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue