fix inspiration selector
This commit is contained in:
parent
3b86363637
commit
13592a5869
2 changed files with 6 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ $inspirations = $page->children()->map(function ($child) {
|
||||||
'media' => $child->media()->toFiles()->map(function ($file) {
|
'media' => $child->media()->toFiles()->map(function ($file) {
|
||||||
return [
|
return [
|
||||||
'url' => $file->url(),
|
'url' => $file->url(),
|
||||||
'ald' => $file->alt()->value(),
|
'alt' => $file->alt()->value(),
|
||||||
'favoriteForUsers' => $file->favoriteForUsers()->value(),
|
'favoriteForUsers' => $file->favoriteForUsers()->value(),
|
||||||
'name' => $file->filename()
|
'name' => $file->filename()
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,13 @@ const tabs = computed(() => {
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const allImages = page.value.inspirations.flatMap(
|
||||||
|
(inspiration) => inspiration.media
|
||||||
|
);
|
||||||
|
|
||||||
const currentInspiration = ref(page.value.inspirations[0]);
|
const currentInspiration = ref(page.value.inspirations[0]);
|
||||||
const favoriteImages = computed(() => {
|
const favoriteImages = computed(() => {
|
||||||
return currentInspiration.value.media.filter(
|
return allImages.filter(
|
||||||
(image) => image.favoriteForUsers?.includes(user.uuid) ?? false
|
(image) => image.favoriteForUsers?.includes(user.uuid) ?? false
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -71,7 +75,6 @@ function changeTab(newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeInspiration(newValue) {
|
function changeInspiration(newValue) {
|
||||||
console.log(newValue);
|
|
||||||
currentInspiration.value = newValue;
|
currentInspiration.value = newValue;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue