Files
traxxx-web/components/settings/settings.vue

142 lines
2.4 KiB
Vue

<script setup>
// this component is set up as a generic settings panel, but as most account settings will be handled through the profile page, it is parading as a dedicated filters dialog
import { inject, ref } from 'vue';
import Dialog from '#/components/dialog/dialog.vue';
import Filters from '#/components/settings/filters.vue';
import Notifications from '#/components/settings/notifications.vue';
defineProps({
showNavigation: {
type: Boolean,
default: false,
},
});
const pageContext = inject('pageContext');
const { user } = pageContext;
const activeSection = ref('filters');
</script>
<template>
<Dialog
title="Filters"
class="settings-dialog"
>
<div class="dialog-body">
<ul
v-if="!activeSection"
class="sections"
>
<li
class="section"
@click="activeSection = 'filters'"
>
<Icon icon="filter" />
Filters
</li>
<li
v-if="user"
class="section"
@click="activeSection = 'notifications'"
>
<Icon icon="bell2" />
Notifications
</li>
</ul>
<div
v-else-if="showNavigation"
class="section-header"
>
<span
class="section-back"
@click="activeSection = null"
><Icon icon="arrow-left3" />Back to overview</span>
<strong class="section-label">{{ activeSection }}</strong>
</div>
<Filters v-if="activeSection === 'filters'" />
<Notifications v-if="activeSection === 'notifications'" />
</div>
</Dialog>
</template>
<style scoped>
.dialog-body {
width: 30rem;
flex-grow: 1;
max-width: 100%;
box-sizing: border-box;
overflow-y: auto;
}
.dialog-section {
padding: 1rem;
}
.sections {
padding: 0;
margin: 0;
}
.section {
display: flex;
align-items: center;
gap: 1rem;
padding: 1rem;
border-radius: .25rem;
font-size: 1.1rem;
.icon {
fill: var(--glass-strong-10);
transform: translateY(-1px);
}
&:hover {
color: var(--primary);
cursor: pointer;
.icon {
fill: var(--primary);
}
}
}
.section-header {
display: flex;
justify-content: space-between;
box-shadow: 0 0 3px var(--shadow-weak-30);
}
.section-back {
display: flex;
align-items: center;
gap: 1rem;
padding: .75rem 1rem;
.icon {
fill: var(--glass);
transform: translateY(-1px);
}
&:hover {
color: var(--primary);
cursor: pointer;
.icon {
fill: var(--primary);
}
}
}
.section-label {
color: var(--primary);
text-transform: capitalize;
padding: .75rem 1rem;
}
</style>