import 'vfonts/FiraSans.css'

import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/Home.vue'
import LogsList from '../views/LogsList.vue'
import CreateLog from '../views/CreateLog.vue'

const routes = [
	{
		path: '/',
		name: 'Home',
		component: HomeView,
	},
	{
		path: '/logs',
		name: 'LogsList',
		component: LogsList
	},
	{
		path: '/logs/create/:e?',
		name: 'CreateLog',
		component: CreateLog,
		props: (route) => {
			const e = Number.parseInt(route.params.e)
			if (Number.isNaN(e)) {
				return ''
			}
			return {e}
		}
	}
]

const router = createRouter({
	history: createWebHistory(),
	routes,
})

export default router
