feat: move switch version inline like update btn for content tab (#5631)

* fix: switch version inline same as update btn

* fix: lint
This commit is contained in:
Calum H.
2026-03-21 18:06:03 +00:00
committed by GitHub
parent 9e6a6cd385
commit 92eddbe832
8 changed files with 43 additions and 36 deletions

View File

@@ -86,9 +86,6 @@
"app.instance.mods.successfully-uploaded": {
"message": "Successfully uploaded"
},
"app.instance.mods.switch-version": {
"message": "Switch version"
},
"app.instance.mods.unknown-version": {
"message": "Unknown"
},

View File

@@ -63,7 +63,7 @@
<script setup lang="ts">
import type { Labrinth } from '@modrinth/api-client'
import { ArrowLeftRightIcon, ClipboardCopyIcon, FolderOpenIcon } from '@modrinth/assets'
import { ClipboardCopyIcon, FolderOpenIcon } from '@modrinth/assets'
import {
ConfirmModpackUpdateModal,
type ContentItem,
@@ -165,10 +165,6 @@ const messages = defineMessages({
id: 'app.instance.mods.copy-link',
defaultMessage: 'Copy link',
},
switchVersion: {
id: 'app.instance.mods.switch-version',
defaultMessage: 'Switch version',
},
})
let savedModalState: ModpackContentModalState | null = null
@@ -386,7 +382,7 @@ async function switchProjectVersion(mod: ContentItem, version: Labrinth.Versions
}
async function handleUpdate(id: string) {
const item = projects.value.find((p) => p.file_name === id)
const item = projects.value.find((p) => p.id === id)
if (!item?.has_update || !item.project?.id || !item.version?.id) return
debug('handleUpdate triggered', {
@@ -663,14 +659,6 @@ async function handleShareItems(
function getOverflowOptions(item: ContentItem): OverflowMenuOption[] {
const options: OverflowMenuOption[] = []
if (item.project?.id && item.version?.id && !item.has_update) {
options.push({
id: formatMessage(messages.switchVersion),
icon: ArrowLeftRightIcon,
action: () => handleSwitchVersion(item),
})
}
options.push({
id: formatMessage(messages.showFile),
icon: FolderOpenIcon,
@@ -837,6 +825,7 @@ provideContentManager({
viewModpackContent: handleModpackContent,
unlinkModpack: unpairProfile,
openSettings: props.openSettings,
switchVersion: handleSwitchVersion,
getOverflowOptions,
showContentHint,
dismissContentHint,