重构:移除多人服务器组件及相关逻辑
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Sync LobeHub models / sync (push) Has been cancelled
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Sync LobeHub models / sync (push) Has been cancelled
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ServerIcon, UsersIcon } from '@modrinth/assets'
|
||||
import { UsersIcon } from '@modrinth/assets'
|
||||
import { defineMessages, NavTabs, useVIntl } from '@modrinth/ui'
|
||||
import { computed } from 'vue'
|
||||
import { RouterView, useRoute, useRouter } from 'vue-router'
|
||||
@ -10,49 +10,25 @@ const router = useRouter()
|
||||
|
||||
const messages = defineMessages({
|
||||
title: { id: 'app.multiplayer.title', defaultMessage: 'Multiplayer' },
|
||||
serversTab: { id: 'app.multiplayer.tab.servers', defaultMessage: 'Servers' },
|
||||
roomsTab: { id: 'app.multiplayer.tab.rooms', defaultMessage: 'Rooms' },
|
||||
})
|
||||
|
||||
const activeTab = computed(() =>
|
||||
route.path.startsWith('/multiplayer/rooms') ? 'rooms' : 'servers',
|
||||
)
|
||||
// 服务器详情页用固定高度布局:控制台内部滚动,命令输入框始终可见
|
||||
const isStudioMode = computed(() => route.name === 'MultiplayerServerFileStudio')
|
||||
const isFixedRender = computed(
|
||||
() => route.name === 'MultiplayerServerDetail' || route.name === 'MultiplayerServerFileStudio',
|
||||
)
|
||||
const activeTab = computed(() => (route.path.startsWith('/multiplayer/rooms') ? 'rooms' : 'rooms'))
|
||||
const tabLinks = computed(() => [
|
||||
{ label: formatMessage(messages.serversTab), href: '/multiplayer/servers', icon: ServerIcon },
|
||||
{ label: formatMessage(messages.roomsTab), href: '/multiplayer/rooms', icon: UsersIcon },
|
||||
])
|
||||
|
||||
function handleTabClick(index: number) {
|
||||
void router.push(tabLinks.value[index]?.href ?? '/multiplayer/servers')
|
||||
void router.push(tabLinks.value[index]?.href ?? '/multiplayer/rooms')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:class="
|
||||
isStudioMode
|
||||
? 'flex h-full min-h-0 w-full flex-col'
|
||||
: isFixedRender
|
||||
? 'box-border flex h-full min-h-0 w-full flex-col gap-3 p-6'
|
||||
: 'box-border flex min-h-full w-full flex-col gap-3 p-6'
|
||||
"
|
||||
>
|
||||
<template v-if="!isStudioMode">
|
||||
<h1 class="m-0 shrink-0 text-2xl font-semibold text-contrast">
|
||||
{{ formatMessage(messages.title) }}
|
||||
</h1>
|
||||
<NavTabs
|
||||
mode="local"
|
||||
:active-index="activeTab === 'rooms' ? 1 : 0"
|
||||
:links="tabLinks"
|
||||
@tab-click="handleTabClick"
|
||||
/>
|
||||
</template>
|
||||
<div class="box-border flex min-h-full w-full flex-col gap-3 p-6">
|
||||
<h1 class="m-0 shrink-0 text-2xl font-semibold text-contrast">
|
||||
{{ formatMessage(messages.title) }}
|
||||
</h1>
|
||||
<NavTabs mode="local" :active-index="0" :links="tabLinks" @tab-click="handleTabClick" />
|
||||
|
||||
<RouterView />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user