2024-12-20 07:19:46 +01:00
|
|
|
<template>
|
|
|
|
|
<article class="card">
|
|
|
|
|
<hgroup class="order-last">
|
|
|
|
|
<h3 class="card__title | font-serif | text-lg">
|
2024-12-20 10:40:44 +01:00
|
|
|
<router-link :to="uri" class="link-full">{{ step.label }}</router-link>
|
2024-12-20 07:19:46 +01:00
|
|
|
</h3>
|
|
|
|
|
</hgroup>
|
|
|
|
|
<DateTime :date="step.modified" />
|
|
|
|
|
<figure
|
|
|
|
|
class="card__images"
|
|
|
|
|
:data-count="images.length"
|
|
|
|
|
:data-plus="images.length > 3 ? images.length - 3 : undefined"
|
|
|
|
|
>
|
|
|
|
|
<template v-for="image in images.slice(0, 3)" :key="image.uuid">
|
2025-02-12 16:30:36 +01:00
|
|
|
<img v-if="image.url" :src="image.url" :alt="image.alt" loading="lazy">
|
2024-12-20 10:55:33 +01:00
|
|
|
<div v-else class="card__images" data-icon="document"></div>
|
2024-12-20 07:19:46 +01:00
|
|
|
</template>
|
|
|
|
|
</figure>
|
2025-01-27 10:40:30 +01:00
|
|
|
<footer
|
2025-02-09 10:57:25 +01:00
|
|
|
v-if="commentsCount > 0"
|
2024-12-20 07:19:46 +01:00
|
|
|
class="order-last | text-sm text-primary font-medium"
|
|
|
|
|
>
|
2025-02-09 10:57:25 +01:00
|
|
|
{{ commentsCount }} commentaire{{ commentsCount > 1 ? 's' : '' }}
|
2025-01-27 10:40:30 +01:00
|
|
|
</footer>
|
2025-02-05 11:22:09 +01:00
|
|
|
<div
|
|
|
|
|
class="btn btn--xs btn--dtl | mt-16"
|
|
|
|
|
v-if="isDesignToLightStep(step)"
|
|
|
|
|
data-icon="leaf"
|
|
|
|
|
lang="en"
|
|
|
|
|
>
|
|
|
|
|
Design to Light
|
|
|
|
|
</div>
|
2024-12-20 07:19:46 +01:00
|
|
|
</article>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
2025-02-05 11:22:09 +01:00
|
|
|
import DateTime from './DateTime.vue';
|
|
|
|
|
import { useDesignToLightStore } from '../../../stores/designToLight';
|
2025-02-09 10:57:25 +01:00
|
|
|
import { computed } from 'vue';
|
2024-12-20 07:19:46 +01:00
|
|
|
|
2024-12-20 10:40:44 +01:00
|
|
|
const { images, step, uri } = defineProps({
|
|
|
|
|
images: Array,
|
|
|
|
|
step: Object,
|
|
|
|
|
uri: String,
|
|
|
|
|
});
|
2025-01-23 17:39:40 +01:00
|
|
|
|
|
|
|
|
const { isDesignToLightStep } = useDesignToLightStore();
|
2025-02-09 10:57:25 +01:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
});
|
2024-12-20 07:19:46 +01:00
|
|
|
</script>
|