2025-05-07 19:08:38 -07:00
|
|
|
<template>
|
2025-08-14 21:48:38 +01:00
|
|
|
<ConfirmModal
|
|
|
|
|
ref="modal"
|
|
|
|
|
title="Do you want to overwrite these conflicting files?"
|
|
|
|
|
:proceed-label="`Overwrite`"
|
|
|
|
|
:proceed-icon="CheckIcon"
|
|
|
|
|
@proceed="proceed"
|
|
|
|
|
>
|
|
|
|
|
<div class="flex max-w-[30rem] flex-col gap-4">
|
|
|
|
|
<p class="m-0 font-semibold leading-normal">
|
|
|
|
|
<template v-if="hasMany">
|
|
|
|
|
Over 100 files will be overwritten if you proceed with extraction; here is just some of
|
|
|
|
|
them:
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
The following {{ files.length }} files already exist on your server, and will be
|
|
|
|
|
overwritten if you proceed with extraction:
|
|
|
|
|
</template>
|
|
|
|
|
</p>
|
|
|
|
|
<ul class="m-0 max-h-80 list-none overflow-auto rounded-2xl bg-bg px-4 py-3">
|
|
|
|
|
<li v-for="file in files" :key="file" class="flex items-center gap-1 py-1 font-medium">
|
|
|
|
|
<XIcon class="shrink-0 text-red" /> {{ file }}
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</ConfirmModal>
|
2025-05-07 19:08:38 -07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2025-08-14 21:48:38 +01:00
|
|
|
import { CheckIcon, XIcon } from '@modrinth/assets'
|
|
|
|
|
import { ConfirmModal } from '@modrinth/ui'
|
|
|
|
|
import { ref } from 'vue'
|
2025-05-07 19:08:38 -07:00
|
|
|
|
2025-08-14 21:48:38 +01:00
|
|
|
const path = ref('')
|
|
|
|
|
const files = ref<string[]>([])
|
2025-05-07 19:08:38 -07:00
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2025-08-14 21:48:38 +01:00
|
|
|
(e: 'proceed', path: string): void
|
|
|
|
|
}>()
|
2025-05-07 19:08:38 -07:00
|
|
|
|
2025-08-14 21:48:38 +01:00
|
|
|
const modal = ref<typeof ConfirmModal>()
|
2025-05-07 19:08:38 -07:00
|
|
|
|
2025-08-14 21:48:38 +01:00
|
|
|
const hasMany = computed(() => files.value.length > 100)
|
2025-05-07 19:08:38 -07:00
|
|
|
|
|
|
|
|
const show = (zipPath: string, conflictingFiles: string[]) => {
|
2025-08-14 21:48:38 +01:00
|
|
|
path.value = zipPath
|
|
|
|
|
files.value = conflictingFiles
|
|
|
|
|
modal.value?.show()
|
|
|
|
|
}
|
2025-05-07 19:08:38 -07:00
|
|
|
|
|
|
|
|
const proceed = () => {
|
2025-08-14 21:48:38 +01:00
|
|
|
emit('proceed', path.value)
|
|
|
|
|
}
|
2025-05-07 19:08:38 -07:00
|
|
|
|
2025-08-14 21:48:38 +01:00
|
|
|
defineExpose({ show })
|
2025-05-07 19:08:38 -07:00
|
|
|
</script>
|