Skip to content

Commit 719b395

Browse files
feat(frontend): Sort collections by creation date on user pages and dashboard (#3286)
1 parent 27fba4b commit 719b395

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

apps/frontend/src/pages/dashboard/collections.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
</div>
5050
</nuxt-link>
5151
<nuxt-link
52-
v-for="collection in orderedCollections"
52+
v-for="collection in orderedCollections.sort(
53+
(a, b) => new Date(b.created) - new Date(a.created),
54+
)"
5355
:key="collection.id"
5456
:to="`/collection/${collection.id}`"
5557
class="universal-card recessed collection"

apps/frontend/src/pages/user/[id].vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@
223223
</div>
224224
<div v-if="['collections'].includes(route.params.projectType)" class="collections-grid">
225225
<nuxt-link
226-
v-for="collection in collections"
226+
v-for="collection in collections.sort(
227+
(a, b) => new Date(b.created) - new Date(a.created),
228+
)"
227229
:key="collection.id"
228230
:to="`/collection/${collection.id}`"
229231
class="card collection-item"
@@ -242,7 +244,12 @@
242244
{{ collection.description }}
243245
</div>
244246
<div class="stat-bar">
245-
<div class="stats"><BoxIcon /> {{ collection.projects?.length || 0 }} projects</div>
247+
<div class="stats">
248+
<BoxIcon />
249+
{{
250+
`${$formatNumber(collection.projects?.length || 0, false)} project${(collection.projects?.length || 0) !== 1 ? "s" : ""}`
251+
}}
252+
</div>
246253
<div class="stats">
247254
<template v-if="collection.status === 'listed'">
248255
<WorldIcon />
@@ -638,12 +645,13 @@ export default defineNuxtComponent({
638645
grid-template-columns: repeat(1, 1fr);
639646
}
640647
641-
gap: var(--gap-lg);
648+
gap: var(--gap-md);
642649
643650
.collection-item {
644651
display: flex;
645652
flex-direction: column;
646653
gap: var(--gap-md);
654+
margin-bottom: 0px;
647655
}
648656
649657
.description {
@@ -692,7 +700,7 @@ export default defineNuxtComponent({
692700
693701
.title {
694702
color: var(--color-contrast);
695-
font-weight: 600;
703+
font-weight: 700;
696704
font-size: var(--font-size-lg);
697705
margin: 0;
698706
}

0 commit comments

Comments
 (0)