You've already forked AstralRinth
forked from didirus/AstralRinth
381ea51cce
* fix: files.vue bugs before styling changes * feat: move files tab to shared layout structure * fix: qa * fix: qa * fix: bugs * fix: lint * fix: admonition cleanup with progress + actions * fix: cleanup * fix: modals * fix: admon title * fix: i18n standard * fix: lint + i18n pass * fix: remove transition * fix: type errors * feat: files tab in app * fix: qa * fix: backup item minmax * fix: use ContentPageHeader for server panel * fix: lint * fix: lint * fix: lint * feat: page leave safety * fix: lint * fix: cargo fmt fix * fix: blank in prod * fix: content card table stuff * Revert "fix: blank in prod" This reverts commit 74758fe185cf85a4a20355857f889cb091b97ace. * fix: import * feat: browse worlds/servers flow * fix: worlds tab parity with content tab * fix: perf bug + shader filter pill copy * feat: singleplayer filter * fix: ordering * fix: breadcrumbs * fix: lint * fix: qa * feat: store server proj id when adding to a non-linked instance * fix: lint * fix: i18n + qa * fix: conflict * qa: already installed modal + placeholders not server-specific * fix: qa * fix: add + edit server modals * fix: qa * fix: security * fix: devin flags * fix: lint * chore: change file to break build cache * fix: admon * fix: import path stuff * feat: qa * fix: fmt fmt idiot --------- Signed-off-by: Calum H. <calum@modrinth.com>
122 lines
3.3 KiB
Vue
122 lines
3.3 KiB
Vue
<template>
|
|
<NewModal
|
|
ref="modal"
|
|
:header="formatMessage(messages.header, { action: downgrade ? 'downgrade' : 'update' })"
|
|
fade="warning"
|
|
max-width="500px"
|
|
:on-hide="() => backupCreator?.cancelBackup()"
|
|
>
|
|
<div class="flex flex-col gap-6">
|
|
<Admonition
|
|
type="warning"
|
|
:header="
|
|
formatMessage(messages.admonitionHeader, { action: downgrade ? 'downgrade' : 'update' })
|
|
"
|
|
>
|
|
{{ formatMessage(server ? messages.admonitionBody : messages.admonitionBodyApp) }}
|
|
</Admonition>
|
|
<InlineBackupCreator
|
|
ref="backupCreator"
|
|
:backup-name="backupName"
|
|
@update:buttons-disabled="buttonsDisabled = $event"
|
|
/>
|
|
</div>
|
|
|
|
<template #actions>
|
|
<div class="flex gap-2 justify-end">
|
|
<ButtonStyled type="outlined">
|
|
<button class="!border !border-surface-4" @click="handleCancel">
|
|
<XIcon />
|
|
{{ formatMessage(commonMessages.cancelButton) }}
|
|
</button>
|
|
</ButtonStyled>
|
|
<ButtonStyled color="orange">
|
|
<button :disabled="buttonsDisabled" @click="handleConfirm">
|
|
<DownloadIcon />
|
|
{{
|
|
formatMessage(messages.confirmButton, { action: downgrade ? 'downgrade' : 'update' })
|
|
}}
|
|
</button>
|
|
</ButtonStyled>
|
|
</div>
|
|
</template>
|
|
</NewModal>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { DownloadIcon, XIcon } from '@modrinth/assets'
|
|
import { computed, ref } from 'vue'
|
|
|
|
import Admonition from '#ui/components/base/Admonition.vue'
|
|
import ButtonStyled from '#ui/components/base/ButtonStyled.vue'
|
|
import NewModal from '#ui/components/modal/NewModal.vue'
|
|
import { defineMessages, useVIntl } from '#ui/composables/i18n'
|
|
import { commonMessages } from '#ui/utils/common-messages'
|
|
|
|
import InlineBackupCreator from './InlineBackupCreator.vue'
|
|
|
|
const props = defineProps<{
|
|
downgrade?: boolean
|
|
server?: boolean
|
|
backupTip?: string
|
|
}>()
|
|
|
|
const { formatMessage } = useVIntl()
|
|
|
|
const backupName = computed(() => {
|
|
const action = props.downgrade ? 'downgrade' : 'update'
|
|
return props.backupTip
|
|
? `Before modpack ${action} (${props.backupTip})`
|
|
: `Before modpack ${action}`
|
|
})
|
|
|
|
const messages = defineMessages({
|
|
header: {
|
|
id: 'content.confirm-modpack-update.header',
|
|
defaultMessage: '{action, select, downgrade {Downgrade} other {Update}} modpack',
|
|
},
|
|
admonitionHeader: {
|
|
id: 'content.confirm-modpack-update.admonition-header',
|
|
defaultMessage: '{action, select, downgrade {Downgrade} other {Update}} warning',
|
|
},
|
|
admonitionBody: {
|
|
id: 'content.confirm-modpack-update.admonition-body',
|
|
defaultMessage: 'Any mods or content you added on top of the modpack will be deleted.',
|
|
},
|
|
admonitionBodyApp: {
|
|
id: 'content.confirm-modpack-update.admonition-body-app',
|
|
defaultMessage: 'Any mods or content you added on top of the modpack will be preserved.',
|
|
},
|
|
confirmButton: {
|
|
id: 'content.confirm-modpack-update.confirm-button',
|
|
defaultMessage: '{action, select, downgrade {Downgrade} other {Update}} modpack',
|
|
},
|
|
})
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'confirm' | 'cancel'): void
|
|
}>()
|
|
|
|
const modal = ref<InstanceType<typeof NewModal>>()
|
|
const backupCreator = ref<InstanceType<typeof InlineBackupCreator>>()
|
|
const buttonsDisabled = ref(false)
|
|
|
|
function show() {
|
|
modal.value?.show()
|
|
}
|
|
|
|
function handleConfirm() {
|
|
modal.value?.hide()
|
|
emit('confirm')
|
|
}
|
|
|
|
function handleCancel() {
|
|
modal.value?.hide()
|
|
emit('cancel')
|
|
}
|
|
|
|
defineExpose({
|
|
show,
|
|
})
|
|
</script>
|