Replace the local Modal with 2fauth/ui Modal component

This commit is contained in:
Bubka
2025-06-23 15:27:00 +02:00
parent 16a1a9077d
commit 4a8f251d92
6 changed files with 14 additions and 74 deletions

5
resources/js/app.js vendored
View File

@@ -42,7 +42,6 @@ app.use(Notifications)
import ResponsiveWidthWrapper from '@/layouts/ResponsiveWidthWrapper.vue' import ResponsiveWidthWrapper from '@/layouts/ResponsiveWidthWrapper.vue'
import FormWrapper from '@/layouts/FormWrapper.vue' import FormWrapper from '@/layouts/FormWrapper.vue'
import Footer from '@/layouts/Footer.vue' import Footer from '@/layouts/Footer.vue'
import Modal from '@/layouts/Modal.vue'
import Kicker from '@/components/Kicker.vue' import Kicker from '@/components/Kicker.vue'
import { import {
@@ -57,6 +56,10 @@ import {
VueButton VueButton
} from '@2fauth/formcontrols' } from '@2fauth/formcontrols'
import {
Modal
} from '@2fauth/ui'
app app
.component('FontAwesomeIcon', FontAwesomeIcon) .component('FontAwesomeIcon', FontAwesomeIcon)
.component('ResponsiveWidthWrapper', ResponsiveWidthWrapper) .component('ResponsiveWidthWrapper', ResponsiveWidthWrapper)

View File

@@ -1,56 +0,0 @@
<script setup>
const { notify } = useNotification()
const props = defineProps({
modelValue: Boolean,
closable: {
type: Boolean,
default: true
},
isFullHeight: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['update:modelValue'])
const isActive = computed({
get() {
return props.modelValue
},
set(value) {
emit('update:modelValue', value)
}
})
function closeModal(event) {
notify({ clean: true })
isActive.value = false
}
</script>
<template>
<div class="modal modal-otp" v-bind:class="{ 'is-active': isActive }">
<div class="modal-background" @click.stop="closeModal"></div>
<div v-if="isFullHeight" class="modal-content modal-with-footer">
<div class="modal-slot p-4 has-text-centered">
<slot></slot>
</div>
</div>
<div v-else class="modal-content modal-with-footer">
<section class="section">
<div class="columns is-centered">
<div class="column is-three-quarters">
<div class="modal-slot box has-text-centered is-shadowless">
<slot></slot>
</div>
</div>
</div>
</section>
</div>
<VueFooter v-if="props.closable" :showButtons="true" :internalFooterType="'modal'">
<NavigationButton action="close" :useLinkTag="false" @closed="closeModal" />
</VueFooter>
</div>
</template>

View File

@@ -8,13 +8,6 @@
const showModal = ref(true) const showModal = ref(true)
const showDebug = computed(() => process.env.NODE_ENV === 'development') const showDebug = computed(() => process.env.NODE_ENV === 'development')
const props = defineProps({
closable: {
type: Boolean,
default: true
}
})
watch(showModal, (val) => { watch(showModal, (val) => {
if (val == false) { if (val == false) {
exit() exit()
@@ -40,7 +33,7 @@
<template> <template>
<div> <div>
<modal v-model="showModal" :closable="props.closable"> <Modal v-model="showModal">
<div class="error-message" v-if="$route.name == '404' || $route.name == 'notFound'"> <div class="error-message" v-if="$route.name == '404' || $route.name == 'notFound'">
<p class="error-404"></p> <p class="error-404"></p>
<p>{{ $t('message.resource_not_found') }}</p> <p>{{ $t('message.resource_not_found') }}</p>
@@ -52,6 +45,6 @@
<p v-if="errorHandler.originalMessage" class="has-text-grey-lighter">{{ errorHandler.originalMessage }}</p> <p v-if="errorHandler.originalMessage" class="has-text-grey-lighter">{{ errorHandler.originalMessage }}</p>
<p v-if="showDebug && errorHandler.debug" class="is-size-7 is-family-code pt-3"><br>{{ errorHandler.debug }}</p> <p v-if="showDebug && errorHandler.debug" class="is-size-7 is-family-code pt-3"><br>{{ errorHandler.debug }}</p>
</div> </div>
</modal> </Modal>
</div> </div>
</template> </template>

View File

@@ -215,7 +215,7 @@
<NavigationButton action="cancel" :isCapture="true" :useLinkTag="false" @canceled="exitStream()" /> <NavigationButton action="cancel" :isCapture="true" :useLinkTag="false" @canceled="exitStream()" />
</div> </div>
</div> </div>
<modal v-model="showQrContent"> <Modal v-model="showQrContent">
<QrContentDisplay :qrContent="form.uri" /> <QrContentDisplay :qrContent="form.uri" />
</modal> </Modal>
</template> </template>

View File

@@ -607,7 +607,7 @@
</VueFooter> </VueFooter>
</form> </form>
<!-- modal --> <!-- modal -->
<modal v-model="ShowTwofaccountInModal"> <Modal v-model="ShowTwofaccountInModal">
<OtpDisplay <OtpDisplay
ref="OtpDisplayForAdvancedForm" ref="OtpDisplayForAdvancedForm"
v-bind="form.data()" v-bind="form.data()"
@@ -615,12 +615,12 @@
@validation-error="mapDisplayerErrors" @validation-error="mapDisplayerErrors"
@please-close-me="ShowTwofaccountInModal = false"> @please-close-me="ShowTwofaccountInModal = false">
</OtpDisplay> </OtpDisplay>
</modal> </Modal>
</FormWrapper> </FormWrapper>
<!-- alternatives --> <!-- alternatives -->
<modal v-model="showAlternatives"> <Modal v-model="showAlternatives">
<QrContentDisplay :qrContent="uri" /> <QrContentDisplay :qrContent="uri" />
</modal> </Modal>
</div> </div>
</UseColorMode> </UseColorMode>
</template> </template>

View File

@@ -465,7 +465,7 @@
</VueFooter> </VueFooter>
</ResponsiveWidthWrapper> </ResponsiveWidthWrapper>
<!-- modal --> <!-- modal -->
<modal v-model="showTwofaccountInModal"> <Modal v-model="showTwofaccountInModal">
<OtpDisplay <OtpDisplay
ref="otpDisplay" ref="otpDisplay"
v-bind="form.data()" v-bind="form.data()"
@@ -473,7 +473,7 @@
@validation-error="" @validation-error=""
@please-close-me="showTwofaccountInModal = false"> @please-close-me="showTwofaccountInModal = false">
</OtpDisplay> </OtpDisplay>
</modal> </Modal>
</div> </div>
</UseColorMode> </UseColorMode>
</template> </template>