From c5d9c1275c1df8ad88032be26e377ee3bcac4f92 Mon Sep 17 00:00:00 2001 From: Diyar Akhgar Date: Sun, 1 Jun 2025 01:45:17 +0330 Subject: [PATCH] responsive header and sidebar in mobile and tablet --- xroom-dashboard/src/App.vue | 109 ++-- xroom-dashboard/src/assets/img/logo.png | Bin 8569 -> 9270 bytes xroom-dashboard/src/components/Header.vue | 339 +++++++----- .../src/components/SidebarMenu.vue | 487 ++++++++++++------ 4 files changed, 625 insertions(+), 310 deletions(-) diff --git a/xroom-dashboard/src/App.vue b/xroom-dashboard/src/App.vue index 609fac0..4dbd423 100644 --- a/xroom-dashboard/src/App.vue +++ b/xroom-dashboard/src/App.vue @@ -1,17 +1,17 @@ @@ -61,24 +67,20 @@ export default { computed: { fullName() { const user = JSON.parse(localStorage.getItem('user') || '{}'); - if (user.first_name && user.last_name) { - return `${user.first_name} ${user.last_name}`; - } - return 'کاربر مهمان'; + return user.first_name && user.last_name + ? `${user.first_name} ${user.last_name}` + : 'کاربر مهمان'; }, - profileIcon() { const customer = JSON.parse(localStorage.getItem('customer') || '{}'); - if (customer.profile_img ) { - return `${customer.profile_img}`; - } - - return 'https://c.animaapp.com/m9nvumalUMfQbN/img/frame.svg'; + return customer.profile_img + ? `${customer.profile_img}` + : 'https://c.animaapp.com/m9nvumalUMfQbN/img/frame.svg'; } }, methods: { toggleDropdown() { - console.log("Dropdown toggled"); // This should now appear in console + console.log("Dropdown toggled"); this.showDropdown = !this.showDropdown; }, logout() { @@ -90,10 +92,13 @@ export default { if (!this.$el.contains(event.target)) { this.showDropdown = false; } + }, + toggleSidebar() { + this.$emit('toggle-sidebar'); } }, mounted() { - console.log("Component mounted"); // Check if this appears + console.log("Component mounted"); document.addEventListener('click', this.closeDropdown); }, beforeUnmount() { @@ -103,25 +108,23 @@ export default { \ No newline at end of file diff --git a/xroom-dashboard/src/components/SidebarMenu.vue b/xroom-dashboard/src/components/SidebarMenu.vue index 04b29b7..55f9fd0 100644 --- a/xroom-dashboard/src/components/SidebarMenu.vue +++ b/xroom-dashboard/src/components/SidebarMenu.vue @@ -1,88 +1,94 @@ - \ No newline at end of file