fix some issues with latest PRs (#5242)

This commit is contained in:
Prospector
2026-01-28 16:41:17 -08:00
committed by GitHub
parent 6d68c0983f
commit 3f8805b953
5 changed files with 32 additions and 13 deletions

View File

@@ -458,9 +458,11 @@ function getMessages() {
} }
function getLoaderCategories(ver) { function getLoaderCategories(ver) {
return tags.value.loaders.filter((loader) => { return tags.value.loaders
return ver?.loaders?.includes(loader.name) .filter((loader) => {
}) return ver?.loaders?.includes(loader.name)
})
.map((loader) => loader.name)
} }
</script> </script>

View File

@@ -225,7 +225,7 @@
? formatMessage(messages.gameVersionUnsupportedTooltip, { ? formatMessage(messages.gameVersionUnsupportedTooltip, {
title: project.title, title: project.title,
gameVersion: gameVersion, gameVersion: gameVersion,
platform: formatCategory(currentPlatform), platform: currentPlatformText,
}) })
: null : null
" "
@@ -277,7 +277,7 @@
{{ {{
currentPlatform currentPlatform
? formatMessage(messages.platformLabel, { ? formatMessage(messages.platformLabel, {
platform: formatCategory(currentPlatform), platform: currentPlatformText,
}) })
: formatMessage(messages.platformError) : formatMessage(messages.platformError)
}} }}
@@ -285,7 +285,7 @@
v-tooltip=" v-tooltip="
formatMessage(messages.platformTooltip, { formatMessage(messages.platformTooltip, {
title: project.title, title: project.title,
platform: formatCategory(currentPlatform), platform: currentPlatformText,
}) })
" "
class="ml-auto size-5" class="ml-auto size-5"
@@ -309,7 +309,7 @@
{{ {{
currentPlatform currentPlatform
? formatMessage(messages.platformLabel, { ? formatMessage(messages.platformLabel, {
platform: formatCategory(currentPlatform), platform: currentPlatformText,
}) })
: formatMessage(messages.selectPlatform) : formatMessage(messages.selectPlatform)
}} }}
@@ -325,7 +325,7 @@
!possiblePlatforms.includes(platform) !possiblePlatforms.includes(platform)
? formatMessage(messages.platformUnsupportedTooltip, { ? formatMessage(messages.platformUnsupportedTooltip, {
title: project.title, title: project.title,
platform: formatCategory(platform), platform: currentPlatformText,
gameVersion: currentGameVersion, gameVersion: currentGameVersion,
}) })
: null : null
@@ -357,7 +357,7 @@
} }
" "
> >
{{ formatCategory(platform) }} {{ formatMessage(getTagMessage(platform, 'loader')) }}
<CheckIcon v-if="userSelectedPlatform === platform" /> <CheckIcon v-if="userSelectedPlatform === platform" />
</button> </button>
</ButtonStyled> </ButtonStyled>
@@ -395,7 +395,7 @@
{{ {{
formatMessage(messages.noVersionsAvailable, { formatMessage(messages.noVersionsAvailable, {
gameVersion: currentGameVersion, gameVersion: currentGameVersion,
platform: formatCategory(currentPlatform), platform: currentPlatformText,
}) })
}} }}
</p> </p>
@@ -956,6 +956,7 @@ import {
Checkbox, Checkbox,
commonMessages, commonMessages,
defineMessages, defineMessages,
getTagMessage,
injectModrinthClient, injectModrinthClient,
injectNotificationManager, injectNotificationManager,
IntlFormatted, IntlFormatted,
@@ -1061,6 +1062,10 @@ const currentPlatform = computed(() => {
) )
}) })
const currentPlatformText = computed(() =>
formatMessage(getTagMessage(currentPlatform.value, 'loader')),
)
const releaseVersions = computed(() => { const releaseVersions = computed(() => {
const set = new Set() const set = new Set()
for (const gv of tags.value.gameVersions || []) { for (const gv of tags.value.gameVersions || []) {

View File

@@ -213,7 +213,10 @@
</div> </div>
</template> </template>
<template #sidebar> <template #sidebar>
<SidebarCard v-if="collection.description" :title="formatMessage(messages.descriptionLabel)"> <SidebarCard
v-if="collection.description"
:title="formatMessage(commonMessages.descriptionLabel)"
>
<p class="m-0">{{ collection.description }}</p> <p class="m-0">{{ collection.description }}</p>
</SidebarCard> </SidebarCard>
<SidebarCard <SidebarCard

View File

@@ -3,6 +3,8 @@
import type { FunctionalComponent, SVGAttributes } from 'vue' import type { FunctionalComponent, SVGAttributes } from 'vue'
export type IconComponent = FunctionalComponent<SVGAttributes>
import _AffiliateIcon from './icons/affiliate.svg?component' import _AffiliateIcon from './icons/affiliate.svg?component'
import _AlignLeftIcon from './icons/align-left.svg?component' import _AlignLeftIcon from './icons/align-left.svg?component'
import _ArchiveIcon from './icons/archive.svg?component' import _ArchiveIcon from './icons/archive.svg?component'
@@ -325,8 +327,6 @@ import _XCircleIcon from './icons/x-circle.svg?component'
import _ZoomInIcon from './icons/zoom-in.svg?component' import _ZoomInIcon from './icons/zoom-in.svg?component'
import _ZoomOutIcon from './icons/zoom-out.svg?component' import _ZoomOutIcon from './icons/zoom-out.svg?component'
export type IconComponent = FunctionalComponent<SVGAttributes>
export const AffiliateIcon = _AffiliateIcon export const AffiliateIcon = _AffiliateIcon
export const AlignLeftIcon = _AlignLeftIcon export const AlignLeftIcon = _AlignLeftIcon
export const ArchiveIcon = _ArchiveIcon export const ArchiveIcon = _ArchiveIcon

View File

@@ -129,14 +129,23 @@ export { default as SlimPlayerModel } from './models/slim-player.gltf?url'
export const EmptyIllustration = _EmptyIllustration export const EmptyIllustration = _EmptyIllustration
export function getCategoryIcon(categoryName: string): IconComponent | undefined { export function getCategoryIcon(categoryName: string): IconComponent | undefined {
if (!categoryName) {
return undefined
}
return categoryIconMap[categoryName.toLowerCase()] return categoryIconMap[categoryName.toLowerCase()]
} }
export function getLoaderIcon(loaderName: string): IconComponent | undefined { export function getLoaderIcon(loaderName: string): IconComponent | undefined {
if (!loaderName) {
return undefined
}
return loaderIconMap[loaderName.toLowerCase()] return loaderIconMap[loaderName.toLowerCase()]
} }
// will try loader first, then category // will try loader first, then category
export function getTagIcon(tagName: string): IconComponent | undefined { export function getTagIcon(tagName: string): IconComponent | undefined {
if (!tagName) {
return undefined
}
return getLoaderIcon(tagName) ?? getCategoryIcon(tagName) return getLoaderIcon(tagName) ?? getCategoryIcon(tagName)
} }