feat(frontend): Sort collections by creation date on user pages and dashboard (#3286)

This commit is contained in:
worldwidepixel 2025-02-21 10:41:25 -08:00 committed by GitHub
parent 27fba4ba11
commit 719b395b7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View File

@ -49,7 +49,9 @@
</div>
</nuxt-link>
<nuxt-link
v-for="collection in orderedCollections"
v-for="collection in orderedCollections.sort(
(a, b) => new Date(b.created) - new Date(a.created),
)"
:key="collection.id"
:to="`/collection/${collection.id}`"
class="universal-card recessed collection"

View File

@ -223,7 +223,9 @@
</div>
<div v-if="['collections'].includes(route.params.projectType)" class="collections-grid">
<nuxt-link
v-for="collection in collections"
v-for="collection in collections.sort(
(a, b) => new Date(b.created) - new Date(a.created),
)"
:key="collection.id"
:to="`/collection/${collection.id}`"
class="card collection-item"
@ -242,7 +244,12 @@
{{ collection.description }}
</div>
<div class="stat-bar">
<div class="stats"><BoxIcon /> {{ collection.projects?.length || 0 }} projects</div>
<div class="stats">
<BoxIcon />
{{
`${$formatNumber(collection.projects?.length || 0, false)} project${(collection.projects?.length || 0) !== 1 ? "s" : ""}`
}}
</div>
<div class="stats">
<template v-if="collection.status === 'listed'">
<WorldIcon />
@ -638,12 +645,13 @@ export default defineNuxtComponent({
grid-template-columns: repeat(1, 1fr);
}
gap: var(--gap-lg);
gap: var(--gap-md);
.collection-item {
display: flex;
flex-direction: column;
gap: var(--gap-md);
margin-bottom: 0px;
}
.description {
@ -692,7 +700,7 @@ export default defineNuxtComponent({
.title {
color: var(--color-contrast);
font-weight: 600;
font-weight: 700;
font-size: var(--font-size-lg);
margin: 0;
}