From e34eea7bfbc302bf123fbb46c95c498762d0ed69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 3 Oct 2024 17:35:37 +0200 Subject: [PATCH] chore: add back sort on modules --- composables/useModules.ts | 7 +++++-- pages/modules/index.vue | 43 +++++++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/composables/useModules.ts b/composables/useModules.ts index b2225da7e..c138dabdd 100644 --- a/composables/useModules.ts +++ b/composables/useModules.ts @@ -246,8 +246,11 @@ export const useModules = () => { filteredModules = filteredModules.reverse() } - // sponsored & official modules in first place - return filteredModules.sort(isSponsorOrOfficial) + // sponsored & official modules in first place if no sort or order by + if (!route.query.sortBy && !route.query.orderBy) { + return filteredModules.sort(isSponsorOrOfficial) + } + return filteredModules }) return { diff --git a/pages/modules/index.vue b/pages/modules/index.vue index ebce269c5..be7394a19 100644 --- a/pages/modules/index.vue +++ b/pages/modules/index.vue @@ -7,7 +7,7 @@ const inputRef = ref() const route = useRoute() const { replaceRoute } = useFilters('modules') -const { fetchList, filteredModules, q, categories, stats } = useModules() +const { fetchList, filteredModules, q, categories, stats, selectedOrder, sorts, selectedSort } = useModules() const { data: page } = await useAsyncData(route.path, () => queryContent(route.path).findOne()) @@ -64,7 +64,7 @@ const { copy } = useCopyToClipboard() name="q" icon="i-ph-magnifying-glass" placeholder="Search..." - class="w-full mb-4" + class="w-full mb-2" size="md" autocomplete="off" :ui="{ icon: { trailing: { pointer: '' } } }" @@ -85,12 +85,28 @@ const { copy } = useCopyToClipboard() + + + + - -
+ +
+ + + +