Allow joining offline servers from the Worlds tab (#3998)

* Allow joining offline servers from the Worlds tab

* Run intl:extract

* Fix lint
This commit is contained in:
Josiah Glosson
2025-07-15 18:58:04 -05:00
committed by GitHub
parent 76dc8a0897
commit 572cd065ed
2 changed files with 36 additions and 28 deletions

View File

@@ -128,6 +128,14 @@ const messages = defineMessages({
id: 'instance.worlds.game_already_open', id: 'instance.worlds.game_already_open',
defaultMessage: 'Instance is already open', defaultMessage: 'Instance is already open',
}, },
noContact: {
id: 'instance.worlds.no_contact',
defaultMessage: "Server couldn't be contacted",
},
incompatibleServer: {
id: 'instance.worlds.incompatible_server',
defaultMessage: 'Server is incompatible',
},
copyAddress: { copyAddress: {
id: 'instance.worlds.copy_address', id: 'instance.worlds.copy_address',
defaultMessage: 'Copy address', defaultMessage: 'Copy address',
@@ -302,39 +310,33 @@ const messages = defineMessages({
</template> </template>
</div> </div>
<div class="flex gap-1 justify-end smart-clickable:allow-pointer-events"> <div class="flex gap-1 justify-end smart-clickable:allow-pointer-events">
<template v-if="world.type === 'singleplayer' || serverStatus"> <ButtonStyled
<ButtonStyled v-if="(playingWorld || (locked && playingInstance)) && !startingInstance"
v-if="(playingWorld || (locked && playingInstance)) && !startingInstance" color="red"
color="red" >
> <button @click="emit('stop')">
<button @click="emit('stop')"> <StopCircleIcon aria-hidden="true" />
<StopCircleIcon aria-hidden="true" /> {{ formatMessage(commonMessages.stopButton) }}
{{ formatMessage(commonMessages.stopButton) }} </button>
</button> </ButtonStyled>
</ButtonStyled> <ButtonStyled v-else>
<ButtonStyled v-else> <button
<button v-tooltip="
v-tooltip=" !serverStatus
serverIncompatible ? formatMessage(messages.noContact)
? 'Server is incompatible' : serverIncompatible
? formatMessage(messages.incompatibleServer)
: !supportsQuickPlay : !supportsQuickPlay
? formatMessage(messages.noQuickPlay) ? formatMessage(messages.noQuickPlay)
: playingOtherWorld || locked : playingOtherWorld || locked
? formatMessage(messages.gameAlreadyOpen) ? formatMessage(messages.gameAlreadyOpen)
: null : null
" "
:disabled="!supportsQuickPlay || playingOtherWorld || startingInstance" :disabled="!supportsQuickPlay || playingOtherWorld || startingInstance"
@click="emit('play')" @click="emit('play')"
> >
<SpinnerIcon v-if="startingInstance && playingWorld" class="animate-spin" /> <SpinnerIcon v-if="startingInstance && playingWorld" class="animate-spin" />
<PlayIcon v-else aria-hidden="true" /> <PlayIcon v-else aria-hidden="true" />
{{ formatMessage(commonMessages.playButton) }}
</button>
</ButtonStyled>
</template>
<ButtonStyled v-else>
<button class="invisible">
<PlayIcon aria-hidden="true" />
{{ formatMessage(commonMessages.playButton) }} {{ formatMessage(commonMessages.playButton) }}
</button> </button>
</ButtonStyled> </ButtonStyled>

View File

@@ -377,6 +377,12 @@
"instance.worlds.hardcore": { "instance.worlds.hardcore": {
"message": "Hardcore mode" "message": "Hardcore mode"
}, },
"instance.worlds.incompatible_server": {
"message": "Server is incompatible"
},
"instance.worlds.no_contact": {
"message": "Server couldn't be contacted"
},
"instance.worlds.no_quick_play": { "instance.worlds.no_quick_play": {
"message": "You can only jump straight into worlds on Minecraft 1.20+" "message": "You can only jump straight into worlds on Minecraft 1.20+"
}, },