diff --git a/SecureSend/ClientApp/src/assets/icons/CloseIcon.vue b/SecureSend/ClientApp/src/assets/icons/CloseIcon.vue new file mode 100644 index 0000000..bd46d75 --- /dev/null +++ b/SecureSend/ClientApp/src/assets/icons/CloseIcon.vue @@ -0,0 +1,17 @@ + diff --git a/SecureSend/ClientApp/src/components/ConfirmModal.vue b/SecureSend/ClientApp/src/components/ConfirmModal.vue new file mode 100644 index 0000000..b1f04a3 --- /dev/null +++ b/SecureSend/ClientApp/src/components/ConfirmModal.vue @@ -0,0 +1,51 @@ + + + diff --git a/SecureSend/ClientApp/src/utils/composables/useConfirmDialog.ts b/SecureSend/ClientApp/src/utils/composables/useConfirmDialog.ts new file mode 100644 index 0000000..26157cd --- /dev/null +++ b/SecureSend/ClientApp/src/utils/composables/useConfirmDialog.ts @@ -0,0 +1,56 @@ +import { type Ref, ref, computed, type ComputedRef } from "vue"; + +export type UseConfirmDialogRevealResult = + | { + data?: C; + isCanceled: false; + } + | { + data?: D; + isCanceled: true; + }; + +export interface UseConfirmDialogReturn { + isRevealed: ComputedRef; + reveal: ( + data?: RevealData + ) => Promise>; + confirm: (data?: ConfirmData) => void; + cancel: (data?: CancelData) => void; +} + +export function useConfirmDialog( + revealed: Ref = ref(false) +) { + let _resolve: ( + arg0: UseConfirmDialogRevealResult + ) => void; + + const reveal = () => { + revealed.value = true; + + return new Promise>( + (resolve) => { + _resolve = resolve; + } + ); + }; + + const confirm = (data: ConfirmData) => { + revealed.value = false; + + _resolve({ data, isCanceled: false }); + }; + + const cancel = (data?: CancelData) => { + revealed.value = false; + _resolve({ data, isCanceled: true }); + }; + + return { + isRevealed: computed(() => revealed.value), + reveal, + confirm, + cancel, + }; +} diff --git a/SecureSend/ClientApp/src/views/FileUploadView.vue b/SecureSend/ClientApp/src/views/FileUploadView.vue index 7feb914..eead77f 100644 --- a/SecureSend/ClientApp/src/views/FileUploadView.vue +++ b/SecureSend/ClientApp/src/views/FileUploadView.vue @@ -37,6 +37,21 @@ + + + + +