You've already forked AstralRinth
forked from didirus/AstralRinth
* feat: set up typed nag (validators) system * feat: start on frontend impl * fix: shouldShow issues * feat: continue work * feat: re add submitting/re-submit nags * feat: start work implementing validation checks using new nag system * fix: links page + add more validations * feat: tags validations * fix: lint issues * fix: lint * fix: issues * feat: start on i18nifying nags * feat: impl intl * fix: minecraft title clause update * fix: locale issues * refactor: inline i18n * fix: summary char min * fix: issues * Rephrase a few core nags * Modify character limit numbers * Remove redundant sentanceEnders check to reduce false positive. * Description nag rephrasing and tweaks * Tweak links nags adding project type checking for source publication check, make description nag tonally consistent. * fix: description nag * bump source publication nag to warn until additional files can be checked. * refactor link checking helper functions, prevent misuse of dsc links, prevent link shortener usage, check if source required licensed projects have additional files, bump this check back to required. * Correct plugin project type checking * fix: lint issues * update links.ts * feat: key + sort nags by type * Tweak core and description nag titles, change image accessability nag logic. * feat: update readme * updates to tags checking and rest of the nag titles * fix locale * fix: formatjs * fix tags warning, and link shorteners and misused discord warnings to link settings page, reword some warnings. * correct vocabulary for resolutions tags warning and sort tags list in resolution tags nag * lint fix * fix method typo * Add nag for summary formatting. * Check for link shorteners in donation links * add Gallery requirement nag for shaders and most resource packs * update index.json --------- Signed-off-by: IMB11 <hendersoncal117@gmail.com> Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com> Co-authored-by: coolbot100s <76798835+coolbot100s@users.noreply.github.com>
293 lines
9.6 KiB
TypeScript
293 lines
9.6 KiB
TypeScript
import type { Nag, NagContext } from '../../types/nags'
|
|
import { formatProjectType } from '@modrinth/utils'
|
|
import { useVIntl, defineMessage } from '@vintl/vintl'
|
|
|
|
export const coreNags: Nag[] = [
|
|
{
|
|
id: 'moderator-feedback',
|
|
title: defineMessage({
|
|
id: 'nags.moderator-feedback.title',
|
|
defaultMessage: 'Review moderator feedback',
|
|
}),
|
|
description: defineMessage({
|
|
id: 'nags.moderator-feedback.description',
|
|
defaultMessage:
|
|
'Review and address all concerns from the moderation team before resubmitting.',
|
|
}),
|
|
status: 'warning',
|
|
shouldShow: (context: NagContext) =>
|
|
context.tags.rejectedStatuses.includes(context.project.status),
|
|
link: {
|
|
path: 'moderation',
|
|
title: defineMessage({
|
|
id: 'nags.moderation.title',
|
|
defaultMessage: 'Visit moderation thread',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-moderation',
|
|
},
|
|
},
|
|
{
|
|
id: 'upload-version',
|
|
title: defineMessage({
|
|
id: 'nags.upload-version.title',
|
|
defaultMessage: 'Upload a version',
|
|
}),
|
|
description: defineMessage({
|
|
id: 'nags.upload-version.description',
|
|
defaultMessage: 'At least one version is required for a project to be submitted for review.',
|
|
}),
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) => context.versions.length < 1,
|
|
link: {
|
|
path: 'versions',
|
|
title: defineMessage({
|
|
id: 'nags.versions.title',
|
|
defaultMessage: 'Visit versions page',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-versions',
|
|
},
|
|
},
|
|
{
|
|
id: 'add-description',
|
|
title: defineMessage({
|
|
id: 'nags.add-description.title',
|
|
defaultMessage: 'Add a description',
|
|
}),
|
|
description: defineMessage({
|
|
id: 'nags.add-description.description',
|
|
defaultMessage:
|
|
"A description that clearly describes the project's purpose and function is required.",
|
|
}),
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) => context.project.body === '',
|
|
link: {
|
|
path: 'settings/description',
|
|
title: defineMessage({
|
|
id: 'nags.settings.description.title',
|
|
defaultMessage: 'Visit description settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-settings-description',
|
|
},
|
|
},
|
|
{
|
|
id: 'add-icon',
|
|
title: defineMessage({
|
|
id: 'nags.add-icon.title',
|
|
defaultMessage: 'Add an icon',
|
|
}),
|
|
description: defineMessage({
|
|
id: 'nags.add-icon.description',
|
|
defaultMessage:
|
|
'Adding a unique, relevant, and engaging icon makes your project identifiable and helps it stand out.',
|
|
}),
|
|
status: 'suggestion',
|
|
shouldShow: (context: NagContext) => !context.project.icon_url,
|
|
link: {
|
|
path: 'settings',
|
|
title: defineMessage({
|
|
id: 'nags.settings.title',
|
|
defaultMessage: 'Visit general settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-settings',
|
|
},
|
|
},
|
|
{
|
|
id: 'upload-gallery-image',
|
|
title: defineMessage({
|
|
id: 'nags.upload-gallery-image.title',
|
|
defaultMessage: 'Upload a gallery image',
|
|
}),
|
|
description: (context: NagContext) => {
|
|
const { formatMessage } = useVIntl()
|
|
const projectType = formatProjectType(context.project.project_type).toLowerCase()
|
|
let msg = ''
|
|
if (context.project.project_type === 'resourcepack') {
|
|
msg =
|
|
', except for audio or localization packs. If this describes your pack, please select the appropriate tag'
|
|
}
|
|
const resourcepackMessage = msg
|
|
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.upload-gallery-image.description',
|
|
defaultMessage:
|
|
'At least one gallery image is required to showcase the content of your {type}{resourcepackMessage}.',
|
|
}),
|
|
{
|
|
type: projectType,
|
|
resourcepackMessage: resourcepackMessage,
|
|
},
|
|
)
|
|
},
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) => {
|
|
return (
|
|
(context.project.project_type === 'resourcepack' ||
|
|
context.project.project_type === 'shader') &&
|
|
(!context.project.gallery || context.project.gallery?.length === 0) &&
|
|
!(
|
|
context.project.categories.includes('audio') ||
|
|
context.project.additional_categories.includes('audio') ||
|
|
context.project.categories.includes('locale') ||
|
|
context.project.additional_categories.includes('locale')
|
|
)
|
|
)
|
|
},
|
|
link: {
|
|
path: 'gallery',
|
|
title: defineMessage({
|
|
id: 'nags.gallery.title',
|
|
defaultMessage: 'Visit gallery page',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-gallery',
|
|
},
|
|
},
|
|
{
|
|
id: 'feature-gallery-image',
|
|
title: defineMessage({
|
|
id: 'nags.feature-gallery-image.title',
|
|
defaultMessage: 'Feature a gallery image',
|
|
}),
|
|
description: defineMessage({
|
|
id: 'nags.feature-gallery-image.description',
|
|
defaultMessage:
|
|
'The featured gallery image is often how your project makes its first impression.',
|
|
}),
|
|
status: 'suggestion',
|
|
shouldShow: (context: NagContext) => {
|
|
const featuredGalleryImage = context.project.gallery?.find((img) => img.featured)
|
|
return context.project?.gallery?.length === 0 || !featuredGalleryImage
|
|
},
|
|
link: {
|
|
path: 'gallery',
|
|
title: defineMessage({
|
|
id: 'nags.gallery.title',
|
|
defaultMessage: 'Visit gallery page',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-gallery',
|
|
},
|
|
},
|
|
{
|
|
id: 'select-tags',
|
|
title: defineMessage({
|
|
id: 'nags.select-tags.title',
|
|
defaultMessage: 'Select tags',
|
|
}),
|
|
description: defineMessage({
|
|
id: 'nags.select-tags.description',
|
|
defaultMessage:
|
|
'Select the tags that correctly apply to your project to help the right users find it.',
|
|
}),
|
|
status: 'suggestion',
|
|
shouldShow: (context: NagContext) =>
|
|
context.project.versions.length > 0 && context.project.categories.length < 1,
|
|
link: {
|
|
path: 'settings/tags',
|
|
title: defineMessage({
|
|
id: 'nags.settings.tags.title',
|
|
defaultMessage: 'Visit tag settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-settings-tags',
|
|
},
|
|
},
|
|
{
|
|
id: 'add-links',
|
|
title: defineMessage({
|
|
id: 'nags.add-links.title',
|
|
defaultMessage: 'Add external links',
|
|
}),
|
|
description: defineMessage({
|
|
id: 'nags.add-links.description',
|
|
defaultMessage:
|
|
'Add any relevant links targeted outside of Modrinth, such as source code, an issue tracker, or a Discord invite.',
|
|
}),
|
|
status: 'suggestion',
|
|
shouldShow: (context: NagContext) =>
|
|
!(
|
|
context.project.issues_url ||
|
|
context.project.source_url ||
|
|
context.project.wiki_url ||
|
|
context.project.discord_url ||
|
|
context.project.donation_urls.length > 0
|
|
),
|
|
link: {
|
|
path: 'settings/links',
|
|
title: defineMessage({
|
|
id: 'nags.settings.links.title',
|
|
defaultMessage: 'Visit links settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-settings-links',
|
|
},
|
|
},
|
|
{
|
|
id: 'select-environments',
|
|
title: defineMessage({
|
|
id: 'nags.select-environments.title',
|
|
defaultMessage: 'Select supported environments',
|
|
}),
|
|
description: (context: NagContext) => {
|
|
const { formatMessage } = useVIntl()
|
|
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.select-environments.description',
|
|
defaultMessage: `Select if the {projectType} functions on the client-side and/or server-side.`,
|
|
}),
|
|
{
|
|
projectType: formatProjectType(context.project.project_type).toLowerCase(),
|
|
},
|
|
)
|
|
},
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) => {
|
|
const excludedTypes = ['resourcepack', 'plugin', 'shader', 'datapack']
|
|
return (
|
|
context.project.versions.length > 0 &&
|
|
!excludedTypes.includes(context.project.project_type) &&
|
|
(context.project.client_side === 'unknown' ||
|
|
context.project.server_side === 'unknown' ||
|
|
(context.project.client_side === 'unsupported' &&
|
|
context.project.server_side === 'unsupported'))
|
|
)
|
|
},
|
|
link: {
|
|
path: 'settings',
|
|
title: defineMessage({
|
|
id: 'nags.settings.environments.title',
|
|
defaultMessage: 'Visit general settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-settings',
|
|
},
|
|
},
|
|
{
|
|
id: 'select-license',
|
|
title: defineMessage({
|
|
id: 'nags.select-license.title',
|
|
defaultMessage: 'Select a license',
|
|
}),
|
|
description: (context: NagContext) => {
|
|
const { formatMessage } = useVIntl()
|
|
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.select-license.description',
|
|
defaultMessage: 'Select the license your {projectType} is distributed under.',
|
|
}),
|
|
{
|
|
projectType: formatProjectType(context.project.project_type).toLowerCase(),
|
|
},
|
|
)
|
|
},
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) => context.project.license.id === 'LicenseRef-Unknown',
|
|
link: {
|
|
path: 'settings/license',
|
|
title: defineMessage({
|
|
id: 'nags.settings.license.title',
|
|
defaultMessage: 'Visit license settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-id-settings-license',
|
|
},
|
|
},
|
|
]
|