diff --git a/apps/frontend/src/components/ui/moderation/checklist/ModerationChecklist.vue b/apps/frontend/src/components/ui/moderation/checklist/ModerationChecklist.vue index da774cd743..015ac19c75 100644 --- a/apps/frontend/src/components/ui/moderation/checklist/ModerationChecklist.vue +++ b/apps/frontend/src/components/ui/moderation/checklist/ModerationChecklist.vue @@ -1207,6 +1207,29 @@ function handleKeybinds(event: KeyboardEvent) { tryWithhold: () => sendMessage('withheld'), tryEditMessage: goBackToStages, + tryCopyLink: async (permalink: boolean, relative: boolean, page: boolean) => { + let url = `` + if (relative) { + url += `${globalThis.location.origin}` + } else { + url += `https://modrinth.com` + } + + if (permalink) { + url += `/project/${projectV2.value.id}` + } else { + url += `/${projectV2.value.project_type}/${projectV2.value.slug}` + } + + if (page) { + url += `/${globalThis.location.pathname.split('/').slice(3).join('/')}` + } + + await navigator.clipboard.writeText(url) + }, + + tryCopyId: async () => await navigator.clipboard.writeText(projectV2.value.id), + tryToggleAction: (actionIndex: number) => { const action = visibleActions.value[actionIndex] if (action) { diff --git a/packages/moderation/src/data/keybinds.ts b/packages/moderation/src/data/keybinds.ts index 7a15670dba..45be4b1a14 100644 --- a/packages/moderation/src/data/keybinds.ts +++ b/packages/moderation/src/data/keybinds.ts @@ -34,6 +34,46 @@ const keybinds: { [id: string]: KeybindListener } = { enabled: (ctx) => ctx.state.futureProjectCount > 0 && !ctx.state.isDone, action: (ctx) => ctx.actions.trySkipProject(), }, + 'copy-permalink': { + keybind: 'Ctrl+Alt+C', + description: 'Copy permalink', + action: (ctx) => ctx.actions.tryCopyLink(true, false, false), + }, + 'copy-relative-permalink': { + keybind: 'Ctrl+Alt+R', + description: 'Copy relative permalink', + action: (ctx) => ctx.actions.tryCopyLink(true, true, false), + }, + 'copy-page-permalink': { + keybind: 'Shift+Ctrl+Alt+C', + description: 'Copy permalink with page', + action: (ctx) => ctx.actions.tryCopyLink(true, false, true), + }, + 'copy-page-relative-permalink': { + keybind: 'Shift+Ctrl+Alt+R', + description: 'Copy relative permalink with page', + action: (ctx) => ctx.actions.tryCopyLink(true, true, true), + }, + 'copy-id': { + keybind: 'Ctrl+Alt+D', + description: 'Copy Project ID', + action: (ctx) => ctx.actions.tryCopyId(), + }, + 'approve-project': { + keybind: 'Shift+Alt+A', + description: 'Approve project', + action: (ctx) => ctx.actions.tryApprove(), + }, + 'withhold-project': { + keybind: 'Shift+Alt+W', + description: 'Withhold project', + action: (ctx) => ctx.actions.tryWithhold(), + }, + 'reject-project': { + keybind: 'Shift+Alt+R', + description: 'Reject project', + action: (ctx) => ctx.actions.tryReject(), + }, } export default keybinds diff --git a/packages/moderation/src/types/keybinds.ts b/packages/moderation/src/types/keybinds.ts index 86f1e75291..5b31222049 100644 --- a/packages/moderation/src/types/keybinds.ts +++ b/packages/moderation/src/types/keybinds.ts @@ -22,6 +22,9 @@ export interface ModerationActions { tryFocusNextAction: () => void tryFocusPreviousAction: () => void tryActivateFocusedAction: () => void + + tryCopyLink: (permalink: boolean, relative: boolean, page: boolean) => void + tryCopyId: () => void } export interface ModerationState {