feat(settings): make active section content reactive

This commit is contained in:
2026-06-06 01:52:10 +02:00
parent 42ff52a4de
commit 4738f59a00
+14 -1
View File
@@ -18,7 +18,7 @@ limitations under the License.
import LeftSidebarLayout from '@/layouts/LeftSidebarLayout.vue';
import { loadSettingsConfig } from '../utils/settingsParser';
import { onMounted, ref } from 'vue';
import { onMounted, ref, watchEffect } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
@@ -28,12 +28,25 @@ const router = useRouter();
const settingsLoaded = ref(false)
const settings = ref([]);
const activeSectionContent = ref([]);
const updateSettings = function updateSettings () {
const activeSection = getActiveSection();
if (activeSection) {
activeSectionContent.value = settings.value.filter((section) => section.name === activeSection)[0].content;
} else {
activeSectionContent.value = [];
};
};
onMounted(async () => {
settings.value = (await loadSettingsConfig()).contents;
if (!settings.value.map((section) => section.name).includes(getActiveSection())) {
router.push('/settings');
};
watchEffect(() => {
updateSettings();
});
settingsLoaded.value = true;
});