mirror of
https://github.com/modrinth/code.git
synced 2026-09-05 06:19:11 +00:00
tech review qa part 2 (#7377)
* feat: per file slicer button, with custom target * chore: move slicer link to file card instead of issue card * chore: move slicer link to file card instead of issue card * tech rev part 2 * finish merge issues * alternative host link settings * QA changes * prepr * remove duplicate key * tech rev qa 3 * report consistency + loading state to fix jumping * fix error + queue consistency pt 2 --------- Co-authored-by: Gravy Boat <gravy@thatgravyboat.tech>
This commit is contained in:
@@ -34,11 +34,6 @@ function isOfficialModrinthHost(): boolean {
|
||||
return host === 'modrinth.com' || host === 'www.modrinth.com' || host === 'staging.modrinth.com'
|
||||
}
|
||||
|
||||
function isLocalhost(): boolean {
|
||||
const host = globalThis.location?.hostname
|
||||
return host === 'localhost' || host === '127.0.0.1' || host === '[::1]'
|
||||
}
|
||||
|
||||
const keybinds: { [id: string]: KeybindListener } = {
|
||||
'next-stage': {
|
||||
keybind: 'ArrowRight',
|
||||
@@ -125,27 +120,21 @@ const keybinds: { [id: string]: KeybindListener } = {
|
||||
},
|
||||
'open-official-site': {
|
||||
keybind: 'Ctrl+Shift+P',
|
||||
description: 'Open current page on production/staging',
|
||||
description: isOfficialModrinthHost()
|
||||
? 'Open current page on production/staging'
|
||||
: 'Open current page on alternative host',
|
||||
scope: 'global',
|
||||
enabled: () => !isOfficialModrinthHost(),
|
||||
enabled: (ctx) => !isOfficialModrinthHost() || !!ctx.alternativeUrl,
|
||||
action: (ctx) => {
|
||||
globalThis.open(ctx.officialUrl, '_blank', 'noopener,noreferrer')
|
||||
},
|
||||
},
|
||||
'open-localhost': {
|
||||
keybind: [],
|
||||
description: 'Open current page on localhost',
|
||||
scope: 'global',
|
||||
enabled: () => !isLocalhost(),
|
||||
action: (ctx) => {
|
||||
globalThis.open(ctx.localhostUrl, '_blank', 'noopener,noreferrer')
|
||||
const url = isOfficialModrinthHost() ? ctx.alternativeUrl : ctx.officialUrl
|
||||
globalThis.open(url, '_blank', 'noopener,noreferrer')
|
||||
},
|
||||
},
|
||||
'copy-official-site': {
|
||||
keybind: 'Ctrl+Shift+O',
|
||||
description: 'Copy production/staging URL (localhost only)',
|
||||
description: 'Copy official URL',
|
||||
scope: 'global',
|
||||
enabled: () => isLocalhost(),
|
||||
enabled: () => !isOfficialModrinthHost(),
|
||||
action: async (ctx) => {
|
||||
await navigator.clipboard.writeText(ctx.officialUrl)
|
||||
const environment = ctx.officialUrl.startsWith('https://staging.modrinth.com')
|
||||
|
||||
@@ -5,7 +5,7 @@ const settings = {
|
||||
ChecklistPosition: setting.asEnum({
|
||||
type: 'enum',
|
||||
id: 'checklist-position',
|
||||
title: 'Checklist Position',
|
||||
title: 'Checklist position',
|
||||
description: 'Where the checklist should be displayed on the page',
|
||||
entries: [
|
||||
{ value: 'left', label: 'Left' },
|
||||
@@ -16,28 +16,28 @@ const settings = {
|
||||
ProjectKeybinds: setting.asToggle({
|
||||
type: 'toggle',
|
||||
id: 'project-keybinds',
|
||||
title: 'Enable Project Keybinds',
|
||||
title: 'Enable project keybinds',
|
||||
description: 'Weather certain keybinds should work without the checklist visible.',
|
||||
default: false,
|
||||
}),
|
||||
PrivateMessageHighlight: setting.asToggle({
|
||||
type: 'toggle',
|
||||
id: 'private-message-highlight',
|
||||
title: 'Highlight Private Messages',
|
||||
title: 'Highlight private messages',
|
||||
description: 'Whether private messages should be highlighted in the chat.',
|
||||
default: true,
|
||||
}),
|
||||
SlicerButtonInVersions: setting.asToggle({
|
||||
type: 'toggle',
|
||||
id: 'slicer-button-in-versions',
|
||||
title: 'Show Slicer Button in Versions Table and Page',
|
||||
title: 'Show Slicer button in versions table and page',
|
||||
description: 'Whether the slicer button should be shown in the versions table and page.',
|
||||
default: false,
|
||||
}),
|
||||
AdjustPageAlignment: setting.asEnum({
|
||||
type: 'enum',
|
||||
id: 'adjust-page-alignment',
|
||||
title: 'Adjust Page Alignment',
|
||||
title: 'Adjust page alignment',
|
||||
description:
|
||||
'Whether the main page elements should be centered or offset opposite to the Checklist Position.',
|
||||
entries: [
|
||||
@@ -47,6 +47,14 @@ const settings = {
|
||||
],
|
||||
default: 'never',
|
||||
}),
|
||||
AlternativeHostname: setting.asString({
|
||||
type: 'string',
|
||||
id: 'alternative-hostname',
|
||||
title: 'Alternative hostname',
|
||||
description:
|
||||
'When Open production/staging is used on an official host, open this hostname instead. Example: localhost:3000',
|
||||
default: null,
|
||||
}),
|
||||
},
|
||||
} as const
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export type ModerationTechReviewContext = {
|
||||
export type ModerationGlobalContext = {
|
||||
scope: 'global'
|
||||
officialUrl: string
|
||||
localhostUrl: string
|
||||
alternativeUrl: string
|
||||
notifyCopied: (value: string, title: string) => void
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Labrinth, SharedInstances } from '@modrinth/api-client'
|
||||
import type { Thread, User, Version } from '@modrinth/utils'
|
||||
|
||||
export interface OwnershipTarget {
|
||||
id: string
|
||||
name: string
|
||||
slug: string
|
||||
avatar_url?: string
|
||||
|
||||
Reference in New Issue
Block a user