@@ -231,6 +243,7 @@ import KbdChip from './kdb-chip.vue'
import { injectProjectReviewContext } from './layout/context'
import QueueProjectList from './queue-project-list.vue'
import { useReviewShortcut } from './shortcuts'
+import {useNow} from "@vueuse/core";
const config = useRuntimeConfig()
const { hostname } = useRequestURL()
@@ -333,6 +346,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()
diff --git a/apps/frontend/src/components/project-review/tech-review/code-viewer/index.vue b/apps/frontend/src/components/project-review/tech-review/code-viewer/index.vue
index cfd686ea3fd..e54d450ac8f 100644
--- a/apps/frontend/src/components/project-review/tech-review/code-viewer/index.vue
+++ b/apps/frontend/src/components/project-review/tech-review/code-viewer/index.vue
@@ -117,8 +117,8 @@ async function openSearch() {
const pane = sourcePane.value
const selection = pane?.ownerDocument.getSelection()
if (selection && pane?.contains(selection.anchorNode) && pane.contains(selection.focusNode)) {
- const text = selection.toString()
- if (text && !text.includes('\n')) findQuery.value = text
+ const text = selection.rangeCount ? selection.getRangeAt(0).cloneRange().toString() : null;
+ if (text && !text.includes('\n')) findQuery.value = text.trim()
}
matchMode.value = 'search'
await nextTick()
diff --git a/apps/frontend/src/components/project-review/versions/version-card.vue b/apps/frontend/src/components/project-review/versions/version-card.vue
index 454fe71200f..65c546d4e07 100644
--- a/apps/frontend/src/components/project-review/versions/version-card.vue
+++ b/apps/frontend/src/components/project-review/versions/version-card.vue
@@ -613,6 +613,13 @@ function fileActions(file: VersionFile): ButtonMenuOption[] {
},
},
},
+ {
+ id: 'copy-file-id',
+ label: 'Copy file ID',
+ icon: ClipboardCopyIcon,
+ disabled: !file.id,
+ action: () => navigator.clipboard.writeText(file.id),
+ }
]
for (const algorithm of ['sha1', 'sha512'] as const) {
const hash = file.hashes[algorithm]
diff --git a/apps/frontend/src/components/ui/moderation/settings/ModerationSettings.vue b/apps/frontend/src/components/ui/moderation/settings/ModerationSettings.vue
index 1d5971a9d4d..9bac7caf8fc 100644
--- a/apps/frontend/src/components/ui/moderation/settings/ModerationSettings.vue
+++ b/apps/frontend/src/components/ui/moderation/settings/ModerationSettings.vue
@@ -60,6 +60,14 @@ const groups = [
general.PrivateMessageHighlight,
],
},
+ {
+ id: 'queue-bar',
+ title: 'Queue Bar',
+ settings: [
+ general.ShowProjectReviewTimer,
+ general.ProjectReviewTimerWarning,
+ ]
+ },
{
id: 'shortcuts',
title: 'Editors and shortcut hints',
diff --git a/apps/frontend/src/providers/project-review/review-submission.ts b/apps/frontend/src/providers/project-review/review-submission.ts
index 86606a9942b..2e1289e109f 100644
--- a/apps/frontend/src/providers/project-review/review-submission.ts
+++ b/apps/frontend/src/providers/project-review/review-submission.ts
@@ -230,7 +230,13 @@ export function createReviewSubmission(
await client.labrinth.threads_v3.editIssueFacet(facet.id, facet.data)
}
assertPass()
- await client.labrinth.tech_review_internal.submitProject(id, { verdict: 'safe' })
+ client.labrinth.tech_review_internal.submitProject(id, { verdict: 'safe' }).catch(error => {
+ addNotification({
+ title: 'An error occurred',
+ text: error instanceof Error ? error.message : String(error),
+ type: 'error',
+ })
+ })
if (reply) {
await sendThreadReply(reply, client, () => {
assertCurrent(id)
diff --git a/packages/api-client/src/modules/labrinth/tech-review/internal.ts b/packages/api-client/src/modules/labrinth/tech-review/internal.ts
index d2f8445afe7..2bec218de38 100644
--- a/packages/api-client/src/modules/labrinth/tech-review/internal.ts
+++ b/packages/api-client/src/modules/labrinth/tech-review/internal.ts
@@ -292,6 +292,7 @@ export class LabrinthTechReviewInternalModule extends AbstractModule {
version: 'internal',
method: 'POST',
body: data,
+ timeout: 30_000,
})
}
diff --git a/packages/moderation/src/data/settings.ts b/packages/moderation/src/data/settings.ts
index 6a594fc2543..ba111d6fa7e 100644
--- a/packages/moderation/src/data/settings.ts
+++ b/packages/moderation/src/data/settings.ts
@@ -284,6 +284,24 @@ 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 >=75% of the time it will turn orange.',
+ default: 0,
+ min: 0,
+ max: 3600,
+ step: 60,
+ unit: 's',
+ }),
},
} as const