mirror of
https://github.com/modrinth/code.git
synced 2026-09-05 06:19:11 +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 isServerType = computed(() => currentType.value === 'server')
|
||||||
|
|
||||||
const projectType = computed(() => tags.value.projectTypes.find((x) => x.id === currentType.value))
|
const projectType = computed(() => tags.value.projectTypes.find((x) => x.id === currentType.value))
|
||||||
|
const projectTypeId = computed(() => projectType.value?.id ?? 'mod')
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => projectType.value?.id,
|
() => projectType.value?.id,
|
||||||
@@ -423,8 +424,6 @@ const advancedFiltersCollapsed = computed({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const projectTypeId = computed(() => projectType.value?.id ?? 'mod')
|
|
||||||
|
|
||||||
debug('projectTypeId:', projectTypeId.value)
|
debug('projectTypeId:', projectTypeId.value)
|
||||||
watch(projectTypeId, (val) => debug('projectTypeId changed:', val))
|
watch(projectTypeId, (val) => debug('projectTypeId changed:', val))
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,17 @@
|
|||||||
</ButtonStyled>
|
</ButtonStyled>
|
||||||
|
|
||||||
<template v-else-if="showRestartButton">
|
<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">
|
<button v-tooltip="busyTooltip" :disabled="!canTakeAction" @click="handlePrimaryAction">
|
||||||
<UpdatedIcon />
|
<UpdatedIcon />
|
||||||
<span>{{ primaryActionText }}</span>
|
<span>{{ primaryActionText }}</span>
|
||||||
@@ -49,7 +59,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<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">
|
<button v-tooltip="busyTooltip" :disabled="!canTakeAction" @click="handlePrimaryAction">
|
||||||
<PlayIcon />
|
<PlayIcon />
|
||||||
<span>{{ startActionText }}</span>
|
<span>{{ startActionText }}</span>
|
||||||
@@ -79,11 +99,13 @@ const props = withDefaults(
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
size?: 'standard' | 'large' | 'small'
|
size?: 'standard' | 'large' | 'small'
|
||||||
startLabel?: string
|
startLabel?: string
|
||||||
|
worlds?: { id: string; name: string }[]
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
disabled: false,
|
disabled: false,
|
||||||
size: 'large',
|
size: 'large',
|
||||||
startLabel: 'Start',
|
startLabel: 'Start',
|
||||||
|
worlds: () => [],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -105,6 +127,37 @@ const size = computed(() => props.size)
|
|||||||
const startActionText = computed(() =>
|
const startActionText = computed(() =>
|
||||||
primaryActionText.value === 'Start' ? props.startLabel : primaryActionText.value,
|
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[]>(() => [
|
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 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 PageHeaderMetadataItem from '#ui/components/base/page-header/metadata/page-header-metadata-item.vue'
|
||||||
import LoaderIcon from '#ui/components/servers/icons/LoaderIcon.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 { formatLoaderLabel } from '#ui/utils/loaders'
|
||||||
|
|
||||||
import SelectedProjectsLeaveModal from './components/SelectedProjectsLeaveModal.vue'
|
import SelectedProjectsLeaveModal from './components/SelectedProjectsLeaveModal.vue'
|
||||||
|
|||||||
@@ -158,12 +158,12 @@
|
|||||||
{{ formatLoaderLabel(serverData.loader) }} {{ serverData.mc_version }}
|
{{ formatLoaderLabel(serverData.loader) }} {{ serverData.mc_version }}
|
||||||
</PageHeaderMetadataItem>
|
</PageHeaderMetadataItem>
|
||||||
<PageHeaderMetadataItem
|
<PageHeaderMetadataItem
|
||||||
v-if="serverData.net?.domain && !serverPreferences.hideSubdomainLabel"
|
v-if="showServerAddress"
|
||||||
:icon="LinkIcon"
|
:icon="LinkIcon"
|
||||||
tooltip="Copy server address"
|
tooltip="Copy server address"
|
||||||
:action="copyServerAddress"
|
:action="copyServerAddress"
|
||||||
>
|
>
|
||||||
{{ serverData.net.domain }}.modrinth.gg
|
{{ serverAddress }}
|
||||||
</PageHeaderMetadataItem>
|
</PageHeaderMetadataItem>
|
||||||
<PageHeaderMetadataItem v-if="showServerUptime" :icon="TimerIcon">
|
<PageHeaderMetadataItem v-if="showServerUptime" :icon="TimerIcon">
|
||||||
{{ formattedUptime }}
|
{{ formattedUptime }}
|
||||||
@@ -183,7 +183,10 @@
|
|||||||
|
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<PageHeaderActions>
|
<PageHeaderActions>
|
||||||
<PanelServerActionButton :disabled="!!installError" />
|
<PanelServerActionButton
|
||||||
|
:disabled="!!installError"
|
||||||
|
:worlds="serverFull?.worlds ?? []"
|
||||||
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
theme="dismissable-prompt"
|
theme="dismissable-prompt"
|
||||||
:triggers="[]"
|
:triggers="[]"
|
||||||
@@ -1070,6 +1073,22 @@ const showServerUptime = computed(() => props.showUptime && serverPowerState.val
|
|||||||
|
|
||||||
const formattedUptime = computed(() => formatUptime(uptimeSeconds.value))
|
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(() => {
|
const serverProjectLink = computed(() => {
|
||||||
if (!serverProject.value) return ''
|
if (!serverProject.value) return ''
|
||||||
return `/project/${serverProject.value.slug ?? serverProject.value.id}`
|
return `/project/${serverProject.value.slug ?? serverProject.value.id}`
|
||||||
@@ -1105,10 +1124,9 @@ function formatUptime(uptime: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function copyServerAddress() {
|
function copyServerAddress() {
|
||||||
const domain = serverData.value?.net?.domain
|
if (!serverAddress.value) return
|
||||||
if (!domain) return
|
|
||||||
|
|
||||||
void navigator.clipboard.writeText(`${domain}.modrinth.gg`)
|
void navigator.clipboard.writeText(serverAddress.value)
|
||||||
addNotification({
|
addNotification({
|
||||||
title: 'Server address copied',
|
title: 'Server address copied',
|
||||||
text: "Your server's address has been copied to your clipboard.",
|
text: "Your server's address has been copied to your clipboard.",
|
||||||
|
|||||||
Reference in New Issue
Block a user