feat: better tooltips for mods in content tab hosting panel (#5679)

* feat: better tooltips for mods in content tab hosting panel

* feat: qa
This commit is contained in:
Calum H.
2026-03-26 22:55:08 +00:00
committed by GitHub
parent ef1ffa6577
commit 4394092928
17 changed files with 223 additions and 86 deletions

View File

@@ -126,7 +126,10 @@ const contentQuery = useQuery({
staleTime: 0,
})
const modpackProjectId = computed(() => contentQuery.data.value?.modpack?.spec.project_id ?? null)
const modpackProjectId = computed(() => {
const spec = contentQuery.data.value?.modpack?.spec
return spec?.platform === 'modrinth' ? spec.project_id : null
})
const modpackVersionsQuery = useQuery({
queryKey: computed(() => ['labrinth', 'versions', 'v2', modpackProjectId.value]),
@@ -146,24 +149,32 @@ const projectQuery = useQuery({
const modpack = computed<ContentModpackData | null>(() => {
const mp = contentQuery.data.value?.modpack
if (!mp) return null
const isLocal = mp.spec.platform === 'local_file'
const project = projectQuery.data.value
const projectId = isLocal ? null : mp.spec.project_id
return {
project: {
id: mp.spec.project_id,
slug: project?.slug ?? mp.spec.project_id,
title: mp.title ?? mp.spec.project_id,
id: projectId ?? mp.title ?? '',
slug: project?.slug ?? projectId ?? '',
title: mp.title ?? (isLocal ? mp.spec.name : projectId) ?? '',
icon_url: mp.icon_url ?? undefined,
description: mp.description ?? '',
downloads: mp.downloads ?? 0,
followers: mp.followers ?? 0,
downloads: mp.downloads,
followers: mp.followers,
filename: isLocal ? mp.spec.filename : undefined,
} as ContentModpackCardProject,
projectLink: `/project/${project?.slug ?? mp.spec.project_id}`,
version: {
id: mp.spec.version_id,
version_number: mp.version_number ?? '',
date_published: mp.date_published ?? '',
} as ContentModpackCardVersion,
versionLink: `/project/${project?.slug ?? mp.spec.project_id}/version/${mp.spec.version_id}`,
projectLink: projectId ? `/project/${project?.slug ?? projectId}` : undefined,
version: isLocal
? undefined
: ({
id: mp.spec.version_id,
version_number: mp.version_number ?? '',
date_published: mp.date_published ?? '',
} as ContentModpackCardVersion),
versionLink:
projectId && !isLocal
? `/project/${project?.slug ?? projectId}/version/${mp.spec.version_id}`
: undefined,
owner: mp.owner
? {
id: mp.owner.id,
@@ -499,6 +510,8 @@ function addonToContentItem(addon: Archon.Content.v1.Addon): ContentItem {
has_update: !!addon.has_update,
update_version_id: addon.has_update,
environment: addon.version?.environment ?? undefined,
pack_client_retained: addon.pack_client_retained,
pack_client_depends: addon.pack_client_depends,
}
}
@@ -677,7 +690,7 @@ async function handleSwitchVersion(item: ContentItem) {
async function handleModpackUpdate() {
const mp = contentQuery.data.value?.modpack
if (!mp?.spec.project_id) return
if (!mp || mp.spec.platform !== 'modrinth') return
updatingModpack.value = true
updatingProject.value = null
@@ -767,7 +780,8 @@ function handleModalUpdate(selectedVersion: Labrinth.Versions.v2.Version, event?
pendingModpackUpdateVersion.value = selectedVersion
handleModpackUpdateConfirm()
} else {
const currentVersionId = contentQuery.data.value?.modpack?.spec.version_id
const mpSpec = contentQuery.data.value?.modpack?.spec
const currentVersionId = mpSpec?.platform === 'modrinth' ? mpSpec.version_id : undefined
const currentVersion = updatingProjectVersions.value.find((v) => v.id === currentVersionId)
isModpackUpdateDowngrade.value = currentVersion
? new Date(selectedVersion.date_published) < new Date(currentVersion.date_published)
@@ -785,7 +799,7 @@ async function performUpdate(selectedVersion: Labrinth.Versions.v2.Version) {
try {
if (updatingModpack.value) {
const mp = contentQuery.data.value?.modpack
if (!mp) return
if (!mp || mp.spec.platform !== 'modrinth') return
await client.archon.content_v1.installContent(serverId, worldId.value!, {
content_variant: 'modpack',
spec: {
@@ -895,13 +909,15 @@ provideContentManager({
getOverflowOptions,
mapToTableItem: (item) => {
const projectType = item.project_type ?? type.value
const addon = addonLookup.value.get(item.file_name)
const hasModrinthProject = !!addon?.project_id
return {
id: item.id,
project: item.project,
projectLink: item.project?.id ? `/${projectType}/${item.project.id}` : undefined,
projectLink: hasModrinthProject ? `/${projectType}/${item.project.id}` : undefined,
version: item.version,
versionLink:
item.project?.id && item.version?.id
hasModrinthProject && item.version?.id
? `/${projectType}/${item.project.id}/version/${item.version.id}`
: undefined,
owner: item.owner
@@ -935,7 +951,9 @@ provideContentManager({
:current-loader="currentLoader"
:current-version-id="
updatingModpack
? (contentQuery.data.value?.modpack?.spec.version_id ?? '')
? contentQuery.data.value?.modpack?.spec.platform === 'modrinth'
? contentQuery.data.value.modpack.spec.version_id
: ''
: (updatingProject?.version?.id ?? '')
"
:is-app="false"