Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions apps/frontend/src/components/project-review/queue-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,26 @@
</div>
</div>
<div class="flex items-center gap-1">
<template v-if="settings.get(moderationSettings.General.ShowProjectReviewTimer)">
<span class="text-xs font-medium">
<span> Reviewing for </span>
<span
class="tabular-nums"
:class="
getClassForWarning(
secondsSinceLastUpdate,
settings.get(moderationSettings.General.ProjectReviewTimerWarning),
)
"
>
{{ secondsSinceLastUpdate < 0 ? '-' : ''
}}{{ (Math.abs(secondsSinceLastUpdate) / 60).toFixed(0).padStart(2, '0') }}:{{
(Math.abs(secondsSinceLastUpdate) % 60).toFixed(0).padStart(2, '0')
}}
</span>
</span>
<span class="mx-1.5 h-5 w-px bg-divider" aria-hidden="true" />
</template>
<Tooltip :delay="750">
<template #popper>
<div class="flex items-center gap-2">
Expand Down Expand Up @@ -217,6 +237,7 @@ import {
type TabbedModalTab,
Tooltip,
} from '@modrinth/ui'
import { useNow } from '@vueuse/core'
import { computed, ref } from 'vue'
import ModerationAppearance from '~/components/ui/moderation/settings/ModerationAppearance.vue'
Expand Down Expand Up @@ -333,6 +354,17 @@ const queueColumns = computed(() => {
},
]
})
const now = useNow({ interval: 1000 })
const secondsSinceLastUpdate = computed(() =>
Math.ceil((now.value.getTime() - queue.currentQueue.lastUpdated.getTime()) / 1000),
)
function getClassForWarning(seconds: number, cutoff: number) {
if (cutoff <= 0) return 'text-primary'
if (seconds > cutoff) return 'text-red'
if (seconds > cutoff / 2) return 'text-orange'
return 'text-primary'
}
function runPanelAction(action: () => void, hide: () => void) {
action()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ const groups = [
general.PrivateMessageHighlight,
],
},
{
id: 'queue-bar',
title: 'Queue Bar',
settings: [general.ShowProjectReviewTimer, general.ProjectReviewTimerWarning],
},
{
id: 'shortcuts',
title: 'Editors and shortcut hints',
Expand Down
20 changes: 20 additions & 0 deletions packages/moderation/src/data/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,26 @@ const settings = {
description: 'Allow queue navigation to include projects that are no longer awaiting review.',
default: false,
}),
ShowProjectReviewTimer: setting.asToggle({
type: 'toggle',
id: 'show-project-review-timer',
title: 'Show project review timer',
description:
'Show a timer in the project review queue bar indicating how long you have been reviewing the current project.',
default: false,
}),
ProjectReviewTimerWarning: setting.asNumber({
type: 'number',
id: 'project-review-timer-warning',
title: 'Project review timer warning',
description:
'Maximum time in seconds to show the project review timer before it turns red. Set to 0 to disable the warning. At >=50% of the time it will turn orange.',
default: 0,
min: 0,
max: 3600,
step: 60,
unit: 's',
}),
},
} as const

Expand Down
Loading