updates to tags checking and rest of the nag titles
This commit is contained in:
parent
9db2fd33c6
commit
9c6c368408
@ -68,7 +68,7 @@ export const linksNags: Nag[] = [
|
|||||||
description: defineMessage({
|
description: defineMessage({
|
||||||
id: 'nags.verify-external-links.description',
|
id: 'nags.verify-external-links.description',
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Some of your external links may be using domains that aren't recognized as common for their link type.",
|
'Some of your external links may be using domains that are inappropriate for that type of link.',
|
||||||
}),
|
}),
|
||||||
status: 'warning',
|
status: 'warning',
|
||||||
shouldShow: (context: NagContext) => {
|
shouldShow: (context: NagContext) => {
|
||||||
@ -91,12 +91,12 @@ export const linksNags: Nag[] = [
|
|||||||
id: 'misused-discord-link',
|
id: 'misused-discord-link',
|
||||||
title: defineMessage({
|
title: defineMessage({
|
||||||
id: 'nags.misused-discord-link.title',
|
id: 'nags.misused-discord-link.title',
|
||||||
defaultMessage: 'Misplaced Discord invite',
|
defaultMessage: 'Move Discord invite',
|
||||||
}),
|
}),
|
||||||
description: defineMessage({
|
description: defineMessage({
|
||||||
id: 'nags.misused-discord-link-description',
|
id: 'nags.misused-discord-link-description',
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
'Discord invites can not be used for other link types. Please put your Discord link in the Discord Invite link field.',
|
'Discord invites can not be used for other link types. Please put your Discord link in the Discord Invite link field only.',
|
||||||
}),
|
}),
|
||||||
status: 'required',
|
status: 'required',
|
||||||
shouldShow: (context: NagContext) =>
|
shouldShow: (context: NagContext) =>
|
||||||
@ -116,7 +116,7 @@ export const linksNags: Nag[] = [
|
|||||||
id: 'link-shortener-usage',
|
id: 'link-shortener-usage',
|
||||||
title: defineMessage({
|
title: defineMessage({
|
||||||
id: 'nags.link-shortener-usage.title',
|
id: 'nags.link-shortener-usage.title',
|
||||||
defaultMessage: 'Use of link shorteners is prohibited',
|
defaultMessage: "Don't use link shorteners",
|
||||||
}),
|
}),
|
||||||
description: defineMessage({
|
description: defineMessage({
|
||||||
id: 'nags.link-shortener-usage.description',
|
id: 'nags.link-shortener-usage.description',
|
||||||
@ -134,7 +134,7 @@ export const linksNags: Nag[] = [
|
|||||||
id: 'invalid-license-url',
|
id: 'invalid-license-url',
|
||||||
title: defineMessage({
|
title: defineMessage({
|
||||||
id: 'nags.invalid-license-url.title',
|
id: 'nags.invalid-license-url.title',
|
||||||
defaultMessage: 'Invalid license URL',
|
defaultMessage: 'Add a valid license link',
|
||||||
}),
|
}),
|
||||||
description: (context: NagContext) => {
|
description: (context: NagContext) => {
|
||||||
const { formatMessage } = useVIntl()
|
const { formatMessage } = useVIntl()
|
||||||
@ -169,7 +169,7 @@ export const linksNags: Nag[] = [
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
status: 'warning',
|
status: 'required',
|
||||||
shouldShow: (context: NagContext) => {
|
shouldShow: (context: NagContext) => {
|
||||||
const licenseUrl = context.project.license.url
|
const licenseUrl = context.project.license.url
|
||||||
if (!licenseUrl) return false
|
if (!licenseUrl) return false
|
||||||
@ -196,7 +196,7 @@ export const linksNags: Nag[] = [
|
|||||||
id: 'gpl-license-source-required',
|
id: 'gpl-license-source-required',
|
||||||
title: defineMessage({
|
title: defineMessage({
|
||||||
id: 'nags.gpl-license-source-required.title',
|
id: 'nags.gpl-license-source-required.title',
|
||||||
defaultMessage: 'License requires source',
|
defaultMessage: 'Provide source code',
|
||||||
}),
|
}),
|
||||||
description: (context: NagContext) => {
|
description: (context: NagContext) => {
|
||||||
const { formatMessage } = useVIntl()
|
const { formatMessage } = useVIntl()
|
||||||
@ -205,7 +205,7 @@ export const linksNags: Nag[] = [
|
|||||||
defineMessage({
|
defineMessage({
|
||||||
id: 'nags.gpl-license-source-required.description',
|
id: 'nags.gpl-license-source-required.description',
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
'Your {projectType} uses a license which requires source code to be available. Please provide a source code link or sources file, or consider using a different license.',
|
'Your {projectType} uses a license which requires source code to be available. Please provide a source code link or sources file for each additional version, or consider using a different license.',
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
projectType: formatProjectType(context.project.project_type).toLowerCase(),
|
projectType: formatProjectType(context.project.project_type).toLowerCase(),
|
||||||
|
|||||||
@ -2,6 +2,10 @@ import type { Project } from '@modrinth/utils'
|
|||||||
import type { Nag, NagContext } from '../../types/nags'
|
import type { Nag, NagContext } from '../../types/nags'
|
||||||
import { useVIntl, defineMessage } from '@vintl/vintl'
|
import { useVIntl, defineMessage } from '@vintl/vintl'
|
||||||
|
|
||||||
|
const allResolutionTags = ['8x-', '16x', '32x', '48x', '64x', '128x', '256x', '512x+']
|
||||||
|
|
||||||
|
const MAX_TAG_COUNT = 8
|
||||||
|
|
||||||
function getCategories(
|
function getCategories(
|
||||||
project: Project & { actualProjectType: string },
|
project: Project & { actualProjectType: string },
|
||||||
tags: {
|
tags: {
|
||||||
@ -22,21 +26,23 @@ export const tagsNags: Nag[] = [
|
|||||||
id: 'too-many-tags',
|
id: 'too-many-tags',
|
||||||
title: defineMessage({
|
title: defineMessage({
|
||||||
id: 'nags.too-many-tags.title',
|
id: 'nags.too-many-tags.title',
|
||||||
defaultMessage: 'Too many tags selected',
|
defaultMessage: 'Select accurate tags',
|
||||||
}),
|
}),
|
||||||
description: (context: NagContext) => {
|
description: (context: NagContext) => {
|
||||||
const { formatMessage } = useVIntl()
|
const { formatMessage } = useVIntl()
|
||||||
const tagCount =
|
const tagCount =
|
||||||
context.project.categories.length + (context.project.additional_categories?.length || 0)
|
context.project.categories.length + (context.project.additional_categories?.length || 0)
|
||||||
|
const maxTagCount = MAX_TAG_COUNT
|
||||||
|
|
||||||
return formatMessage(
|
return formatMessage(
|
||||||
defineMessage({
|
defineMessage({
|
||||||
id: 'nags.too-many-tags.description',
|
id: 'nags.too-many-tags.description',
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"You've selected {tagCount} tags. Consider reducing to 5 or fewer to keep your project focused and easier to discover.",
|
"You've selected {tagCount} tags. Consider reducing to {maxTagCount} or fewer to make sure your project appears in relevant search results.",
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
tagCount,
|
tagCount,
|
||||||
|
maxTagCount,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -44,7 +50,7 @@ export const tagsNags: Nag[] = [
|
|||||||
shouldShow: (context: NagContext) => {
|
shouldShow: (context: NagContext) => {
|
||||||
const tagCount =
|
const tagCount =
|
||||||
context.project.categories.length + (context.project.additional_categories?.length || 0)
|
context.project.categories.length + (context.project.additional_categories?.length || 0)
|
||||||
return tagCount > 5
|
return tagCount > MAX_TAG_COUNT
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
path: 'settings/tags',
|
path: 'settings/tags',
|
||||||
@ -59,13 +65,13 @@ export const tagsNags: Nag[] = [
|
|||||||
id: 'multiple-resolution-tags',
|
id: 'multiple-resolution-tags',
|
||||||
title: defineMessage({
|
title: defineMessage({
|
||||||
id: 'nags.multiple-resolution-tags.title',
|
id: 'nags.multiple-resolution-tags.title',
|
||||||
defaultMessage: 'Multiple resolution tags selected',
|
defaultMessage: 'Select correct resolution',
|
||||||
}),
|
}),
|
||||||
description: (context: NagContext) => {
|
description: (context: NagContext) => {
|
||||||
const { formatMessage } = useVIntl()
|
const { formatMessage } = useVIntl()
|
||||||
const resolutionTags = context.project.categories.filter((tag: string) =>
|
const resolutionTags = context.project.categories
|
||||||
['16x', '32x', '48x', '64x', '128x', '256x', '512x', '1024x'].includes(tag),
|
.concat(context.project.additional_categories)
|
||||||
)
|
.filter((tag: string) => allResolutionTags.includes(tag))
|
||||||
|
|
||||||
return formatMessage(
|
return formatMessage(
|
||||||
defineMessage({
|
defineMessage({
|
||||||
@ -75,7 +81,10 @@ export const tagsNags: Nag[] = [
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
count: resolutionTags.length,
|
count: resolutionTags.length,
|
||||||
tags: resolutionTags.join(', '),
|
tags: resolutionTags
|
||||||
|
.join(', ')
|
||||||
|
.replace('8x-', '8x or lower')
|
||||||
|
.replace('512x+', '512x or higher'),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -83,9 +92,9 @@ export const tagsNags: Nag[] = [
|
|||||||
shouldShow: (context: NagContext) => {
|
shouldShow: (context: NagContext) => {
|
||||||
if (context.project.project_type !== 'resourcepack') return false
|
if (context.project.project_type !== 'resourcepack') return false
|
||||||
|
|
||||||
const resolutionTags = context.project.categories.filter((tag: string) =>
|
const resolutionTags = context.project.categories
|
||||||
['16x', '32x', '48x', '64x', '128x', '256x', '512x', '1024x'].includes(tag),
|
.concat(context.project.additional_categories)
|
||||||
)
|
.filter((tag: string) => allResolutionTags.includes(tag))
|
||||||
return resolutionTags.length > 1
|
return resolutionTags.length > 1
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
@ -101,7 +110,7 @@ export const tagsNags: Nag[] = [
|
|||||||
id: 'all-tags-selected',
|
id: 'all-tags-selected',
|
||||||
title: defineMessage({
|
title: defineMessage({
|
||||||
id: 'nags.all-tags-selected.title',
|
id: 'nags.all-tags-selected.title',
|
||||||
defaultMessage: 'All tags selected',
|
defaultMessage: 'Select accurate tags',
|
||||||
}),
|
}),
|
||||||
description: (context: NagContext) => {
|
description: (context: NagContext) => {
|
||||||
const { formatMessage } = useVIntl()
|
const { formatMessage } = useVIntl()
|
||||||
@ -115,7 +124,7 @@ export const tagsNags: Nag[] = [
|
|||||||
defineMessage({
|
defineMessage({
|
||||||
id: 'nags.all-tags-selected.description',
|
id: 'nags.all-tags-selected.description',
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"You've selected all {totalAvailableTags} available tags. This defeats the purpose of tags, which are meant to help users find relevant projects. Please select only the tags that truly apply to your project.",
|
"You've selected all {totalAvailableTags} available tags. This defeats the purpose of tags, which are meant to help users find relevant projects. Please select only the tags that are relevant to your project.",
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
totalAvailableTags,
|
totalAvailableTags,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user