mirror of
https://github.com/modrinth/code.git
synced 2026-08-30 11:36:05 +00:00
fix: merge issues
This commit is contained in:
@@ -114,6 +114,7 @@ debug('initial route.params.type:', route.params.type, '→ currentType:', curre
|
||||
const isServerType = computed(() => currentType.value === 'server')
|
||||
|
||||
const projectType = computed(() => tags.value.projectTypes.find((x) => x.id === currentType.value))
|
||||
const projectTypeId = computed(() => projectType.value?.id ?? 'mod')
|
||||
|
||||
watch(
|
||||
() => projectType.value?.id,
|
||||
@@ -423,8 +424,6 @@ const advancedFiltersCollapsed = computed({
|
||||
},
|
||||
})
|
||||
|
||||
const projectTypeId = computed(() => projectType.value?.id ?? 'mod')
|
||||
|
||||
debug('projectTypeId:', projectTypeId.value)
|
||||
watch(projectTypeId, (val) => debug('projectTypeId changed:', val))
|
||||
|
||||
|
||||
@@ -8,7 +8,17 @@
|
||||
</ButtonStyled>
|
||||
|
||||
<template v-else-if="showRestartButton">
|
||||
<ButtonStyled type="standard" color="orange" :size="size">
|
||||
<JoinedButtons
|
||||
v-if="powerActionWorlds.length"
|
||||
color="orange"
|
||||
:size="size"
|
||||
:actions="restartSplitActions"
|
||||
:primary-disabled="!canTakeAction"
|
||||
:dropdown-disabled="!canTakeAction"
|
||||
:primary-tooltip="busyTooltip"
|
||||
:dropdown-tooltip="busyTooltip"
|
||||
/>
|
||||
<ButtonStyled v-else type="standard" color="orange" :size="size">
|
||||
<button v-tooltip="busyTooltip" :disabled="!canTakeAction" @click="handlePrimaryAction">
|
||||
<UpdatedIcon />
|
||||
<span>{{ primaryActionText }}</span>
|
||||
@@ -49,7 +59,17 @@
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<ButtonStyled type="standard" color="brand" :size="size">
|
||||
<JoinedButtons
|
||||
v-if="powerActionWorlds.length"
|
||||
color="brand"
|
||||
:size="size"
|
||||
:actions="startSplitActions"
|
||||
:primary-disabled="!canTakeAction"
|
||||
:dropdown-disabled="!canTakeAction"
|
||||
:primary-tooltip="busyTooltip"
|
||||
:dropdown-tooltip="busyTooltip"
|
||||
/>
|
||||
<ButtonStyled v-else type="standard" color="brand" :size="size">
|
||||
<button v-tooltip="busyTooltip" :disabled="!canTakeAction" @click="handlePrimaryAction">
|
||||
<PlayIcon />
|
||||
<span>{{ startActionText }}</span>
|
||||
@@ -79,11 +99,13 @@ const props = withDefaults(
|
||||
disabled?: boolean
|
||||
size?: 'standard' | 'large' | 'small'
|
||||
startLabel?: string
|
||||
worlds?: { id: string; name: string }[]
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
size: 'large',
|
||||
startLabel: 'Start',
|
||||
worlds: () => [],
|
||||
},
|
||||
)
|
||||
|
||||
@@ -105,6 +127,37 @@ const size = computed(() => props.size)
|
||||
const startActionText = computed(() =>
|
||||
primaryActionText.value === 'Start' ? props.startLabel : primaryActionText.value,
|
||||
)
|
||||
const powerActionWorlds = computed(() => (props.worlds.length > 1 ? props.worlds : []))
|
||||
|
||||
const startSplitActions = computed<JoinedButtonAction[]>(() => [
|
||||
{
|
||||
id: 'start',
|
||||
label: startActionText.value,
|
||||
icon: PlayIcon,
|
||||
action: handlePrimaryAction,
|
||||
},
|
||||
...powerActionWorlds.value.map((world) => ({
|
||||
id: `start-${world.id}`,
|
||||
label: `Start with ${world.name}`,
|
||||
icon: PlayIcon,
|
||||
action: () => initiateAction('Start', world.id),
|
||||
})),
|
||||
])
|
||||
|
||||
const restartSplitActions = computed<JoinedButtonAction[]>(() => [
|
||||
{
|
||||
id: 'restart',
|
||||
label: primaryActionText.value,
|
||||
icon: UpdatedIcon,
|
||||
action: handlePrimaryAction,
|
||||
},
|
||||
...powerActionWorlds.value.map((world) => ({
|
||||
id: `restart-${world.id}`,
|
||||
label: `Restart with ${world.name}`,
|
||||
icon: UpdatedIcon,
|
||||
action: () => initiateAction('Restart', world.id),
|
||||
})),
|
||||
])
|
||||
|
||||
const stopSplitActions = computed<JoinedButtonAction[]>(() => [
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ import PageHeader from '#ui/components/base/page-header/index.vue'
|
||||
import PageHeaderMetadata from '#ui/components/base/page-header/metadata/index.vue'
|
||||
import PageHeaderMetadataItem from '#ui/components/base/page-header/metadata/page-header-metadata-item.vue'
|
||||
import LoaderIcon from '#ui/components/servers/icons/LoaderIcon.vue'
|
||||
import { useServerImage } from '#ui/composables/use-server-image'
|
||||
import { useServerImage } from '#ui/composables/servers/use-server-image'
|
||||
import { formatLoaderLabel } from '#ui/utils/loaders'
|
||||
|
||||
import SelectedProjectsLeaveModal from './components/SelectedProjectsLeaveModal.vue'
|
||||
|
||||
@@ -158,12 +158,12 @@
|
||||
{{ formatLoaderLabel(serverData.loader) }} {{ serverData.mc_version }}
|
||||
</PageHeaderMetadataItem>
|
||||
<PageHeaderMetadataItem
|
||||
v-if="serverData.net?.domain && !serverPreferences.hideSubdomainLabel"
|
||||
v-if="showServerAddress"
|
||||
:icon="LinkIcon"
|
||||
tooltip="Copy server address"
|
||||
:action="copyServerAddress"
|
||||
>
|
||||
{{ serverData.net.domain }}.modrinth.gg
|
||||
{{ serverAddress }}
|
||||
</PageHeaderMetadataItem>
|
||||
<PageHeaderMetadataItem v-if="showServerUptime" :icon="TimerIcon">
|
||||
{{ formattedUptime }}
|
||||
@@ -183,7 +183,10 @@
|
||||
|
||||
<template #actions>
|
||||
<PageHeaderActions>
|
||||
<PanelServerActionButton :disabled="!!installError" />
|
||||
<PanelServerActionButton
|
||||
:disabled="!!installError"
|
||||
:worlds="serverFull?.worlds ?? []"
|
||||
/>
|
||||
<Tooltip
|
||||
theme="dismissable-prompt"
|
||||
:triggers="[]"
|
||||
@@ -1070,6 +1073,22 @@ const showServerUptime = computed(() => props.showUptime && serverPowerState.val
|
||||
|
||||
const formattedUptime = computed(() => formatUptime(uptimeSeconds.value))
|
||||
|
||||
const serverAddress = computed(() => {
|
||||
const domain = serverData.value?.net?.domain
|
||||
if (domain) return `${domain}.modrinth.gg`
|
||||
|
||||
const ip = serverData.value?.net?.ip
|
||||
if (!ip) return null
|
||||
const port = serverData.value?.net?.port
|
||||
return port ? `${ip}:${port}` : ip
|
||||
})
|
||||
|
||||
const showServerAddress = computed(
|
||||
() =>
|
||||
!!serverAddress.value &&
|
||||
(!serverData.value?.net?.domain || !serverPreferences.value.hideSubdomainLabel),
|
||||
)
|
||||
|
||||
const serverProjectLink = computed(() => {
|
||||
if (!serverProject.value) return ''
|
||||
return `/project/${serverProject.value.slug ?? serverProject.value.id}`
|
||||
@@ -1105,10 +1124,9 @@ function formatUptime(uptime: number) {
|
||||
}
|
||||
|
||||
function copyServerAddress() {
|
||||
const domain = serverData.value?.net?.domain
|
||||
if (!domain) return
|
||||
if (!serverAddress.value) return
|
||||
|
||||
void navigator.clipboard.writeText(`${domain}.modrinth.gg`)
|
||||
void navigator.clipboard.writeText(serverAddress.value)
|
||||
addNotification({
|
||||
title: 'Server address copied',
|
||||
text: "Your server's address has been copied to your clipboard.",
|
||||
|
||||
Reference in New Issue
Block a user