Remove legacy formatCategory (#5280)
* Remove legacy formatCategory * prepr
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
:custom-label="
|
:custom-label="
|
||||||
(version) =>
|
(version) =>
|
||||||
`${version?.name} (${version?.loaders
|
`${version?.name} (${version?.loaders
|
||||||
.map((name) => formatCategory(name))
|
.map((name) => formatLoader(formatMessage, name))
|
||||||
.join(', ')} - ${version?.game_versions.join(', ')})`
|
.join(', ')} - ${version?.game_versions.join(', ')})`
|
||||||
"
|
"
|
||||||
:max-height="150"
|
:max-height="150"
|
||||||
@@ -36,7 +36,9 @@
|
|||||||
<span v-else>
|
<span v-else>
|
||||||
<span>
|
<span>
|
||||||
{{ selectedVersion?.name }} ({{
|
{{ selectedVersion?.name }} ({{
|
||||||
selectedVersion?.loaders.map((name) => formatCategory(name)).join(', ')
|
selectedVersion?.loaders
|
||||||
|
.map((name) => formatLoader(formatMessage, name))
|
||||||
|
.join(', ')
|
||||||
}}
|
}}
|
||||||
- {{ selectedVersion?.game_versions.join(', ') }})
|
- {{ selectedVersion?.game_versions.join(', ') }})
|
||||||
</span>
|
</span>
|
||||||
@@ -57,8 +59,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { DownloadIcon, XIcon } from '@modrinth/assets'
|
import { DownloadIcon, XIcon } from '@modrinth/assets'
|
||||||
import { Button, injectNotificationManager } from '@modrinth/ui'
|
import { Button, formatLoader, injectNotificationManager, useVIntl } from '@modrinth/ui'
|
||||||
import { formatCategory } from '@modrinth/utils'
|
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import Multiselect from 'vue-multiselect'
|
import Multiselect from 'vue-multiselect'
|
||||||
|
|
||||||
@@ -67,6 +68,7 @@ import { trackEvent } from '@/helpers/analytics'
|
|||||||
import { add_project_from_version as installMod } from '@/helpers/profile'
|
import { add_project_from_version as installMod } from '@/helpers/profile'
|
||||||
|
|
||||||
const { handleError } = injectNotificationManager()
|
const { handleError } = injectNotificationManager()
|
||||||
|
const { formatMessage } = useVIntl()
|
||||||
|
|
||||||
const instance = ref(null)
|
const instance = ref(null)
|
||||||
const project = ref(null)
|
const project = ref(null)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
Platform
|
Platform
|
||||||
</slot>
|
</slot>
|
||||||
<template #option="{ option }">
|
<template #option="{ option }">
|
||||||
{{ formatCategory(option) }}
|
{{ formatLoader(formatMessage, String(option)) }}
|
||||||
</template>
|
</template>
|
||||||
<template v-if="hasAnyUnsupportedPlatforms" #footer>
|
<template v-if="hasAnyUnsupportedPlatforms" #footer>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@@ -58,12 +58,15 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { FilterIcon } from '@modrinth/assets'
|
import { FilterIcon } from '@modrinth/assets'
|
||||||
|
import { formatLoader, useVIntl } from '@modrinth/ui'
|
||||||
import Checkbox from '@modrinth/ui/src/components/base/Checkbox.vue'
|
import Checkbox from '@modrinth/ui/src/components/base/Checkbox.vue'
|
||||||
import ManySelect from '@modrinth/ui/src/components/base/ManySelect.vue'
|
import ManySelect from '@modrinth/ui/src/components/base/ManySelect.vue'
|
||||||
import { formatCategory, type GameVersionTag, type Version } from '@modrinth/utils'
|
import type { GameVersionTag, Version } from '@modrinth/utils'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
|
const { formatMessage } = useVIntl()
|
||||||
|
|
||||||
export type ListedGameVersion = {
|
export type ListedGameVersion = {
|
||||||
name: string
|
name: string
|
||||||
release: boolean
|
release: boolean
|
||||||
@@ -119,7 +122,7 @@ const hasOnlyUnsupportedPlatforms = computed(() => {
|
|||||||
|
|
||||||
const showSupportedPlatformsOnly = ref(true)
|
const showSupportedPlatformsOnly = ref(true)
|
||||||
|
|
||||||
const filterOptions = computed(() => {
|
const filterOptions = computed<Record<'gameVersion' | 'platform', string[]>>(() => {
|
||||||
const filters: Record<'gameVersion' | 'platform', string[]> = {
|
const filters: Record<'gameVersion' | 'platform', string[]> = {
|
||||||
gameVersion: [],
|
gameVersion: [],
|
||||||
platform: [],
|
platform: [],
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
<template v-else> Unknown product </template>
|
<template v-else> Unknown product </template>
|
||||||
</span>
|
</span>
|
||||||
<div class="mb-4 mt-2 flex w-full items-center gap-1 text-sm text-secondary">
|
<div class="mb-4 mt-2 flex w-full items-center gap-1 text-sm text-secondary">
|
||||||
{{ formatCategory(subscription.interval) }} ⋅ {{ subscription.status }} ⋅
|
{{ capitalizeString(subscription.interval) }} ⋅ {{ subscription.status }} ⋅
|
||||||
{{ dayjs(subscription.created).format('MMMM D, YYYY [at] h:mma') }} ({{
|
{{ dayjs(subscription.created).format('MMMM D, YYYY [at] h:mma') }} ({{
|
||||||
formatRelativeTime(subscription.created)
|
formatRelativeTime(subscription.created)
|
||||||
}})
|
}})
|
||||||
@@ -334,7 +334,7 @@ import {
|
|||||||
useRelativeTime,
|
useRelativeTime,
|
||||||
useVIntl,
|
useVIntl,
|
||||||
} from '@modrinth/ui'
|
} from '@modrinth/ui'
|
||||||
import { formatCategory, formatPrice } from '@modrinth/utils'
|
import { capitalizeString, formatPrice } from '@modrinth/utils'
|
||||||
import { DEFAULT_CREDIT_EMAIL_MESSAGE } from '@modrinth/utils/utils.ts'
|
import { DEFAULT_CREDIT_EMAIL_MESSAGE } from '@modrinth/utils/utils.ts'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
|
|||||||
@@ -677,6 +677,9 @@
|
|||||||
"project-type.plugin.lowercase": {
|
"project-type.plugin.lowercase": {
|
||||||
"defaultMessage": "{count, plural, one {plugin} other {plugins}}"
|
"defaultMessage": "{count, plural, one {plugin} other {plugins}}"
|
||||||
},
|
},
|
||||||
|
"project-type.project.capital": {
|
||||||
|
"defaultMessage": "{count, plural, one {Project} other {Projects}}"
|
||||||
|
},
|
||||||
"project-type.project.category": {
|
"project-type.project.category": {
|
||||||
"defaultMessage": "Projects"
|
"defaultMessage": "Projects"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ export const commonProjectTypeTitleMessages = defineMessages({
|
|||||||
defaultMessage: '{count, plural, one {Server} other {Servers}}',
|
defaultMessage: '{count, plural, one {Server} other {Servers}}',
|
||||||
},
|
},
|
||||||
project: {
|
project: {
|
||||||
id: 'project-type.project.lowercase',
|
id: 'project-type.project.capital',
|
||||||
defaultMessage: '{count, plural, one {Project} other {Projects}}',
|
defaultMessage: '{count, plural, one {Project} other {Projects}}',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -162,62 +162,6 @@ export const formatProjectType = (name, short = false) => {
|
|||||||
return capitalizeString(name)
|
return capitalizeString(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use tag-messages.ts' `formatTag(tag)` instead.
|
|
||||||
*/
|
|
||||||
export const formatCategory = (name) => {
|
|
||||||
if (name === 'modloader') {
|
|
||||||
return "Risugami's ModLoader"
|
|
||||||
} else if (name === 'bungeecord') {
|
|
||||||
return 'BungeeCord'
|
|
||||||
} else if (name === 'liteloader') {
|
|
||||||
return 'LiteLoader'
|
|
||||||
} else if (name === 'neoforge') {
|
|
||||||
return 'NeoForge'
|
|
||||||
} else if (name === 'game-mechanics') {
|
|
||||||
return 'Game Mechanics'
|
|
||||||
} else if (name === 'worldgen') {
|
|
||||||
return 'World Generation'
|
|
||||||
} else if (name === 'core-shaders') {
|
|
||||||
return 'Core Shaders'
|
|
||||||
} else if (name === 'gui') {
|
|
||||||
return 'GUI'
|
|
||||||
} else if (name === '8x-') {
|
|
||||||
return '8x or lower'
|
|
||||||
} else if (name === '512x+') {
|
|
||||||
return '512x or higher'
|
|
||||||
} else if (name === 'kitchen-sink') {
|
|
||||||
return 'Kitchen Sink'
|
|
||||||
} else if (name === 'path-tracing') {
|
|
||||||
return 'Path Tracing'
|
|
||||||
} else if (name === 'pbr') {
|
|
||||||
return 'PBR'
|
|
||||||
} else if (name === 'datapack') {
|
|
||||||
return 'Data Pack'
|
|
||||||
} else if (name === 'colored-lighting') {
|
|
||||||
return 'Colored Lighting'
|
|
||||||
} else if (name === 'optifine') {
|
|
||||||
return 'OptiFine'
|
|
||||||
} else if (name === 'bta-babric') {
|
|
||||||
return 'BTA (Babric)'
|
|
||||||
} else if (name === 'legacy-fabric') {
|
|
||||||
return 'Legacy Fabric'
|
|
||||||
} else if (name === 'java-agent') {
|
|
||||||
return 'Java Agent'
|
|
||||||
} else if (name === 'nilloader') {
|
|
||||||
return 'NilLoader'
|
|
||||||
} else if (name === 'mrpack') {
|
|
||||||
return 'Modpack'
|
|
||||||
} else if (name === 'minecraft') {
|
|
||||||
return 'Resource Pack'
|
|
||||||
} else if (name === 'vanilla') {
|
|
||||||
return 'Vanilla Shader'
|
|
||||||
} else if (name === 'geyser') {
|
|
||||||
return 'Geyser Extension'
|
|
||||||
}
|
|
||||||
return capitalizeString(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const formatCategoryHeader = (name) => {
|
export const formatCategoryHeader = (name) => {
|
||||||
return capitalizeString(name)
|
return capitalizeString(name)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user