fix: collapse sidebar by default on small screens

This commit is contained in:
2026-05-04 16:40:43 -04:00
parent 8f4b95f311
commit 552f4f1f21
2 changed files with 22 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
# Responsive Sidebar Default
## Goal
Collapse the authenticated app sidebar by default on smaller devices while preserving the existing desktop expanded default and manual toggle behavior.
## Relevant Files
- `frontend/src/App.vue`
- `frontend/src/layouts/main/AppSidebar.vue`
## Validation
```bash
cd frontend
npm run build
```

View File

@@ -34,6 +34,7 @@
<script async setup>
import { computed, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useDisplay } from 'vuetify';
import { useAuthStore } from '@/features/auth/stores/authStore.js';
import { mdiChevronLeft, mdiChevronRight } from '@mdi/js';
import AppBar from '@/layouts/main/AppBar.vue';
@@ -42,7 +43,9 @@
const route = useRoute();
const authStore = useAuthStore();
const isSidebarExpanded = ref(true);
const { smAndDown } = useDisplay();
const defaultSidebarExpanded = computed(() => !smAndDown.value);
const isSidebarExpanded = ref(defaultSidebarExpanded.value);
const showsAppSidebar = computed(() =>
authStore.isAuthenticated && route.path.startsWith('/app')
@@ -54,7 +57,7 @@
return;
}
isSidebarExpanded.value = true;
isSidebarExpanded.value = defaultSidebarExpanded.value;
}, { immediate: true });
</script>