disable optimization request btn if already sent

This commit is contained in:
isUnknown 2025-02-05 11:22:09 +01:00
parent 77a0a42606
commit c73b9d671b
7 changed files with 114 additions and 81 deletions

View file

@ -21,15 +21,22 @@
class="order-last | text-sm text-primary font-medium"
>
{{ images[0].comments.length }} commentaire{{
images[0].comments.length > 1 ? "s" : ""
images[0].comments.length > 1 ? 's' : ''
}}
</footer>
<div class="btn btn--xs btn--dtl | mt-16" v-if="isDesignToLightStep(step)" data-icon="leaf" lang="en">Design to Light</div>
<div
class="btn btn--xs btn--dtl | mt-16"
v-if="isDesignToLightStep(step)"
data-icon="leaf"
lang="en"
>
Design to Light
</div>
</article>
</template>
<script setup>
import DateTime from "./DateTime.vue";
import { useDesignToLightStore } from "../../../stores/designToLight";
import DateTime from './DateTime.vue';
import { useDesignToLightStore } from '../../../stores/designToLight';
const { images, step, uri } = defineProps({
images: Array,

View file

@ -7,31 +7,39 @@
/>
</template>
<script setup>
import Images from "./Images.vue";
import { computed } from "vue";
import Images from './Images.vue';
import { computed } from 'vue';
const { step } = defineProps({ step: Object });
const images = computed(() => {
if (!step.files.dynamic) {
return [
{
url: step.files.static.rawGlass.cover,
url: step.files?.static?.rawGlass?.cover,
},
{
url: step.files?.static?.finishedGlass?.cover,
},
];
}
return step.files?.dynamic?.map((track) => getFrontView(track)) ?? [];
return (
step.files?.dynamic?.map(
(track) => (getFrontView(track)['dynamic'] = true)
) ?? []
);
});
const uri = "/" + step.uri;
const uri = '/' + step.uri;
function getFrontView(track) {
if (track.files.length === 1) return track.files[0];
const xMax = parseInt(
track.files[track.files.length - 1].name.split("_")[1].split(".")[0]
track.files[track.files.length - 1].name.split('_')[1].split('.')[0]
);
const xFrontView = (xMax + 1) / 2;
const extension = track.files[0].name.split(".")[1];
const frontViewName = "0_" + xFrontView + "." + extension;
const extension = track.files[0].name.split('.')[1];
const frontViewName = '0_' + xFrontView + '.' + extension;
const frontView = track.files.find((file) => file.name === frontViewName);
return frontView;
}