Skip to content

Commit 6131568

Browse files
committed
simplified duplication in tour manager when modal is open
1 parent f041efe commit 6131568

File tree

5 files changed

+10
-75
lines changed

5 files changed

+10
-75
lines changed

src/components/NimiqSelector.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,3 @@ export default defineComponent({
318318
}
319319
}
320320
</style>
321-
322-
function scrollIntoView() {
323-
throw new Error('Function not implemented.');
324-
}

src/components/Tour.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -658,17 +658,12 @@ export default defineComponent({
658658
// updated as data attributes allow to use a value like [data-opaified="1"] to select ceratain elements
659659
// as well as [data-opacified] to all elements with this attribute. @see _removeUIFromOldStep
660660
661-
#app[data-tour-active] [data-opacified],
662-
#app[data-tour-active] ~ div [data-opacified] {
661+
#app[data-tour-active] [data-opacified] {
663662
filter: opacity(0.3);
664663
}
665664
666665
#app[data-tour-active] [data-non-interactable],
667-
#app[data-tour-active] [data-non-interactable] *,
668-
// Select also modals which are not children of #app but siblings
669-
#app[data-tour-active] ~ div [data-non-interactable],
670-
#app[data-tour-active] ~ div [data-non-interactable] *
671-
{
666+
#app[data-tour-active] [data-non-interactable] *{
672667
user-select: none !important;
673668
pointer-events: none !important;
674669
cursor: not-allowed;

src/components/TourLargeScreenManager.vue

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
</template>
1616

1717
<script lang="ts">
18-
import { ITourBroadcast, ITourBroadcastStepChanged, TourStepIndex, IWalletHTMLElements } from '@/lib/tour';
19-
import { defineComponent, onMounted, onUnmounted, Ref, ref } from '@vue/composition-api';
18+
import { ITourBroadcast, ITourBroadcastStepChanged, TourStepIndex } from '@/lib/tour';
19+
import { defineComponent, onMounted, Ref, ref } from '@vue/composition-api';
2020
2121
export default defineComponent({
2222
name: 'tour-large-screen-manager',
@@ -36,72 +36,15 @@ export default defineComponent({
3636
3737
onMounted(async () => {
3838
show.value = true;
39-
setTimeout(() => _checkIfModalIsOpen(), 2000);
4039
});
4140
42-
onUnmounted(() => _removeClonedManager());
43-
4441
async function _stepChanged(
4542
{ nSteps: newNSteps, currentStep: newCurrentStep }: ITourBroadcastStepChanged['payload']) {
4643
nSteps.value = newNSteps;
4744
currentStep.value = newCurrentStep;
48-
49-
await context.root.$nextTick();
50-
51-
_checkIfModalIsOpen();
52-
}
53-
54-
function _checkIfModalIsOpen() {
55-
const modalIsOpen = document.querySelector(IWalletHTMLElements.MODAL_CONTAINER) !== null;
56-
if (modalIsOpen) {
57-
_duplicateManager();
58-
} else {
59-
_removeClonedManager();
60-
}
61-
}
62-
63-
// remove the cloned manager if it exists due to a modal not being open anymore
64-
// see _duplicateManager()
65-
function _removeClonedManager() {
66-
const tourManager = document.querySelector('body > .tour-manager');
67-
if (tourManager) {
68-
tourManager.remove();
69-
}
70-
const original = $originalManager.value!;
71-
if (!original) return;
72-
original.style.visibility = 'initial';
73-
}
74-
75-
// at some steps, a modal will be openened in the tour and we still need to show the tour
76-
// manager to the user, therefore, we need to duplicate the manager and set it to the body
77-
// positionated over the modal
78-
function _duplicateManager() {
79-
_removeClonedManager();
80-
const original = $originalManager.value!;
81-
if (!original) return;
82-
83-
original.style.visibility = 'hidden';
84-
85-
const manager = original.cloneNode(true) as HTMLDivElement;
86-
87-
if (!manager) {
88-
return;
89-
}
90-
91-
manager.style.position = 'absolute';
92-
manager.style.top = `${original.offsetTop}px`;
93-
manager.style.left = `${original.offsetLeft}px`;
94-
manager.style.width = `${original.offsetWidth}px`;
95-
manager.style.height = `${original.offsetHeight}px`;
96-
manager.style.visibility = 'inherit';
97-
manager.style.zIndex = '10';
98-
document.body.appendChild(manager);
99-
100-
manager.querySelector('button')!.addEventListener('click', () => endTour());
10145
}
10246
10347
function endTour(emit = true) {
104-
_removeClonedManager();
10548
show.value = false;
10649
if (emit) {
10750
// Notify tour component through root instance event bus
@@ -134,6 +77,7 @@ export default defineComponent({
13477
.tour-manager {
13578
width: 100%;
13679
overflow: hidden;
80+
z-index: 10;
13781
13882
margin-bottom: 2rem;
13983

src/components/modals/Modal.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
</template>
2929

3030
<script lang="ts">
31-
import { computed, defineComponent, onMounted, onUnmounted, Ref, ref, watch } from '@vue/composition-api';
32-
import { SmallPage, CloseButton } from '@nimiq/vue-components';
3331
import { useKeys } from '@/composables/useKeys';
34-
import { useWindowSize } from '../../composables/useWindowSize';
32+
import { CloseButton, SmallPage } from '@nimiq/vue-components';
33+
import { computed, defineComponent, onMounted, Ref, ref, watch } from '@vue/composition-api';
3534
import { useSwipes } from '../../composables/useSwipes';
36-
import { useSettingsStore } from '../../stores/Settings';
35+
import { useWindowSize } from '../../composables/useWindowSize';
3736
import { pointerdown } from '../../directives/PointerEvents';
37+
import { useSettingsStore } from '../../stores/Settings';
3838
3939
export function enableModalTransition() {
4040
document.body.classList.remove('modal-transition-disabled');

src/components/modals/WelcomeModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Modal class="welcome-modal" :showCloseButton="false">
33
<!-- Nimiq SVG logo cropped in the top left corner -->
44
<svg class="nimiq-logo-background" width="128" height="114" fill="none" xmlns="http://www.w3.org/2000/svg">
5-
<path opacity=".05"
5+
<path opacity=".04"
66
d="m125.33 1.34-48.5-83.68A19.42 19.42 0 0 0 60-92h-97.02c-6.79 0-13.26 3.54-16.81 9.66l-48.51 83.68a18.81
77
18.81 0 0 0 0 19.32l48.5 83.68A19.43 19.43 0 0 0-37 114h97.02c6.79 0 13.26-3.54 16.81-9.66l48.51-83.68a18.81
88
18.81 0 0 0 0-19.32Z"

0 commit comments

Comments
 (0)