diff --git a/app/composables/useCategories.ts b/app/composables/useCategories.ts index ca907a7..4061552 100644 --- a/app/composables/useCategories.ts +++ b/app/composables/useCategories.ts @@ -49,11 +49,12 @@ export const useCategories = () => { }) } - const getCategoryGalleries = async (id: number) => { + const getCategoryGalleries = async (id: number, getUnpublished: boolean = true) => { return await $fetch(`/api/v1/category/gallery`, { method: 'GET', query: { - id: id + id: id, + getUnpublished: getUnpublished } }) } diff --git a/app/layouts/MainLayout.vue b/app/layouts/MainLayout.vue index 11cc14e..7dc8f49 100644 --- a/app/layouts/MainLayout.vue +++ b/app/layouts/MainLayout.vue @@ -15,9 +15,9 @@ const links = [ to: `/matches` }, { - label: 'Leagues', + label: 'Tables', icon: 'i-lucide-users', - to: `/leagues` + to: `/tables` }, { label: 'Galleries', diff --git a/app/pages/galleries/[galleryId].vue b/app/pages/galleries/[galleryId].vue index 5811f9d..71b507a 100644 --- a/app/pages/galleries/[galleryId].vue +++ b/app/pages/galleries/[galleryId].vue @@ -46,12 +46,12 @@ function isVideo(url: string){ :title="data?.name" > -
-
+
+
media image
diff --git a/app/pages/galleries/index.vue b/app/pages/galleries/index.vue index 9ffa3aa..f031770 100644 --- a/app/pages/galleries/index.vue +++ b/app/pages/galleries/index.vue @@ -3,18 +3,35 @@ import MainLayout from "~/layouts/MainLayout.vue"; import type {Category, Gallery} from "@prisma/client"; -const loadingPage = ref(true); +const loadingCategories = ref(true), loadingGalleries = ref(true); const $util = useCategories(), $gallery = useGalleries() -const categories = ref(), galleries = ref>() +const categories = ref([]), galleries = ref>([]) onMounted(async () => { - loadingPage.value = true + loadingCategories.value = true + loadingGalleries.value = true categories.value = (await $util.getCategories()).reverse() + loadingCategories.value = false for(let i = 0; i < categories.value.length; i++) - galleries.value?.push(await $util.getCategoryGalleries(categories.value?.at(i)?.id || 0)) - - loadingPage.value = false + galleries.value?.push(await $util.getCategoryGalleries(categories.value?.at(i)?.id || 0, false)) + console.log(galleries.value.length) + console.log(categories.value) + loadingGalleries.value = false }) +function getImageLink(){ + return "https://picsum.photos/200/150" +} +function parseAndFormatDate(dateString: string): string { + const date = new Date(dateString); + + const year = date.getUTCFullYear(); + const month = (date.getUTCMonth() + 1).toString().padStart(2, '0'); + const day = date.getUTCDate().toString().padStart(2, '0'); + const hours = date.getUTCHours().toString().padStart(2, '0'); + const minutes = date.getUTCMinutes().toString().padStart(2, '0'); + + return `${year}/${month}/${day}, ${hours}:${minutes}`; +}