fix tags warning, and link shorteners and misused discord warnings to link settings page, reword some warnings.

This commit is contained in:
coolbot100s 2025-08-05 12:34:02 -07:00
parent ca48107e7e
commit 474e482474
2 changed files with 69 additions and 9 deletions

View File

@ -13,8 +13,18 @@
</span> </span>
</label> </label>
<TriangleAlertIcon <TriangleAlertIcon
v-if="!isIssuesUrlCommon" v-if="isIssuesLinkShortener"
v-tooltip="`You're using a link which isn't common for this link type.`" v-tooltip="`Use of link shorteners is prohibited.`"
class="size-6 animate-pulse text-orange"
/>
<TriangleAlertIcon
v-else-if="isIssuesDiscordUrl"
v-tooltip="`Discord invites are not appropriate for this link type.`"
class="size-6 animate-pulse text-orange"
/>
<TriangleAlertIcon
v-else-if="!isIssuesUrlCommon"
v-tooltip="`Link includes a domain which isn't common for this link type.`"
class="size-6 animate-pulse text-orange" class="size-6 animate-pulse text-orange"
/> />
<input <input
@ -37,8 +47,18 @@
</span> </span>
</label> </label>
<TriangleAlertIcon <TriangleAlertIcon
v-if="!isSourceUrlCommon" v-if="isSourceLinkShortener"
v-tooltip="`You're using a link which isn't common for this link type.`" v-tooltip="`Use of link shorteners is prohibited.`"
class="size-6 animate-pulse text-orange"
/>
<TriangleAlertIcon
v-else-if="isSourceDiscordUrl"
v-tooltip="`Discord invites are not appropriate for this link type.`"
class="size-6 animate-pulse text-orange"
/>
<TriangleAlertIcon
v-else-if="!isSourceUrlCommon"
v-tooltip="`Link includes a domain which isn't common for this link type.`"
class="size-6 animate-pulse text-orange" class="size-6 animate-pulse text-orange"
/> />
<input <input
@ -60,6 +80,16 @@
A page containing information, documentation, and help for the project. A page containing information, documentation, and help for the project.
</span> </span>
</label> </label>
<TriangleAlertIcon
v-if="isWikiLinkShortener"
v-tooltip="`Use of link shorteners is prohibited.`"
class="size-6 animate-pulse text-orange"
/>
<TriangleAlertIcon
v-else-if="isWikiDiscordUrl"
v-tooltip="`Discord invites are not appropriate for this link type.`"
class="size-6 animate-pulse text-orange"
/>
<input <input
id="project-wiki-page" id="project-wiki-page"
v-model="wikiUrl" v-model="wikiUrl"
@ -75,7 +105,12 @@
<span class="label__description"> An invitation link to your Discord server. </span> <span class="label__description"> An invitation link to your Discord server. </span>
</label> </label>
<TriangleAlertIcon <TriangleAlertIcon
v-if="!isDiscordUrlCommon" v-if="isDiscordLinkShortener"
v-tooltip="`Use of link shorteners is prohibited.`"
class="size-6 animate-pulse text-orange"
/>
<TriangleAlertIcon
v-else-if="!isDiscordUrlCommon"
v-tooltip="`You're using a link which isn't common for this link type.`" v-tooltip="`You're using a link which isn't common for this link type.`"
class="size-6 animate-pulse text-orange" class="size-6 animate-pulse text-orange"
/> />
@ -139,7 +174,7 @@
<script setup> <script setup>
import { DropdownSelect } from "@modrinth/ui"; import { DropdownSelect } from "@modrinth/ui";
import { SaveIcon, TriangleAlertIcon } from "@modrinth/assets"; import { SaveIcon, TriangleAlertIcon } from "@modrinth/assets";
import { isCommonUrl, commonLinkDomains } from "@modrinth/moderation"; import { isCommonUrl, isDiscordUrl, isLinkShortener, commonLinkDomains } from "@modrinth/moderation";
const tags = useTags(); const tags = useTags();
@ -184,6 +219,31 @@ const isDiscordUrlCommon = computed(() => {
return isCommonUrl(discordUrl.value, commonLinkDomains.discord); return isCommonUrl(discordUrl.value, commonLinkDomains.discord);
}); });
const isIssuesDiscordUrl = computed(() => {
return isDiscordUrl(issuesUrl.value)
})
const isSourceDiscordUrl = computed(() => {
return isDiscordUrl(sourceUrl.value)
})
const isWikiDiscordUrl = computed(() => {
return isDiscordUrl(wikiUrl.value)
})
const isIssuesLinkShortner = computed(() => {
return isLinkShortener(issuesUrl.value)
})
const isSourceLinkShortener = computed(() => {
return isLinkShortener(sourceUrl.value)
})
const isWikiLinkShortener = computed(() => {
return isLinkShortener(wikiUrl.value)
})
const isDiscordLinkShortener = computed(() => {
return isLinkShortener(discordUrl.value)
})
const rawDonationLinks = JSON.parse(JSON.stringify(props.project.donation_urls)); const rawDonationLinks = JSON.parse(JSON.stringify(props.project.donation_urls));
rawDonationLinks.push({ rawDonationLinks.push({
id: null, id: null,

View File

@ -207,8 +207,8 @@ const categoryLists = computed(() => {
const tooManyTagsWarning = computed(() => { const tooManyTagsWarning = computed(() => {
const tagCount = selectedTags.value.length; const tagCount = selectedTags.value.length;
if (tagCount > 5) { if (tagCount > 8) {
return `You've selected ${tagCount} tags. Consider reducing to 5 or fewer to keep your project focused and easier to discover.`; return `You've selected ${tagCount} tags. Consider reducing to 8 or fewer to keep your project focused and easier to discover.`;
} }
return null; return null;
}); });
@ -217,7 +217,7 @@ const multipleResolutionTagsWarning = computed(() => {
if (props.project.project_type !== "resourcepack") return null; if (props.project.project_type !== "resourcepack") return null;
const resolutionTags = selectedTags.value.filter((tag) => const resolutionTags = selectedTags.value.filter((tag) =>
["16x", "32x", "48x", "64x", "128x", "256x", "512x", "1024x"].includes(tag.name), ['8x-', '16x', '32x', '48x', '64x', '128x', '256x', '512x+'].includes(tag.name),
); );
if (resolutionTags.length > 1) { if (resolutionTags.length > 1) {