#42 - set first collection images

This commit is contained in:
isUnknown 2024-12-17 16:12:51 +01:00
parent 8ea2b3caf1
commit 2909608b85
12 changed files with 83 additions and 31 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -0,0 +1,21 @@
Alt:
----
Favoriteforusers: - user://HfuumN8s
----
Description:
----
Uuid: 92lqB8nbWNlFoRq5
----
Template: inspiration
----
Tags:

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -0,0 +1,21 @@
Alt:
----
Favoriteforusers:
----
Description:
----
Uuid: jFsUewRf28XSCg5q
----
Template: inspiration
----
Tags:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

View file

@ -1,17 +0,0 @@
Description:
----
Tags:
----
Sort: 7
----
Uuid: l9DOwTKMN7y41B0v
----
Template: image

View file

@ -20,9 +20,11 @@ Description:
Moodboard: Moodboard:
- file://l9DOwTKMN7y41B0v
- file://X7ToEUDi5pus6MVw - file://X7ToEUDi5pus6MVw
- file://xixqq95N7rDEzI8s - file://xixqq95N7rDEzI8s
- file://kXQln0UuNCHoZbrR
- file://92lqB8nbWNlFoRq5
- file://jFsUewRf28XSCg5q
---- ----

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View file

@ -0,0 +1,28 @@
Alt:
----
Favoriteforusers: - user://HfuumN8s
----
Favoriteforclients:
- page://G418qZ4ABsoWFx4i
- page://PweFYnBx27eMZ2mr
----
Description:
----
Uuid: kXQln0UuNCHoZbrR
----
Template: inspiration
----
Tags:

View file

@ -12,12 +12,7 @@ $inspirations = $page->children()->map(function ($child) {
'status' => $child->status(), 'status' => $child->status(),
'cover' => $child->cover()->toFile()->url(), 'cover' => $child->cover()->toFile()->url(),
'media' => $child->media()->toFiles()->map(function ($file) { 'media' => $child->media()->toFiles()->map(function ($file) {
return [ return getFileData($file);
'url' => $file->url(),
'alt' => $file->alt()->value(),
'favoriteForUsers' => $file->favoriteForUsers()->value(),
'name' => $file->filename()
];
})->values() })->values()
]; ];
})->values(); })->values();

View file

@ -42,7 +42,7 @@
/> />
</template> </template>
</div> </div>
<ImagesEditPanel :images="images" /> <ImagesEditPanel />
</div> </div>
</div> </div>
</Dialog> </Dialog>

View file

@ -36,7 +36,8 @@ export const useAddImagesModalStore = defineStore("add-images-modal", () => {
id: "inspirations", id: "inspirations",
component: ImagesResources, component: ImagesResources,
params: false, params: false,
images: [], collections: [],
activeCollectionImages: [],
selectedImages: [], selectedImages: [],
}, },
]); ]);
@ -47,7 +48,7 @@ export const useAddImagesModalStore = defineStore("add-images-modal", () => {
return tabs.value.find((tab) => tab.id === activeTabId.value); return tabs.value.find((tab) => tab.id === activeTabId.value);
}); });
const images = ref({ const selectedImages = ref({
myImages: [], myImages: [],
materials: [], materials: [],
inspirations: [], inspirations: [],
@ -56,16 +57,17 @@ export const useAddImagesModalStore = defineStore("add-images-modal", () => {
const api = useApiStore(); const api = useApiStore();
api api
.fetchData("materials") .fetchData("materials")
.then((json) => (images.value = tabs.value[1].images = json.page.images)); .then((json) => (tabs.value[1].images = json.page.images));
api.fetchData("creations").then((json) => { api.fetchData("creations").then((json) => {
images.value = tabs.value[2].images = json.page.images; tabs.value[2].images = json.page.images;
}); });
api.fetchData("inspirations").then((json) => { api.fetchData("inspirations").then((json) => {
console.log(json); console.log(json);
images.value = tabs.value[3].images = json.page.images; tabs.value[3].collections = json.page.inspirations;
tabs.value[3].images = json.page.inspirations[0].media;
}); });
return { images, activeTabId, tabs, activeTab }; return { activeTabId, tabs, activeTab };
}); });