From 6fe580d2f11de03b3eb5dd03528fe1c032197e87 Mon Sep 17 00:00:00 2001 From: artem Date: Tue, 24 Dec 2024 19:10:58 +0300 Subject: [PATCH] start public workouts --- src/components/sidebar/AppSidebar.vue | 3 +- src/components/sidebar/NavigationRoutes.ts | 76 +++-- src/i18n/locales/ru.json | 2 +- src/layouts/AppLayout.vue | 4 +- src/main.ts | 15 +- src/pages/workouts/Feed.vue | 125 ++++++++ src/pages/workouts/WorkoutPublicItem.vue | 338 +++++++++++++++++++++ src/router/index.ts | 7 +- 8 files changed, 528 insertions(+), 42 deletions(-) create mode 100644 src/pages/workouts/Feed.vue create mode 100644 src/pages/workouts/WorkoutPublicItem.vue diff --git a/src/components/sidebar/AppSidebar.vue b/src/components/sidebar/AppSidebar.vue index e0ecf3b..b316e9c 100644 --- a/src/components/sidebar/AppSidebar.vue +++ b/src/components/sidebar/AppSidebar.vue @@ -74,6 +74,7 @@ import { useColors } from "vuestic-ui"; import navigationRoutes, { type INavigationRoute } from "./NavigationRoutes"; + export default defineComponent({ name: "Sidebar", props: { @@ -137,7 +138,7 @@ export default defineComponent({ t, iconColor, textColor, - arrowDirection, + arrowDirection }; }, }); diff --git a/src/components/sidebar/NavigationRoutes.ts b/src/components/sidebar/NavigationRoutes.ts index c18d28a..2976cd8 100644 --- a/src/components/sidebar/NavigationRoutes.ts +++ b/src/components/sidebar/NavigationRoutes.ts @@ -4,42 +4,54 @@ export interface INavigationRoute { meta: { icon: string }; children?: INavigationRoute[]; } +const authRoutes = [ + { + name: "dashboard", + displayName: "menu.dashboard", + meta: { + icon: "vuestic-iconset-dashboard", + }, + }, + { + name: 'workouts', + displayName: 'menu.workouts', + meta: { + icon: 'folder_shared', + }, + children: [ + { + name: 'list_workouts', + displayName: 'menu.list_workouts', + children: [ + { + name: 'workout_item', + displayName: 'Тренировка', + }, + ] + }, + { + name: 'upload_workouts', + displayName: 'menu.upload_workouts', + } + ], + }, +] as INavigationRoute[] +const publicRoutes = [ + { + name: "dashboard", + displayName: "menu.dashboard", + meta: { + icon: "vuestic-iconset-dashboard", + }, + }, +] as INavigationRoute[] + +// localStorage.getItem('token') export default { root: { name: "/", displayName: "navigationRoutes.home", }, - routes: [ - { - name: "dashboard", - displayName: "menu.dashboard", - meta: { - icon: "vuestic-iconset-dashboard", - }, - }, - { - name: 'workouts', - displayName: 'menu.workouts', - meta: { - icon: 'folder_shared', - }, - children: [ - { - name: 'list_workouts', - displayName: 'menu.list_workouts', - children: [ - { - name: 'workout_item', - displayName: 'Тренировка', - }, - ] - }, - { - name: 'upload_workouts', - displayName: 'menu.upload_workouts', - } - ], - }, - ] as INavigationRoute[], + routes: localStorage.getItem('token') ? authRoutes : publicRoutes, }; diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index 51fe093..b45259c 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -40,7 +40,7 @@ "auth": "Auth", "buttons": "Buttons", "timelines": "Timelines", - "dashboard": "Статистика", + "dashboard": "Лента", "billing": "Billing", "login": "Login", "preferences": "Настройки Аккаунта", diff --git a/src/layouts/AppLayout.vue b/src/layouts/AppLayout.vue index 5338dd3..e923c39 100644 --- a/src/layouts/AppLayout.vue +++ b/src/layouts/AppLayout.vue @@ -47,7 +47,7 @@ + + + \ No newline at end of file diff --git a/src/pages/workouts/WorkoutPublicItem.vue b/src/pages/workouts/WorkoutPublicItem.vue new file mode 100644 index 0000000..bc993a7 --- /dev/null +++ b/src/pages/workouts/WorkoutPublicItem.vue @@ -0,0 +1,338 @@ + + + + + + \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 91e09d0..114ecc2 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -19,7 +19,7 @@ const routes: Array = [ { name: "dashboard", path: "dashboard", - component: () => import("../pages/admin/dashboard/Dashboard.vue"), + component: () => import("../pages/workouts/Feed.vue"), }, { name: "workouts", @@ -39,6 +39,11 @@ const routes: Array = [ name: "workout_item", path: "workouts/:id", component: () => import("../pages/workouts/WorkoutItem.vue"), + }, + { + name: "workout_public_item", + path: "public/workouts/:id", + component: () => import("../pages/workouts/WorkoutPublicItem.vue"), } ], },