Skip to content

Commit 0ac49d8

Browse files
authored
Add project issues link to report form if it exists (#3215)
1 parent cade2c1 commit 0ac49d8

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

apps/frontend/src/locales/en-US/index.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@
521521
"report.not-for.bug-reports": {
522522
"message": "Bug reports"
523523
},
524+
"report.not-for.bug-reports.description": {
525+
"message": "You can report bugs to their <issues-link>issue tracker</issues-link>."
526+
},
524527
"report.not-for.dmca": {
525528
"message": "DMCA takedowns"
526529
},

apps/frontend/src/pages/report.vue

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,20 @@
6363
<h2 class="m-0 text-lg font-extrabold">{{ formatMessage(messages.formNotFor) }}</h2>
6464
<div class="text-md flex items-center gap-2 font-semibold text-contrast">
6565
<XCircleIcon class="h-8 w-8 shrink-0 text-brand-red" />
66-
<span>{{ formatMessage(messages.bugReports) }}</span>
66+
67+
<div class="flex flex-col">
68+
<span>{{ formatMessage(messages.bugReports) }}</span>
69+
<span v-if="itemIssueTracker" class="text-sm font-medium text-secondary">
70+
<IntlFormatted :message-id="messages.bugReportsDescription">
71+
<template #issues-link="{ children }">
72+
<a class="text-link" :href="itemIssueTracker" target="_blank">
73+
<component :is="() => children" />
74+
<ExternalIcon aria-hidden="true" class="mb-1 ml-1 h-2.5 w-2.5" />
75+
</a>
76+
</template>
77+
</IntlFormatted>
78+
</span>
79+
</div>
6780
</div>
6881
<div class="text-md flex items-center gap-2 font-semibold text-contrast">
6982
<XCircleIcon class="h-8 w-8 shrink-0 text-brand-red" />
@@ -238,6 +251,7 @@ import {
238251
AutoLink,
239252
} from "@modrinth/ui";
240253
import {
254+
ExternalIcon,
241255
LeftArrowIcon,
242256
RightArrowIcon,
243257
CheckIcon,
@@ -289,6 +303,7 @@ const itemIcon = ref<string | Component | undefined>();
289303
const itemName = ref<string | undefined>();
290304
const itemLink = ref<string | undefined>();
291305
const itemId = ref<string | undefined>();
306+
const itemIssueTracker = ref<string | undefined>();
292307
293308
const reports = ref<Report[]>([]);
294309
const existingReport = computed(() =>
@@ -319,6 +334,7 @@ async function fetchItem() {
319334
itemName.value = undefined;
320335
itemLink.value = undefined;
321336
itemId.value = undefined;
337+
itemIssueTracker.value = undefined;
322338
try {
323339
if (reportItem.value === "project") {
324340
const project = (await useBaseFetch(`project/${reportItemID.value}`)) as Project;
@@ -328,6 +344,7 @@ async function fetchItem() {
328344
itemName.value = project.title;
329345
itemLink.value = `/project/${project.id}`;
330346
itemId.value = project.id;
347+
itemIssueTracker.value = project.issues_url;
331348
} else if (reportItem.value === "version") {
332349
const version = (await useBaseFetch(`version/${reportItemID.value}`)) as Version;
333350
currentVersion.value = version;
@@ -540,6 +557,10 @@ const messages = defineMessages({
540557
id: "report.not-for.bug-reports",
541558
defaultMessage: "Bug reports",
542559
},
560+
bugReportsDescription: {
561+
id: "report.not-for.bug-reports.description",
562+
defaultMessage: "You can report bugs to their <issues-link>issue tracker</issues-link>.",
563+
},
543564
dmcaTakedown: {
544565
id: "report.not-for.dmca",
545566
defaultMessage: "DMCA takedowns",

0 commit comments

Comments
 (0)