diff --git a/src/components/ContentView.vue b/src/components/ContentView.vue index b3dde870..c8184f75 100644 --- a/src/components/ContentView.vue +++ b/src/components/ContentView.vue @@ -22,6 +22,7 @@ import { computed, readonly, ref, watch, } from 'vue'; import { useStore } from 'vuex'; +import { useConfigStore } from '../../src/stores/config'; import Notification from '@/components/Notification.vue'; import { request } from '@/utils/http'; import { domParser, delay } from '@/utils'; @@ -34,12 +35,13 @@ const props = defineProps({ const emit = defineEmits(['loading']); const store = useStore(); +const configStore = useConfigStore() const content = ref(''); const errorTextMessage = ref(null); const notificationMessage = readonly(errorTextMessage); -const config = computed(() => store.getters['config/config']); +const config = computed(() => configStore.config); const contentStyle = computed(() => ({ fontSize: `${props.fontSize}px`, })); @@ -118,4 +120,4 @@ function isValidTextContent(text) { .rtl { direction: rtl; } - + \ No newline at end of file diff --git a/src/components/Notification.vue b/src/components/Notification.vue index 69cd8cd9..ab0e1c76 100644 --- a/src/components/Notification.vue +++ b/src/components/Notification.vue @@ -18,6 +18,7 @@ + \ No newline at end of file diff --git a/src/components/TreeView.vue b/src/components/TreeView.vue index 88d99583..41742112 100644 --- a/src/components/TreeView.vue +++ b/src/components/TreeView.vue @@ -48,6 +48,7 @@ import { computed, nextTick, onMounted, ref, watch, } from 'vue'; import { useStore } from 'vuex'; +import { useConfigStore } from '../../src/stores/config'; import { useI18n } from 'vue-i18n'; import { request } from '@/utils/http'; import { isElementVisible } from '@/utils'; @@ -55,6 +56,7 @@ import { isElementVisible } from '@/utils'; const emit = defineEmits(['loading']); const store = useStore(); +const configStore = useConfigStore() const { t } = useI18n(); const expanded = ref({}); @@ -62,7 +64,7 @@ const selected = ref(null); const tree = ref([]); const containerRef = ref(null); -const config = computed(() => store.getters['config/config']); +const config = computed(() => configStore.config); const collectionTitle = computed(() => store.getters['contents/collectionTitle']); const collection = computed(() => store.getters['contents/collection']); const labels = computed(() => (config.value && config.value.labels) || {}); @@ -162,10 +164,11 @@ async function onNodeExpand(node) { } async function onNodeSelect(node) { + const configStore = useConfigStore() if (currentManifest.value.id !== node.parent) { // If we selected an item from a different manifest await store.dispatch('contents/initManifest', node.parent); - await store.dispatch('config/setDefaultActiveViews'); + await configStore.setDefaultActiveViews() } await store.dispatch('contents/initItem', node.key); @@ -204,4 +207,4 @@ function getNodeByKey(key, root) { return root.children.find((child) => !!(getNodeByKey(key, child))); } - + \ No newline at end of file diff --git a/src/components/annotations/AnnotationsView.vue b/src/components/annotations/AnnotationsView.vue index 54c11513..ee1c717a 100644 --- a/src/components/annotations/AnnotationsView.vue +++ b/src/components/annotations/AnnotationsView.vue @@ -28,6 +28,10 @@ import AnnotationsList from '@/components/annotations/AnnotationsList.vue'; import Notification from '@/components/Notification.vue'; import * as AnnotationUtils from '@/utils/annotations'; +import { useConfigStore } from '../../stores/config'; + +const configStore = useConfigStore() + const props = defineProps({ url: String, types: Array, @@ -36,7 +40,7 @@ const props = defineProps({ const store = useStore(); const message = ref('no_annotations_in_view'); -const config = computed(() => store.getters['config/config']); +const config = computed(() => configStore.config); const annotations = computed(() => store.getters['annotations/annotations']); const activeAnnotations = computed(() => store.getters['annotations/activeAnnotations']); const filteredAnnotations = computed(() => store.getters['annotations/filteredAnnotations']); @@ -95,4 +99,4 @@ function highlightTargetsLevel0() { + \ No newline at end of file diff --git a/src/components/base/BaseDropdown.vue b/src/components/base/BaseDropdown.vue index 81117de6..85c6d9d9 100644 --- a/src/components/base/BaseDropdown.vue +++ b/src/components/base/BaseDropdown.vue @@ -18,12 +18,15 @@ + \ No newline at end of file diff --git a/src/components/header/GlobalHeader.vue b/src/components/header/GlobalHeader.vue index dcd98324..d955b9d5 100644 --- a/src/components/header/GlobalHeader.vue +++ b/src/components/header/GlobalHeader.vue @@ -19,6 +19,7 @@ + \ No newline at end of file diff --git a/src/components/header/Language.vue b/src/components/header/Language.vue index 99a65423..b14af5e9 100644 --- a/src/components/header/Language.vue +++ b/src/components/header/Language.vue @@ -22,6 +22,7 @@ import { computed, onMounted, ref, watch, } from 'vue'; import { useStore } from 'vuex'; +import { useConfigStore } from '../../stores/config'; import { useI18n } from 'vue-i18n'; import BaseDropdown from '@/components/base/BaseDropdown.vue'; @@ -31,6 +32,7 @@ interface Language { } const store = useStore(); +const configStore = useConfigStore() const { locale: i18nLocale } = useI18n(); const langs = ref([ @@ -39,7 +41,7 @@ const langs = ref([ ]); const selectedLang = ref(langs.value[0]); const showDropdown = ref(false); -const config = computed(() => store.getters['config/config']); +const config = computed(() => configStore.config); watch( selectedLang, diff --git a/src/components/header/Navbar.vue b/src/components/header/Navbar.vue index 6846a2ca..90ee27bc 100644 --- a/src/components/header/Navbar.vue +++ b/src/components/header/Navbar.vue @@ -26,10 +26,12 @@ + \ No newline at end of file diff --git a/src/components/header/PanelsToggle.vue b/src/components/header/PanelsToggle.vue index 425aefe1..4e850800 100644 --- a/src/components/header/PanelsToggle.vue +++ b/src/components/header/PanelsToggle.vue @@ -63,14 +63,15 @@ import { isMobile } from '@/utils/is-mobile'; import BaseCheckbox from '@/components/base/BaseCheckbox.vue'; import BaseButton from '@/components/base/BaseButton.vue'; import BaseDropdown from '@/components/base/BaseDropdown.vue'; +import { useConfigStore } from '../../stores/config'; const store = useStore(); +const configStore = useConfigStore() const { t } = useI18n(); const toggles = ref([]); const showDropdown = ref(false); - -const panels = computed(() => store.getters['config/config'].panels); +const panels = computed(() => configStore.config.panels ); //store.getters['config/config'].panels); const resetColor = computed(() => (toggles.value.filter(({ show }) => !show).length > 0 ? 'primary' : 'grey-7')); watch( @@ -84,6 +85,7 @@ watch( ); function update(index, show) { + const configStore = useConfigStore() if (show === false) { let numberClosedPanels = 0; // count the number of closed panels, except the current action @@ -103,13 +105,14 @@ function update(index, show) { } toggles.value[index].show = show; - store.dispatch('config/setShowPanel', { index, show }); + configStore.setShowPanel({ index, show }) } function reset() { + const configStore = useConfigStore() toggles.value.forEach((toggle, index) => { toggles.value[index].show = true; - store.dispatch('config/setShowPanel', { index, show: true }); + configStore.setShowPanel({ index, show: true }) }); } @@ -122,4 +125,4 @@ function handleToggleTitle(idx) { ? `${t('hide')} ${titleUpper} Panel` : `${t('show')} ${titleUpper} Panel`; } - + \ No newline at end of file diff --git a/src/components/panels/PanelsWrapper.vue b/src/components/panels/PanelsWrapper.vue index 3c164a4d..844d9daa 100644 --- a/src/components/panels/PanelsWrapper.vue +++ b/src/components/panels/PanelsWrapper.vue @@ -16,22 +16,26 @@ import { computed } from 'vue'; import { useStore } from 'vuex'; +import { useConfigStore } from '../../stores/config'; + import Panel from '@/components/panels/Panel.vue'; const store = useStore(); +const configStore = useConfigStore() + const panels = computed(() => { const { panels } = config.value; return panels; }); -const config = computed(() => store.getters['config/config']); -const activeViews = computed(() => store.getters['config/activeViews']); +const config = computed(() => configStore.config); +const activeViews = computed(() => configStore.activeViews); function onActiveViewChange(viewIndex, panelIndex) { - store.dispatch('config/setActivePanelView', { viewIndex, panelIndex }); + configStore.setActivePanelView(viewIndex, panelIndex) } function getActiveView(panelIndex) { return activeViews.value[panelIndex]; } - + \ No newline at end of file