mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 03:55:59 +00:00
292 lines
9.2 KiB
TypeScript
292 lines
9.2 KiB
TypeScript
import { defineMessage, formatProjectTypeSentence, useVIntl } from '@modrinth/ui'
|
|
|
|
import type { Nag, NagContext } from '../../types/nags'
|
|
|
|
export const coreNags: Nag[] = [
|
|
{
|
|
id: 'moderator-feedback',
|
|
title: defineMessage({
|
|
id: 'nags.moderator-feedback.title',
|
|
defaultMessage: 'Review 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-project-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.projectV3?.versions?.length < 1 && !context.projectV3?.minecraft_server,
|
|
link: {
|
|
path: 'settings/versions',
|
|
title: defineMessage({
|
|
id: 'nags.settings.versions.title',
|
|
defaultMessage: 'Visit versions settings',
|
|
}),
|
|
shouldShow: (context: NagContext) =>
|
|
context.currentRoute !== 'type-project-settings-versions',
|
|
},
|
|
},
|
|
{
|
|
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-project-settings',
|
|
},
|
|
},
|
|
{
|
|
id: 'upload-gallery-image',
|
|
title: defineMessage({
|
|
id: 'nags.upload-gallery-image.title',
|
|
defaultMessage: 'Upload a gallery image',
|
|
}),
|
|
description: (context: NagContext) => {
|
|
const { formatMessage } = useVIntl()
|
|
|
|
if (context.projectV3?.project_types.includes('resourcepack')) {
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.upload-gallery-image.description-resourcepack',
|
|
defaultMessage:
|
|
'At least one gallery image is required to showcase the content of your resource pack, except for audio or localization packs. If this describes your pack, please select the appropriate tag.',
|
|
}),
|
|
)
|
|
} else if (context.projectV3?.project_types.includes('shader')) {
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.upload-gallery-image.description-shader',
|
|
defaultMessage:
|
|
'At least three gallery images are required to showcase the content of your shader in a variety of situations and conditions.',
|
|
}),
|
|
)
|
|
}
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.upload-gallery-image.description',
|
|
defaultMessage:
|
|
'At least one gallery image is required to showcase the content of your {type}.',
|
|
}),
|
|
{
|
|
type: formatProjectTypeSentence(formatMessage, context.project.project_type),
|
|
},
|
|
)
|
|
},
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) => {
|
|
return (
|
|
(context.projectV3?.project_types.includes('shader') &&
|
|
context.project.gallery &&
|
|
context.project.gallery?.length < 3) ||
|
|
(context.projectV3?.project_types.includes('resourcepack') &&
|
|
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')
|
|
)) ||
|
|
false
|
|
)
|
|
},
|
|
link: {
|
|
path: 'settings/gallery',
|
|
title: defineMessage({
|
|
id: 'nags.gallery.title',
|
|
defaultMessage: 'Visit gallery page',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-project-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) => {
|
|
if (context.projectV3?.minecraft_server) return false
|
|
const featuredGalleryImage = context.project.gallery?.find((img) => img.featured)
|
|
return context.project?.gallery?.length === 0 || !featuredGalleryImage
|
|
},
|
|
link: {
|
|
path: 'settings/gallery',
|
|
title: defineMessage({
|
|
id: 'nags.gallery.title',
|
|
defaultMessage: 'Visit gallery page',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-project-gallery',
|
|
},
|
|
},
|
|
{
|
|
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 {type} is distributed under.',
|
|
}),
|
|
{
|
|
type: formatProjectTypeSentence(formatMessage, context.project.project_type),
|
|
},
|
|
)
|
|
},
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) =>
|
|
(context.project.license.id === 'LicenseRef-Unknown' ||
|
|
context.project.license.id === 'NOASSERTION' ||
|
|
context.project.license.id === 'LicenseRef-NOASSERTION') &&
|
|
!context.projectV3?.minecraft_server,
|
|
link: {
|
|
path: 'settings/license',
|
|
title: defineMessage({
|
|
id: 'nags.settings.license.title',
|
|
defaultMessage: 'Visit license settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-project-settings-license',
|
|
},
|
|
},
|
|
{
|
|
id: 'add-custom-license-details',
|
|
title: defineMessage({
|
|
id: 'nags.add-license-details.title',
|
|
defaultMessage: 'Add license details',
|
|
}),
|
|
description: (context: NagContext) => {
|
|
const { formatMessage } = useVIntl()
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.add-license-details.description',
|
|
defaultMessage: 'Add a valid URL and name or SPDX identifier for your custom license.',
|
|
}),
|
|
{
|
|
type: formatProjectTypeSentence(formatMessage, context.project.project_type),
|
|
},
|
|
)
|
|
},
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) =>
|
|
!context.projectV3?.minecraft_server &&
|
|
(context.project.license.id === 'LicenseRef-' ||
|
|
(context.project.license.id.search('LicenseRef-') === 0 &&
|
|
(!context.project.license.url || context.project.license.url === '') &&
|
|
context.project.license.id !== 'LicenseRef-Unknown' &&
|
|
context.project.license.id !== 'LicenseRef-All-Rights-Reserved')),
|
|
link: {
|
|
path: 'settings/license',
|
|
title: defineMessage({
|
|
id: 'nags.settings.license.title',
|
|
defaultMessage: 'Visit license settings',
|
|
}),
|
|
shouldShow: (context: NagContext) => context.currentRoute !== 'type-project-settings-license',
|
|
},
|
|
},
|
|
{
|
|
id: 'review-permissions',
|
|
title: defineMessage({
|
|
id: 'nags.review-permissions.title',
|
|
defaultMessage: 'Review external permissions',
|
|
}),
|
|
description: (_context: NagContext) => {
|
|
const { formatMessage } = useVIntl()
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.review-permissions.description',
|
|
defaultMessage:
|
|
'Make sure you have provided proof of your permission to distribute any external content in your Modpack.',
|
|
}),
|
|
)
|
|
},
|
|
status: 'required',
|
|
shouldShow: (context: NagContext) =>
|
|
context.versions.some((version) => (version.files_missing_attribution?.length ?? 0) >= 1),
|
|
link: {
|
|
path: 'settings/permissions',
|
|
title: defineMessage({
|
|
id: 'nags.settings.permissions.title',
|
|
defaultMessage: 'Visit permissions dashboard',
|
|
}),
|
|
shouldShow: (context: NagContext) =>
|
|
context.currentRoute !== 'type-project-settings-permissions',
|
|
},
|
|
},
|
|
{
|
|
id: 'check-disclosures',
|
|
title: defineMessage({
|
|
id: 'nags.check-disclosures.title',
|
|
defaultMessage: 'Check content disclosures',
|
|
}),
|
|
description: (context: NagContext) => {
|
|
const { formatMessage } = useVIntl()
|
|
return formatMessage(
|
|
defineMessage({
|
|
id: 'nags.check-disclosures.description',
|
|
defaultMessage:
|
|
'Make sure users are aware of any important details by filling in content disclosures that apply to your {type}.',
|
|
}),
|
|
{ type: formatProjectTypeSentence(formatMessage, context.project.project_type) },
|
|
)
|
|
},
|
|
status: 'suggestion',
|
|
shouldShow: () => true,
|
|
link: {
|
|
path: 'settings/disclosures',
|
|
title: defineMessage({
|
|
id: 'nags.settings.disclosures.title',
|
|
defaultMessage: 'Visit disclosure settings',
|
|
}),
|
|
shouldShow: (context: NagContext) =>
|
|
context.currentRoute !== 'type-project-settings-disclosures',
|
|
},
|
|
},
|
|
]
|