Remove legacy formatCategory (#5280)

* Remove legacy formatCategory

* prepr
This commit is contained in:
Prospector
2026-02-02 10:20:23 -08:00
committed by GitHub
parent f81f951814
commit 56c8bb1950
6 changed files with 18 additions and 66 deletions

View File

@@ -28,7 +28,7 @@
:custom-label="
(version) =>
`${version?.name} (${version?.loaders
.map((name) => formatCategory(name))
.map((name) => formatLoader(formatMessage, name))
.join(', ')} - ${version?.game_versions.join(', ')})`
"
:max-height="150"
@@ -36,7 +36,9 @@
<span v-else>
<span>
{{ selectedVersion?.name }} ({{
selectedVersion?.loaders.map((name) => formatCategory(name)).join(', ')
selectedVersion?.loaders
.map((name) => formatLoader(formatMessage, name))
.join(', ')
}}
- {{ selectedVersion?.game_versions.join(', ') }})
</span>
@@ -57,8 +59,7 @@
<script setup>
import { DownloadIcon, XIcon } from '@modrinth/assets'
import { Button, injectNotificationManager } from '@modrinth/ui'
import { formatCategory } from '@modrinth/utils'
import { Button, formatLoader, injectNotificationManager, useVIntl } from '@modrinth/ui'
import { ref } from 'vue'
import Multiselect from 'vue-multiselect'
@@ -67,6 +68,7 @@ import { trackEvent } from '@/helpers/analytics'
import { add_project_from_version as installMod } from '@/helpers/profile'
const { handleError } = injectNotificationManager()
const { formatMessage } = useVIntl()
const instance = ref(null)
const project = ref(null)

View File

@@ -19,7 +19,7 @@
Platform
</slot>
<template #option="{ option }">
{{ formatCategory(option) }}
{{ formatLoader(formatMessage, String(option)) }}
</template>
<template v-if="hasAnyUnsupportedPlatforms" #footer>
<Checkbox
@@ -58,12 +58,15 @@
<script setup lang="ts">
import { FilterIcon } from '@modrinth/assets'
import { formatLoader, useVIntl } from '@modrinth/ui'
import Checkbox from '@modrinth/ui/src/components/base/Checkbox.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 { useRoute } from 'vue-router'
const { formatMessage } = useVIntl()
export type ListedGameVersion = {
name: string
release: boolean
@@ -119,7 +122,7 @@ const hasOnlyUnsupportedPlatforms = computed(() => {
const showSupportedPlatformsOnly = ref(true)
const filterOptions = computed(() => {
const filterOptions = computed<Record<'gameVersion' | 'platform', string[]>>(() => {
const filters: Record<'gameVersion' | 'platform', string[]> = {
gameVersion: [],
platform: [],

View File

@@ -168,7 +168,7 @@
<template v-else> Unknown product </template>
</span>
<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') }} ({{
formatRelativeTime(subscription.created)
}})
@@ -334,7 +334,7 @@ import {
useRelativeTime,
useVIntl,
} 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 dayjs from 'dayjs'