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

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { Archon, Labrinth } from '@modrinth/api-client'
import { ArrowLeftRightIcon, ClipboardCopyIcon } from '@modrinth/assets'
import { ClipboardCopyIcon } from '@modrinth/assets'
import { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query'
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router'
@@ -78,10 +78,6 @@ const messages = defineMessages({
id: 'hosting.content.failed-to-bulk-update',
defaultMessage: 'Failed to update content',
},
switchVersion: {
id: 'hosting.content.switch-version',
defaultMessage: 'Switch version',
},
copyLink: {
id: 'hosting.content.copy-link',
defaultMessage: 'Copy link',
@@ -823,15 +819,7 @@ function handleModpackUpdateCancel() {
}
function getOverflowOptions(item: ContentItem) {
const options: { id: string; icon?: typeof ArrowLeftRightIcon; action: () => void }[] = []
if (item.project?.id && item.version?.id && !item.has_update) {
options.push({
id: formatMessage(messages.switchVersion),
icon: ArrowLeftRightIcon,
action: () => handleSwitchVersion(item),
})
}
const options: { id: string; icon?: typeof ClipboardCopyIcon; action: () => void }[] = []
if (item.project?.slug) {
options.push({
@@ -894,6 +882,7 @@ provideContentManager({
viewModpackContent: handleViewModpackContent,
unlinkModpack: handleModpackUnlink,
openSettings: () => router.push(`/hosting/manage/${serverId}/options/loader`),
switchVersion: handleSwitchVersion,
getOverflowOptions,
mapToTableItem: (item) => {
const projectType = item.project_type ?? type.value