running-tools

A collection of tools for runners and their coaches
git clone https://git.ashermorgan.net/running-tools/
Log | Files | Refs | README

index.ts (2713B)


      1 import { createRouter, createWebHashHistory } from 'vue-router';
      2 import HomePage from '@/views/HomePage.vue';
      3 import AboutPage from '@/views/AboutPage.vue';
      4 import BatchCalculator from '@/views/BatchCalculator.vue';
      5 import ChangeLog from '@/views/ChangeLog.vue';
      6 import PaceCalculator from '@/views/PaceCalculator.vue';
      7 import RaceCalculator from '@/views/RaceCalculator.vue';
      8 import SplitCalculator from '@/views/SplitCalculator.vue';
      9 import WorkoutCalculator from '@/views/WorkoutCalculator.vue';
     10 import UnitCalculator from '@/views/UnitCalculator.vue';
     11 import NotFoundPage from '@/views/NotFoundPage.vue';
     12 
     13 const router = createRouter({
     14   history: createWebHashHistory(import.meta.env.BASE_URL),
     15   routes: [
     16     {
     17       path: '/',
     18       redirect: '/home',
     19     },
     20     {
     21       path: '/home',
     22       name: 'home',
     23       component: HomePage,
     24       meta: {
     25         title: null,
     26         back: null,
     27       },
     28     },
     29     {
     30       path: '/about',
     31       name: 'about',
     32       component: AboutPage,
     33       meta: {
     34         title: 'About',
     35         back: 'home',
     36       },
     37     },
     38     {
     39       path: '/changelog',
     40       name: 'changelog',
     41       component: ChangeLog,
     42       meta: {
     43         title: 'Change Log',
     44         back: 'home',
     45       },
     46     },
     47     {
     48       path: '/calculate',
     49       redirect: '/home',
     50     },
     51     {
     52       path: '/calculate/batch',
     53       name: 'calculate-batch',
     54       component: BatchCalculator,
     55       meta: {
     56         title: 'Batch Calculator',
     57         back: 'home',
     58       },
     59     },
     60     {
     61       path: '/calculate/paces',
     62       name: 'calculate-paces',
     63       component: PaceCalculator,
     64       meta: {
     65         title: 'Pace Calculator',
     66         back: 'home',
     67       },
     68     },
     69     {
     70       path: '/calculate/races',
     71       name: 'calculate-races',
     72       component: RaceCalculator,
     73       meta: {
     74         title: 'Race Calculator',
     75         back: 'home',
     76       },
     77     },
     78     {
     79       path: '/calculate/splits',
     80       name: 'calculate-splits',
     81       component: SplitCalculator,
     82       meta: {
     83         title: 'Split Calculator',
     84         back: 'home',
     85       },
     86     },
     87     {
     88       path: '/calculate/units',
     89       name: 'calculate-units',
     90       component: UnitCalculator,
     91       meta: {
     92         title: 'Unit Calculator',
     93         back: 'home',
     94       },
     95     },
     96     {
     97       path: '/calculate/workouts',
     98       name: 'calculate-workouts',
     99       component: WorkoutCalculator,
    100       meta: {
    101         title: 'Workout Calculator',
    102         back: 'home',
    103       },
    104     },
    105     {
    106       path: '/:pathMatch(.*)*',
    107       component: NotFoundPage,
    108     },
    109   ]
    110 });
    111 
    112 router.afterEach((to) => {
    113   if (to.meta.title) {
    114     document.title = `${to.meta.title} - Running Tools`;
    115   } else {
    116     document.title = 'Running Tools';
    117   }
    118 });
    119 
    120 export default router;