diff --git a/index.html b/index.html index 5fa6ce98..a1dfb25c 100644 --- a/index.html +++ b/index.html @@ -12,12 +12,11 @@
- - - - + - diff --git a/src/app/providers/store/index.ts b/src/app/providers/store/index.ts index a41646cc..a3c238c6 100755 --- a/src/app/providers/store/index.ts +++ b/src/app/providers/store/index.ts @@ -7,7 +7,6 @@ import { settingsStore } from "@/widgets/settings"; import { webApiStore, authStore } from "@/shared/api/webAPI"; import { snackbarStore } from "@/widgets/snackbar"; import notesStore from "@/widgets/notesPanel/model/store/notes.module"; -import contextMenuStore from "@/entities/contextMenu/model/store/contextMenu.module"; export default new Store({ modules: { explorerStore, @@ -18,6 +17,5 @@ export default new Store({ snackbarStore, authStore, notesStore, - contextMenuStore, }, }); diff --git a/src/entities/contextMenu/contextMenu.vue b/src/entities/contextMenu/contextMenu.vue index 637a0637..0ba09263 100644 --- a/src/entities/contextMenu/contextMenu.vue +++ b/src/entities/contextMenu/contextMenu.vue @@ -13,8 +13,7 @@ diff --git a/src/entities/contextMenu/model/store/actions.type.ts b/src/entities/contextMenu/model/store/actions.type.ts deleted file mode 100644 index b426ec93..00000000 --- a/src/entities/contextMenu/model/store/actions.type.ts +++ /dev/null @@ -1 +0,0 @@ -export const OPEN_MENU = "openMenu"; diff --git a/src/entities/contextMenu/model/store/contextMenu.module.ts b/src/entities/contextMenu/model/store/contextMenu.module.ts deleted file mode 100644 index d1e23268..00000000 --- a/src/entities/contextMenu/model/store/contextMenu.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { SET_LOCATION } from "@/entities/contextMenu/model/store/mutations.type"; -import { SET_CONTEXT_MENU_VISIBILITY } from "@/entities/contextMenu/model/store/mutations.type"; -import { OPEN_MENU } from "@/entities/contextMenu/model/store/actions.type"; - -const state = { - visible: false, - location: {}, -}; - -const getters = { - getContextMenuVisibility: function (state) { - return state.visible; - }, - getContextMenuLocation: function (state) { - return state.location; - }, -}; - -const actions = { - [OPEN_MENU]({ commit }, payload) { - commit(SET_LOCATION, payload.location); - commit(SET_CONTEXT_MENU_VISIBILITY, payload.visibility); - }, -}; - -const mutations = { - [SET_LOCATION](state, payload) { - state.location = payload; - }, - [SET_CONTEXT_MENU_VISIBILITY](state, payload) { - state.visible = payload; - }, -}; - -export default { - state, - getters, - actions, - mutations, -}; diff --git a/src/entities/contextMenu/model/store/mutations.type.ts b/src/entities/contextMenu/model/store/mutations.type.ts deleted file mode 100644 index dc436d3b..00000000 --- a/src/entities/contextMenu/model/store/mutations.type.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const SET_LOCATION = "setLocation"; -export const SET_CONTEXT_MENU_VISIBILITY = "setContextMenuVisibility"; diff --git a/src/main.ts b/src/main.ts index a08b9ba7..b34835d1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,7 +10,6 @@ import { authActions } from "@/shared/api/webAPI"; import PrimeVue from "primevue/config"; import ToastService from "primevue/toastservice"; -//todo: Think how to improve auth import { settingsActions } from "@/widgets/settings"; import "primeicons/primeicons.css"; import clickOutside from "@/shared/lib/directives/clickOutside"; @@ -21,37 +20,62 @@ import ConfirmationService from "primevue/confirmationservice"; import resize from "@/shared/lib/directives/resize"; import { errorActions } from "@/widgets/error"; import errorMessages from "@/widgets/error/model/config/errorMessages"; -// adds reactive router module to global state +// adds reactive router module to global state sync(store, router); -environment.load().then(() => { - store - .dispatch(authActions.GET_AUTH_TOKEN) - .then(() => store.dispatch(authActions.GET_USER)) + +async function initializeEnvironment() { + await environment.load(); +} + +async function initializeAuth() { + await store.dispatch(authActions.GET_AUTH_TOKEN); + await store.dispatch(authActions.GET_USER); +} + +async function initializeSettings() { + await store.dispatch(settingsActions.LOAD_SETTINGS_FROM_STORAGE); +} + +function initializeErrorHandler(app) { + app.config.errorHandler = (err) => { + // Handle the error globally + store.dispatch(errorActions.NEW_ERROR, { + userMessage: errorMessages.technicalError.codeError, + name: err.name, + details: err.message, + stack: err.stack, + type: "unexpected", + }); + }; +} + +function initializeDirectives(app) { + app + .directive("click-outside", clickOutside) + .directive("resize", resize) + .directive("tooltip", Tooltip); +} + +function initializePlugins(app) { + app + .use(store) + .use(router) + .use(PrimeVue, { pt: tailwindTheme }) + .use(ConfirmationService) + .use(ToastService); +} + +initializeEnvironment().then(() => { + initializeAuth() .catch() .finally(() => { - store.dispatch(settingsActions.LOAD_SETTINGS_FROM_STORAGE).then(() => { + initializeSettings().then(() => { const app = createApp(App); - app.config.errorHandler = (err) => { - // Handle the error globally - store.dispatch(errorActions.NEW_ERROR, { - userMessage: errorMessages.technicalError.codeError, - name: err.name, - details: err.message, - stack: err.stack, - type: "unexpected", - }); - }; - app - .directive("click-outside", clickOutside) - .directive("resize", resize) - .directive("tooltip", Tooltip) - .use(store) - .use(router) - .use(PrimeVue, { pt: tailwindTheme }) - .use(ConfirmationService) - .use(ToastService) - .mount("#app"); + initializeErrorHandler(app); + initializeDirectives(app); + initializePlugins(app); + app.mount("#app"); }); }); }); diff --git a/src/pages/model/lib/listeners.ts b/src/pages/model/lib/listeners.ts index aea96618..33ddf032 100644 --- a/src/pages/model/lib/listeners.ts +++ b/src/pages/model/lib/listeners.ts @@ -1,17 +1,17 @@ export const setSelectionAreaSignal = function ( view, - store, - annotationsParentElement, - brushParentElement, - createAnnotations, - makeAnnotations, - createTooltip, - createBrush + { annotationsParentElement, brushParentElement }, + { + renderAnnotations, + initializeAnnotationsInstance, + initializeTooltip, + initializeBrush, + } ) { return view.addSignalListener("brush", () => { - const annotations = makeAnnotations(view); - createAnnotations(view, annotations, annotationsParentElement); - createTooltip(view); - createBrush(view, brushParentElement); + const annotations = initializeAnnotationsInstance(view); + renderAnnotations(annotations, annotationsParentElement); + initializeTooltip(view); + initializeBrush(view, brushParentElement); }); }; diff --git a/src/pages/reports/network/NetworkConceptDashboard/NetworkConceptDashboard.vue b/src/pages/reports/network/NetworkConceptDashboard/NetworkConceptDashboard.vue index 69743b0b..d639ad90 100644 --- a/src/pages/reports/network/NetworkConceptDashboard/NetworkConceptDashboard.vue +++ b/src/pages/reports/network/NetworkConceptDashboard/NetworkConceptDashboard.vue @@ -1,7 +1,7 @@