Feat(settings): add renderer for settings configuration #142

Merged
jakob.scheid merged 88 commits from feature/settings-renderer into main 2026-07-28 20:14:50 +02:00
2 changed files with 83 additions and 2 deletions
Showing only changes of commit 139c6f4ef5 - Show all commits
@@ -0,0 +1,73 @@
<!--
Copyright 2026 Seekra
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script setup>
import { useI18n } from 'vue-i18n';
import { getSectionHeadingLevel } from '../utils/getSectionHeadingLevel.js';
const { t } = useI18n();
const props = defineProps({
setting: {
required: true
},
path: {
required: true
},
});
</script>
<template>
<div>
<div role="heading" :aria-level="getSectionHeadingLevel(props.path)" class="section-heading">
{{ t(props.setting.i18n) }}
</div>
<div
v-for="setting in props.setting.content"
class="setting"
:class="{
switch: setting.type === 'bool',
input: setting.type === 'number' || setting.type === 'string',
selection: setting.type === 'selection'
}"
>
</div>
</div>
</template>
<style scoped>
.setting {
margin-bottom: 1.2em;
}
.section-heading {
--size: 1.2em;
font-size: var(--size);
margin-bottom: calc(var(--size) - 0.2em);
}
.section-heading[aria-level="2"] {
--size: 1.8em;
}
.section-heading[aria-level="3"] {
--size: 1.6em;
}
.section-heading[aria-level="4"] {
--size: 1.4em;
}
</style>
+10 -2
View File
@@ -16,6 +16,7 @@ limitations under the License.
<script setup> <script setup>
import LeftSidebarLayout from '@/layouts/LeftSidebarLayout.vue'; import LeftSidebarLayout from '@/layouts/LeftSidebarLayout.vue';
import SettingsPage from '../components/SettingsPage.vue';
import { loadSettingsConfig } from '../utils/settingsParser'; import { loadSettingsConfig } from '../utils/settingsParser';
import { onMounted, ref, watchEffect } from 'vue'; import { onMounted, ref, watchEffect } from 'vue';
@@ -28,7 +29,7 @@ const router = useRouter();
const settingsLoaded = ref(false) const settingsLoaded = ref(false)
const settings = ref([]); const settings = ref([]);
const activeSectionContent = ref([]); const activeSectionContent = ref({});
const activeSection = ref(null); const activeSection = ref(null);
watchEffect(() => { watchEffect(() => {
@@ -80,10 +81,13 @@ onMounted(async () => {
</li> </li>
</ul> </ul>
</template> </template>
<div> <div class="settings-main-content">
<div v-if="!settingsLoaded"> <div v-if="!settingsLoaded">
{{ t('loading') }} {{ t('loading') }}
</div> </div>
<div v-else>
<SettingsPage :setting="activeSectionContent" :path="activeSection" />
</div>
</div> </div>
</LeftSidebarLayout> </LeftSidebarLayout>
</div> </div>
@@ -127,4 +131,8 @@ onMounted(async () => {
font-size: 1rem; font-size: 1rem;
display: block; display: block;
} }
.settings-main-content {
padding: 0 30%;
}
</style> </style>