poprawki do popupów

This commit is contained in:
2024-03-23 16:47:57 +01:00
parent 6b6b837dde
commit 1ec75bda70
9 changed files with 104 additions and 60 deletions
+24
View File
@@ -48,6 +48,7 @@ import StorageManager from './managers/storageManager';
import PopUp from './components/PopUp/PopUp.vue';
import { useApiStore } from './store/apiStore';
import { Status } from './typings/common';
import { usePopupStore } from './store/popupStore';
const STORAGE_VERSION_KEY = 'app_version';
@@ -64,6 +65,7 @@ export default defineComponent({
VERSION: version,
store: useMainStore(),
apiStore: useApiStore(),
popupStore: usePopupStore(),
currentLang: 'pl',
releaseURL: '',
@@ -81,6 +83,28 @@ export default defineComponent({
this.apiStore.fetchActiveData();
});
// popup handling
window.addEventListener('mousemove', (e: MouseEvent) => {
e.stopPropagation();
const targetEl = e
.composedPath()
.find((p) => p instanceof HTMLElement && p.getAttribute('data-popup-key'));
if (!targetEl || !(targetEl instanceof HTMLElement)) {
if (this.popupStore.currentPopupComponent != null) this.popupStore.onPopUpHide();
return;
}
const popupComponentKey = targetEl.getAttribute('data-popup-key');
const popupContent = targetEl.getAttribute('data-popup-content');
if (popupComponentKey && popupContent)
this.popupStore.onPopUpShow(e, popupComponentKey, popupContent);
else if (this.popupStore.currentPopupComponent != null) this.popupStore.onPopUpHide();
});
watch(
() => this.store.blockScroll,
(value) => {