antares/src/renderer/components/ModalDiscardChanges.vue

49 lines
1.1 KiB
Vue
Raw Normal View History

2020-12-04 11:19:16 +01:00
<template>
<ConfirmModal
:confirm-text="t('general.discard')"
:cancel-text="t('general.stay')"
@confirm="emit('confirm')"
@hide="emit('close')"
2020-12-04 11:19:16 +01:00
>
2021-12-10 17:34:44 +01:00
<template #header>
2020-12-04 11:19:16 +01:00
<div class="d-flex">
<i class="mdi mdi-24px mdi-content-save-alert mr-1" /> {{ t('application.unsavedChanges') }}
2020-12-04 11:19:16 +01:00
</div>
</template>
2021-12-10 17:34:44 +01:00
<template #body>
2020-12-04 11:19:16 +01:00
<div>
{{ t('application.discardUnsavedChanges') }}
2020-12-04 11:19:16 +01:00
</div>
2021-12-10 17:34:44 +01:00
</template>
2020-12-04 11:19:16 +01:00
</ConfirmModal>
</template>
<script setup lang="ts">
import { onBeforeUnmount } from 'vue';
import { useI18n } from 'vue-i18n';
import ConfirmModal from '@/components/BaseConfirmModal.vue';
const { t } = useI18n();
2020-12-04 11:19:16 +01:00
const emit = defineEmits(['confirm', 'close']);
const onKey = (e: KeyboardEvent) => {
e.stopPropagation();
if (e.key === 'Escape')
emit('close');
2020-12-04 11:19:16 +01:00
};
window.addEventListener('keydown', onKey);
onBeforeUnmount(() => {
window.removeEventListener('keydown', onKey);
});
2020-12-04 11:19:16 +01:00
</script>
<style scoped>
.modal-container {
max-width: 360px;
}
</style>