feat: implement "hash navigation" for settings

This commit is contained in:
Twig 2025-07-05 17:05:40 +02:00
parent 768b011961
commit c03f72cecc
No known key found for this signature in database

View file

@ -40,10 +40,10 @@
<script lang="ts" setup>
import { onMounted } from 'vue';
import Button from '~/components/Button.vue';
const { logout } = useAuth()
const appConfig = useRuntimeConfig()
interface Page {
@ -99,6 +99,16 @@ function selectCategory(page: Page) {
selectedPage.value = page.displayName;
};
// redirects to you privacy if you go to settings#privacy
onMounted(() => {
const hash = window.location.hash.substring(1).toLowerCase();
const foundPage = categories.flatMap(category => category.pages).find(page => page.displayName.toLowerCase() === hash);
if (foundPage) {
currentPage.value = foundPage;
selectedPage.value = foundPage.displayName;
}
});
</script>
<style scoped>