Base
10 months ago
Types
1 month ago
AddFormModal.vue
10 months ago
ConfirmDisconnectModal.vue
10 months ago
Modals.vue
9 months ago
SelectPageModal.vue
10 months ago
ConfirmDisconnectModal.vue
93 lines
| 1 | <script lang="ts" setup> |
| 2 | import BaseModal from '@/components/Modals/Base/BaseModal.vue'; |
| 3 | import { useModal } from '@/composables'; |
| 4 | import { useIntegrationsStore } from '@/stores'; |
| 5 | import { translate } from '@/utils/translate'; |
| 6 | |
| 7 | interface Props { |
| 8 | data?: { integration: string; backButtonRedirectAction: (() => void) | undefined }; |
| 9 | } |
| 10 | |
| 11 | const { closeModal } = useModal(); |
| 12 | const integrationsStore = useIntegrationsStore(); |
| 13 | const props = defineProps<Props>(); |
| 14 | |
| 15 | const dismiss = () => { |
| 16 | const backButtonAction = props.data?.backButtonRedirectAction; |
| 17 | if (backButtonAction) { |
| 18 | backButtonAction(); |
| 19 | } else { |
| 20 | closeModal(); |
| 21 | } |
| 22 | }; |
| 23 | const handleDisconnect = async (integrationId: string) => { |
| 24 | await integrationsStore.toggleIntegrationStatus(integrationId, false); |
| 25 | dismiss(); |
| 26 | }; |
| 27 | </script> |
| 28 | |
| 29 | <template> |
| 30 | <BaseModal title-alignment="left" :title="translate('hostinger_reach_confirm_disconnect_modal_title')"> |
| 31 | <template #title-icon> |
| 32 | <HIcon class="confirm-disconnect-modal__icon" name="ic-warning-circle-filled-24" color="danger--600" /> |
| 33 | </template> |
| 34 | |
| 35 | <div class="confirm-disconnect-modal"> |
| 36 | <div class="confirm-disconnect-modal__content"> |
| 37 | <HText variant="body-2" as="p" class="confirm-disconnect-modal__text"> |
| 38 | {{ translate('hostinger_reach_confirm_disconnect_modal_text') }} |
| 39 | </HText> |
| 40 | </div> |
| 41 | |
| 42 | <div class="confirm-disconnect-modal__footer"> |
| 43 | <HButton variant="text" color="neutral" size="small" @click="dismiss"> |
| 44 | {{ translate('hostinger_reach_confirm_disconnect_modal_cancel') }} |
| 45 | </HButton> |
| 46 | <HButton |
| 47 | color="danger" |
| 48 | size="small" |
| 49 | :is-disabled="integrationsStore.isIntegrationLoading(props.data?.integration)" |
| 50 | @click="handleDisconnect(props.data?.integration)" |
| 51 | > |
| 52 | {{ translate('hostinger_reach_confirm_disconnect_modal_disconnect') }} |
| 53 | </HButton> |
| 54 | </div> |
| 55 | </div> |
| 56 | </BaseModal> |
| 57 | </template> |
| 58 | |
| 59 | <style lang="scss" scoped> |
| 60 | .confirm-disconnect-modal { |
| 61 | margin-top: 24px; |
| 62 | |
| 63 | &__icon { |
| 64 | margin-right: 12px; |
| 65 | } |
| 66 | |
| 67 | &__content { |
| 68 | display: flex; |
| 69 | flex-direction: column; |
| 70 | gap: 20px; |
| 71 | align-items: center; |
| 72 | margin-bottom: 24px; |
| 73 | } |
| 74 | |
| 75 | &__footer { |
| 76 | display: flex; |
| 77 | justify-content: flex-end; |
| 78 | gap: 8px; |
| 79 | } |
| 80 | |
| 81 | @media (max-width: 640px) { |
| 82 | &__footer { |
| 83 | flex-direction: column-reverse; |
| 84 | gap: 12px; |
| 85 | |
| 86 | :deep(.h-button) { |
| 87 | width: 100%; |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | </style> |
| 93 |