From 7d0b5333449cccda519241ce739105e8b7b3418b Mon Sep 17 00:00:00 2001 From: Djhonantan Parreira <102682671+djhonantanparreira@users.noreply.github.com> Date: Fri, 27 Sep 2024 21:29:40 -0300 Subject: [PATCH] refactor: remove unused routes and components from sidebar navigation --- .gitignore | 1 + src/App.vue | 1 - src/components/dashboard/Sidebar.vue | 13 +++--- src/router/index.js | 9 ----- src/views/dashboard/DashboardView.vue | 58 --------------------------- 5 files changed, 8 insertions(+), 74 deletions(-) delete mode 100644 src/views/dashboard/DashboardView.vue diff --git a/.gitignore b/.gitignore index 75410cb..d979b98 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ dist dist-ssr coverage *.local +.env /cypress/videos/ /cypress/screenshots/ diff --git a/src/App.vue b/src/App.vue index 7e7900e..62f5f62 100644 --- a/src/App.vue +++ b/src/App.vue @@ -32,7 +32,6 @@ const snackbarStore = useSnackbarStore() const route = useRoute() const sideMenuRoutes = [ - '/dashboard', '/profile', '/onboarding', '/products', diff --git a/src/components/dashboard/Sidebar.vue b/src/components/dashboard/Sidebar.vue index bce3dfa..3a69cb7 100644 --- a/src/components/dashboard/Sidebar.vue +++ b/src/components/dashboard/Sidebar.vue @@ -14,7 +14,7 @@ - + @@ -144,6 +144,7 @@ import { ref, computed } from 'vue' import { useRouter } from 'vue-router' import { useAuthStore } from '@/stores/auth.js' +import { useProductStore } from '@/stores/product' import DiscordIcon from '@/components/icons/DiscordIcon.vue' import imgUrl from '@/assets/logo-white-transparent.png' import defaultAvatar from '@/assets/default-avatar.png' @@ -160,7 +161,7 @@ const logged = computed(() => auth.getName() !== '') const navigateToHome = () => router.push({ name: 'home' }) const userRole = computed(() => { - return auth.auth.user_type === 'admin' ? 'Admin' : 'Founder' + return auth.auth.user_type === 'Admin' ? 'Admin' : 'Admin' }) const userProfileLink = computed(() => `/profile`) @@ -173,12 +174,12 @@ const logout = () => { router.push({ name: 'home' }) } -const toggleProducts = () => { - productsExpanded.value = !productsExpanded.value +const navigateToProduct = (uuid) => { + router.push({ name: 'product-by-id', params: { uuid: auth.getProduct().uuid } }) } -const navigateToProduct = (uuid) => { - router.push({ name: 'product', params: { uuid } }) +const navigateToSquad = (uuid) => { + router.push({ name: 'squads', params: { uuid: auth.getSquad().uuid } }) } onMounted(async () => { diff --git a/src/router/index.js b/src/router/index.js index bee5698..b60b8f8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -17,10 +17,6 @@ import SquadCreateView from '../views/squad/CreateView.vue' import { useAuthStore } from '@/stores/auth'; -// dashboard -import DashboardView from '@/views/dashboard/DashboardView.vue' - - const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ @@ -136,11 +132,6 @@ const router = createRouter({ name: 'not-found', component: () => import('../views/NotFoundView.vue') }, - { - path: '/dashboard', - name: 'dashboard', - component: DashboardView - }, ] }) diff --git a/src/views/dashboard/DashboardView.vue b/src/views/dashboard/DashboardView.vue deleted file mode 100644 index bfa707e..0000000 --- a/src/views/dashboard/DashboardView.vue +++ /dev/null @@ -1,58 +0,0 @@ - - - - -