feat: add Confirmation modal to MemberEntry.vue
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful

This commit is contained in:
SauceyRed 2025-08-16 15:50:11 +02:00
parent e28bc23d12
commit 8b8c0591a5
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7

View file

@ -6,12 +6,15 @@
</span> </span>
</div> </div>
<ModalProfilePopup v-if="modalPopupVisible" :profile="props.member" <ModalProfilePopup v-if="modalPopupVisible" :profile="props.member"
:onFinish="hideModalPopup" :keepalive="false"/> :onFinish="hideModalPopup" :keepalive="false" />
<ModalConfirmation v-if="confirmationModal && confirmationModal.show" :action-name="confirmationModal.actionName"
:target-name="getDisplayName(props.member)" :callback="confirmationModal.callback"
:onClose="resetConfirmationModal" :onCancel="resetConfirmationModal" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ModalProfilePopup } from '#components'; import { ModalProfilePopup } from '#components';
import type { ContextMenuInterface, GuildMemberResponse } from '~/types/interfaces'; import type { GuildMemberResponse, IConfirmationModal } from '~/types/interfaces';
const { getDisplayName } = useProfile() const { getDisplayName } = useProfile()
@ -19,10 +22,12 @@ const props = defineProps<{
member: GuildMemberResponse member: GuildMemberResponse
}>(); }>();
const menuSections = await createMemberContextMenuItems(props.member, props.member.guild_uuid); const confirmationModal = ref<IConfirmationModal>();
const menuSections = await createMemberContextMenuItems(props.member, props.member.guild_uuid, confirmationModal);
const modalPopupVisible = ref<boolean>(false); const modalPopupVisible = ref<boolean>(false);
function showModalPopup() { function showModalPopup() {
modalPopupVisible.value = true modalPopupVisible.value = true
} }
@ -30,6 +35,14 @@ function showModalPopup() {
function hideModalPopup() { function hideModalPopup() {
modalPopupVisible.value = false modalPopupVisible.value = false
} }
function resetConfirmationModal() {
console.log("[CONFIRM] resetting");
if (confirmationModal) {
confirmationModal.value = { show: false, actionName: "", callback: () => {} };
}
}
</script> </script>
<style> <style>