diff --git a/apps/frontend/src/components/ui/servers/BackupItem.vue b/apps/frontend/src/components/ui/servers/BackupItem.vue index b8e170ca8f..6e910066ed 100644 --- a/apps/frontend/src/components/ui/servers/BackupItem.vue +++ b/apps/frontend/src/components/ui/servers/BackupItem.vue @@ -13,23 +13,14 @@ import { TrashIcon, XIcon, } from '@modrinth/assets' -import { - ButtonStyled, - commonMessages, - injectNotificationManager, - OverflowMenu, - ProgressBar, -} from '@modrinth/ui' +import { ButtonStyled, commonMessages, OverflowMenu, ProgressBar } from '@modrinth/ui' import type { Backup } from '@modrinth/utils' import { defineMessages, useVIntl } from '@vintl/vintl' import dayjs from 'dayjs' -import { computed, ref } from 'vue' - -import type { ModrinthServer } from '~/composables/servers/modrinth-servers.ts' +import { computed } from 'vue' const flags = useFeatureFlags() const { formatMessage } = useVIntl() -const { addNotification } = injectNotificationManager() const emit = defineEmits<{ (e: 'download' | 'rename' | 'restore' | 'lock' | 'retry'): void @@ -42,13 +33,11 @@ const props = withDefaults( preview?: boolean kyrosUrl?: string jwt?: string - server?: ModrinthServer }>(), { preview: false, kyrosUrl: undefined, jwt: undefined, - server: undefined, }, ) @@ -135,48 +124,7 @@ const messages = defineMessages({ id: 'servers.backups.item.retry', defaultMessage: 'Retry', }, - downloadingBackup: { - id: 'servers.backups.item.downloading-backup', - defaultMessage: 'Downloading backup...', - }, - downloading: { - id: 'servers.backups.item.downloading', - defaultMessage: 'Downloading', - }, }) - -const downloadingState = ref<{ progress: number; state: string } | undefined>(undefined) - -const downloading = computed(() => downloadingState.value) - -const handleDownload = async () => { - if (!props.server?.backups || downloading.value) { - return - } - - downloadingState.value = { progress: 0, state: 'ongoing' } - - try { - const download = props.server.backups.downloadBackup(props.backup.id, props.backup.name) - - download.onProgress((p) => { - downloadingState.value = { progress: p.progress, state: 'ongoing' } - }) - - await download.promise - - emit('download') - } catch (error) { - console.error('Failed to download backup:', error) - addNotification({ - type: 'error', - title: 'Download failed', - text: error instanceof Error ? error.message : 'Failed to download backup', - }) - } finally { - downloadingState.value = undefined - } -}