fix: no gap after navtabs on collections (#5740)

* fix: no gap after navtabs on collections

* fix collection sorting
This commit is contained in:
Prospector
2026-04-04 07:53:53 -07:00
committed by GitHub
parent dc96043adc
commit 3091021194
3 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
const COLLECTION_PREFIX = '/collection/bLYCa4PJ'
export default defineNuxtRouteMiddleware((to) => {
if (to.path === COLLECTION_PREFIX || to.path.startsWith(`${COLLECTION_PREFIX}/`)) {
return navigateTo(`https://april-fools-2026.modrinth.com${to.fullPath}`, {
external: true,
redirectCode: 302,
})
}
})

View File

@@ -290,6 +290,7 @@
} }
}), }),
]" ]"
class="mb-4"
/> />
<ProjectCardList <ProjectCardList

View File

@@ -353,9 +353,7 @@
class="collections-grid" class="collections-grid"
> >
<nuxt-link <nuxt-link
v-for="collection in (collections ?? []).sort( v-for="collection in sortedCollections"
(a, b) => new Date(b.created) - new Date(a.created),
)"
:key="collection.id" :key="collection.id"
:to="`/collection/${collection.id}`" :to="`/collection/${collection.id}`"
class="card collection-item" class="card collection-item"
@@ -748,6 +746,17 @@ const sortedOrgs = computed(() =>
organizations.value ? [...organizations.value].sort((a, b) => a.name.localeCompare(b.name)) : [], organizations.value ? [...organizations.value].sort((a, b) => a.name.localeCompare(b.name)) : [],
) )
const sortedCollections = computed(() => {
const list = collections.value
if (!list?.length) return []
return [...list].sort((a, b) => {
const updatedB = new Date(b.updated).getTime()
const updatedA = new Date(a.updated).getTime()
if (updatedB !== updatedA) return updatedB - updatedA
return new Date(b.created).getTime() - new Date(a.created).getTime()
})
})
const title = computed(() => (user.value ? `${user.value.username} - Modrinth` : 'Modrinth')) const title = computed(() => (user.value ? `${user.value.username} - Modrinth` : 'Modrinth'))
const description = computed(() => const description = computed(() =>
user.value?.bio user.value?.bio