diff --git a/app/src/assets/Bonn_Capitals_Insignia.png b/app/src/assets/Bonn_Capitals_Insignia.png new file mode 100644 index 0000000..cbe54f4 Binary files /dev/null and b/app/src/assets/Bonn_Capitals_Insignia.png differ diff --git a/app/src/router/index.ts b/app/src/router/index.ts index 9f3ec75..7712f0a 100644 --- a/app/src/router/index.ts +++ b/app/src/router/index.ts @@ -1,45 +1,24 @@ import { createRouter, createWebHistory } from '@ionic/vue-router'; +import { useStore } from 'vuex' import { RouteRecordRaw } from 'vue-router'; import PitcherList from '../views/PitcherList.vue' -import Login from '../views/Login.vue' -import Home from '../views/Home.vue' +import LoginView from '../views/LoginView.vue' +import HomeView from '../views/HomeView.vue' import PreparePitch from "@/views/PreparePitch.vue"; import FinalizePitch from "@/views/FinalizePitch.vue"; import BullpenStats from "@/views/BullpenStats.vue"; +import SetupView from '@/views/SetupView.vue'; const routes: Array = [ - { - path: '/', - redirect: '/login' - }, { - path: '/login', - name: 'Login', - component: Login - }, { - path: '/home', - name: 'Home', - component: Home - }, { - path: '/pitchers', - name: 'Pitchers', - component: PitcherList - }, { - path: '/bullpen', - name: 'PreparePitch', - component: PreparePitch - }, { - path: '/prepare', - name: 'PreparePitch', - component: PreparePitch - }, { - path: '/finalize', - name: 'FinalizePitch', - component: FinalizePitch - }, { - path: '/stats', - name: 'BullpenStats', - component: BullpenStats - } + { path: '/', redirect: '/login' }, + { path: '/login', component: LoginView }, + { path: '/setup', component: SetupView }, + { path: '/home', component: HomeView }, + { path: '/pitchers', component: PitcherList }, + { path: '/bullpen', component: PreparePitch }, + { path: '/prepare', component: PreparePitch }, + { path: '/finalize', component: FinalizePitch }, + { path: '/stats', component: BullpenStats } ] const router = createRouter({ @@ -47,4 +26,24 @@ const router = createRouter({ routes }) +router.beforeEach((to, from, next) => { + const store = useStore(); + const serverAddress = localStorage.getItem('serverAddress'); + const isAuthenticated = store.state.auth.isAuthenticated; + + if (to.meta.requiresAuth && !isAuthenticated) { + return next('/login'); + } + + if (!serverAddress && to.path !== '/setup') { + return next('/setup'); + } + + if (serverAddress && to.path === '/setup') { + return next('/login'); + } + + next(); +}); + export default router diff --git a/app/src/theme/variables.css b/app/src/theme/variables.css index 131c419..65ef35b 100644 --- a/app/src/theme/variables.css +++ b/app/src/theme/variables.css @@ -1,2 +1,50 @@ /* For information on how to create your own theme, please see: http://ionicframework.com/docs/theming/ */ +/*:root {*/ +/* --ion-background-color: #7c3b6a;*/ +/* --ion-text-color: white;*/ +/* --ion-tab-bar-background: #7c3b6a;*/ +/* --ion-toolbar-background: #7c3b6a;;*/ +/* --ion-toolbar-color: white;*/ +/*}*/ + +.custom-back { + + background-color: rgba(255, 255, 255, 0.1) !important; + border-radius: 5px; + font-size: 0.8rem; + padding-left: 0.75rem; + padding-right: 0.75rem; +} + +.custom-button { + + --border-radius: 5px !important; + --background: rgb(236, 149, 35); + --background-activated: rgb(192, 125, 38); + --background-focused: rgb(192, 125, 38); + font-size: 1.2rem; + margin-top: 1rem; +} + +.custom-input { + + --background: #834e76; + --padding-bottom: 1rem; + --padding-top: 1rem; + --padding-start: 1rem; + --padding-end: 1rem; + border-radius: 10px !important; + margin-top: 0.25rem; + transition: all 0.2s linear; +} + +.ion-label { + padding-left: 0.2rem; + padding-right: 0.5rem; + color: #d3a6c7; + display: flex; + justify-content: space-between; + align-content: center; + align-items: center; +} diff --git a/app/src/views/Home.vue b/app/src/views/HomeView.vue similarity index 100% rename from app/src/views/Home.vue rename to app/src/views/HomeView.vue diff --git a/app/src/views/Login.vue b/app/src/views/Login.vue deleted file mode 100644 index 306a3da..0000000 --- a/app/src/views/Login.vue +++ /dev/null @@ -1,146 +0,0 @@ - - - - - diff --git a/app/src/views/LoginView.vue b/app/src/views/LoginView.vue new file mode 100644 index 0000000..a59657f --- /dev/null +++ b/app/src/views/LoginView.vue @@ -0,0 +1,240 @@ + + + + + diff --git a/app/src/views/SetupView.vue b/app/src/views/SetupView.vue new file mode 100644 index 0000000..70f054b --- /dev/null +++ b/app/src/views/SetupView.vue @@ -0,0 +1,38 @@ + + + + +