Skip to content

Commit fd6dd24

Browse files
authored
feat: initial submission sort (#7824)
* feat(labrinth): track initial review submission * feat(labrinth): oldest initial sort option * feat(frontend): sort by oldest initial submission
1 parent 21fb2e3 commit fd6dd24

16 files changed

Lines changed: 438 additions & 335 deletions

‎apps/frontend/src/components/ui/moderation/ModerationQueueCard.vue‎

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,25 @@
9090
</div>
9191

9292
<div class="flex items-center gap-3">
93-
<span
94-
v-tooltip="`Since ${formatDateTimeFull(queuedDate.toDate())}`"
95-
class="text-base text-secondary"
96-
:class="{
97-
'text-red': daysInQueue > 4,
98-
'text-orange': daysInQueue > 2 && daysInQueue <= 4,
99-
}"
100-
>
101-
{{ formattedDate }}
102-
</span>
93+
<div class="flex flex-col items-end">
94+
<span
95+
v-tooltip="`Since ${formatDateTimeFull(queuedDate.toDate())}`"
96+
class="text-base text-secondary"
97+
:class="{
98+
'text-red': daysInQueue > 4,
99+
'text-orange': daysInQueue > 2 && daysInQueue <= 4,
100+
}"
101+
>
102+
{{ formattedDate }}
103+
</span>
104+
<span
105+
v-if="initialQueuedDate"
106+
v-tooltip="`First submitted ${formatDateTimeFull(initialQueuedDate.toDate())}`"
107+
class="text-sm text-secondary"
108+
>
109+
First submitted {{ formatRelativeTime(initialQueuedDate.toISOString()) }}
110+
</span>
111+
</div>
103112

104113
<div class="flex items-center gap-2">
105114
<CopyCode v-tooltip="'Copy project ID'" :text="queueEntry.project.id" />
@@ -186,6 +195,14 @@ const queuedDate = computed(() => {
186195
)
187196
})
188197
198+
const initialQueuedDate = computed(() => {
199+
const initialQueued = props.queueEntry.project.initial_queued
200+
if (!initialQueued) return null
201+
202+
const date = dayjs(initialQueued)
203+
return date.isBefore(queuedDate.value.subtract(1, 'minute')) ? date : null
204+
})
205+
189206
const daysInQueue = computed(() => {
190207
return getDaysQueued(queuedDate.value.toDate())
191208
})

‎apps/frontend/src/pages/moderation/index.vue‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
<template #selected>
4343
<span class="flex flex-row gap-2 align-middle font-semibold">
4444
<SortAscIcon
45-
v-if="currentSortType === 'Oldest' || currentSortType === 'Least external deps'"
45+
v-if="
46+
['Oldest', 'First submitted', 'Least external deps'].includes(currentSortType)
47+
"
4648
class="size-5 flex-shrink-0 text-secondary"
4749
/>
4850
<SortDescIcon v-else class="size-5 flex-shrink-0 text-secondary" />
@@ -271,6 +273,7 @@ const MODPACK_FILTER_TYPE = 'Modpacks'
271273
const baseSortTypes: ComboboxOption<string>[] = [
272274
{ value: 'Oldest', label: 'Oldest' },
273275
{ value: 'Newest', label: 'Newest' },
276+
{ value: 'First submitted', label: 'First submitted' },
274277
]
275278
const modpackSortTypes: ComboboxOption<string>[] = [
276279
{ value: 'Most external deps', label: 'Most external deps' },
@@ -426,6 +429,8 @@ function toApiSort(label: string): Labrinth.Moderation.Internal.ProjectsSort {
426429
switch (label) {
427430
case 'Newest':
428431
return 'newest'
432+
case 'First submitted':
433+
return 'oldest_initial'
429434
case 'Most external deps':
430435
return 'most_external_deps'
431436
case 'Least external deps':

‎apps/labrinth/.sqlx/query-2ef077521d6ffa77609bc37f4cc33f2103bf11418fa1d16e5bd1b8a49ca12b46.json‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

apps/labrinth/.sqlx/query-2733cc4440a0d3135249729f622c5daaee0a00f04cdd033b68c02a468c2c17c6.json renamed to apps/labrinth/.sqlx/query-2faa0c02b162d1311260bf29793a3f1a7cf60ee33f2725141fc97747ac574370.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/labrinth/.sqlx/query-2fd123813896a880bc7a4a4cd195766099a04bda40cec97f0707b9c78c7fafdc.json‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)