Skip to content

Commit 88b1e49

Browse files
committed
feat: enhance DashboardLayout and GlobalSettings components with improved sidebar and layout adjustments
1 parent 65909a1 commit 88b1e49

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

services/frontend/src/components/DashboardLayout.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script setup lang="ts">
22
import { computed } from 'vue'
33
import type { StyleValue } from 'vue'
4-
import { SidebarProvider, SidebarInset, SidebarTrigger } from '@/components/ui/sidebar' // Assuming SidebarTrigger might be needed
4+
import { SidebarProvider, SidebarInset, SidebarTrigger } from '@/components/ui/sidebar'
5+
import { Separator } from '@/components/ui/separator'
56
import AppSidebar from '@/components/AppSidebar.vue'
67

78
interface Props {
@@ -28,15 +29,17 @@ const sidebarStyle = computed(() => ({
2829
<template>
2930
<SidebarProvider :default-open="defaultOpen" :style="sidebarStyle">
3031
<AppSidebar variant="inset" />
31-
<SidebarInset>
32+
<SidebarInset class="px-5">
3233
<!-- SiteHeader equivalent -->
3334
<header class="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12">
3435
<div class="flex items-center gap-2 px-4">
3536
<SidebarTrigger class="-ml-1" />
3637
<h1 class="text-lg font-semibold md:text-xl">{{ props.title }}</h1>
3738
</div>
3839
</header>
39-
40+
41+
<Separator class="my-6" />
42+
4043
<!-- Content area -->
4144
<div class="flex flex-1 flex-col gap-4 p-4 pt-0">
4245
<slot />
@@ -76,7 +79,7 @@ const sidebarStyle = computed(() => ({
7679
border-radius: 0.75rem;
7780
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
7881
}
79-
82+
8083
/* Ensure the sidebar spacer works */
8184
.group\/sidebar-wrapper .group.peer {
8285
flex-shrink: 0;

services/frontend/src/components/settings/GlobalSettingsSidebarNav.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { computed } from 'vue'
3-
import { useRoute } from 'vue-router'
3+
import { useRoute, RouterLink } from 'vue-router'
44
import { cn } from '@/lib/utils'
55
import { Button } from '@/components/ui/button' // Adjusted path assuming shadcn/ui components are in @/components/ui
66

@@ -31,7 +31,7 @@ const props = defineProps<{
3131
groups: GlobalSettingGroup[]
3232
}>()
3333

34-
const $route = useRoute()
34+
const route = useRoute()
3535

3636
const sidebarNavItems = computed((): NavItem[] => {
3737
return props.groups.map(group => ({
@@ -50,15 +50,16 @@ const sidebarNavItems = computed((): NavItem[] => {
5050
<Button
5151
v-for="item in sidebarNavItems"
5252
:key="item.title"
53-
as="router-link"
54-
:to="item.href"
53+
as-child
5554
variant="ghost"
5655
:class="cn(
5756
'w-full text-left justify-start',
58-
$route.path === item.href && 'bg-muted hover:bg-muted',
57+
route.path === item.href && 'bg-muted hover:bg-muted',
5958
)"
6059
>
61-
{{ item.title }}
60+
<RouterLink :to="item.href">
61+
{{ item.title }}
62+
</RouterLink>
6263
</Button>
6364
</nav>
6465
</template>

services/frontend/src/views/GlobalSettings.vue

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
import { ref, onMounted, computed, watch } from 'vue'
33
import { useRoute } from 'vue-router'
44
import { useI18n } from 'vue-i18n'
5-
import { Separator } from '@/components/ui/separator' // Adjusted path
65
import GlobalSettingsSidebarNav, { type GlobalSettingGroup } from '@/components/settings/GlobalSettingsSidebarNav.vue'
7-
import DashboardLayout from '@/components/DashboardLayout.vue' // Reinstated
6+
import DashboardLayout from '@/components/DashboardLayout.vue'
87
import { getEnv } from '@/utils/env'
98
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
10-
import { CheckCircle2Icon, XIcon } from 'lucide-vue-next' // Added XIcon
9+
import { CheckCircle2Icon, XIcon } from 'lucide-vue-next'
1110

1211
const { t } = useI18n()
1312
const route = useRoute()
@@ -212,7 +211,7 @@ async function handleSaveChanges() {
212211

213212
<template>
214213
<DashboardLayout :title="t('globalSettings.title')">
215-
<div class="hidden space-y-6 p-10 pb-16 md:block">
214+
<div class="hidden space-y-6 pb-16 md:block">
216215
<Alert v-if="showSuccessAlert" variant="default" class="mb-4 border-green-500 bg-green-50 text-green-700 relative">
217216
<CheckCircle2Icon class="h-5 w-5 text-green-600" />
218217
<AlertTitle class="font-semibold text-green-800">{{ t('globalSettings.alerts.successTitle') }}</AlertTitle>
@@ -230,15 +229,7 @@ async function handleSaveChanges() {
230229
</Button>
231230
</Alert>
232231

233-
<div class="space-y-0.5">
234-
<h2 class="text-2xl font-bold tracking-tight">
235-
{{ t('globalSettings.title') }}
236-
</h2>
237-
<p class="text-muted-foreground">
238-
{{ t('globalSettings.description') }}
239-
</p>
240-
</div>
241-
<Separator class="my-6" />
232+
242233
<div class="flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0">
243234
<aside class="-mx-4 lg:w-1/5">
244235
<GlobalSettingsSidebarNav :groups="settingGroups" />
@@ -255,7 +246,6 @@ async function handleSaveChanges() {
255246
{{ selectedGroup.description }}
256247
</p>
257248
</div>
258-
<Separator />
259249
<form v-if="editableSettings.length > 0" class="space-y-6" @submit.prevent="handleSaveChanges">
260250
<div v-for="(setting, index) in editableSettings" :key="setting.key" class="space-y-2">
261251
<Label :for="`setting-${setting.key}`">{{ setting.description || setting.key }}</Label>

0 commit comments

Comments
 (0)