Skip to content

Commit

Permalink
DRY up title definitions in router config
Browse files Browse the repository at this point in the history
  • Loading branch information
anttimaki committed Dec 20, 2022
1 parent c46add5 commit 9b2d18d
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ import { RouteConfig } from 'vue-router';
import Profile from '../model/Profile';
import ManagerInformation from '../_managerinf/ManagerInformation';

const appTitle = `${ManagerInformation.APP_NAME} (${ManagerInformation.VERSION.toString()})`
const appTitle = () => `${ManagerInformation.APP_NAME} (${ManagerInformation.VERSION.toString()})`;
const profileTitle = () => `${appTitle()} - ${Profile.getActiveProfile().getProfileName()}`;

const routes: RouteConfig[] = [
{
name: 'index',
path: '/',
component: () => import("pages/GameSelectionScreen.vue"),
meta: {
title: () => appTitle
}
meta: {title: appTitle}
},
{
name: 'splash',
path: '/splash/',
component: () => import('pages/Splash.vue'),
meta: {
title: () => appTitle
}
meta: {title: appTitle}
},
{
name: 'linux',
Expand All @@ -33,24 +30,18 @@ const routes: RouteConfig[] = [
name: 'profiles',
path: '/profiles/',
component: () => import('pages/Profiles.vue'),
meta: {
title: () => appTitle
}
meta: {title: appTitle}
},
{
path: '/nav/',
component: () => import('components/navigation/NavigationLayout.vue'),
meta: {
title: () => appTitle
},
meta: {title: appTitle},
children: [
{
name: 'manager',
path: 'manager/',
component: () => import('pages/Manager.vue'),
meta: {
title: () => `${appTitle} - ${Profile.getActiveProfile().getProfileName()}`
},
meta: {title: profileTitle},
children: [
{
name: 'manager.installed',
Expand All @@ -59,55 +50,43 @@ const routes: RouteConfig[] = [
components: {
subview: () => import('components/views/InstalledModView.vue')
},
meta: {
title: () => `${appTitle} - ${Profile.getActiveProfile().getProfileName()}`
},
meta: {title: profileTitle}
},
{
name: 'manager.online',
path: 'online/',
components: {
subview: () => import('components/views/OnlineModView.vue')
},
meta: {
title: () => `${appTitle} - ${Profile.getActiveProfile().getProfileName()}`
},
meta: {title: profileTitle}
},
{
name: 'manager.settings',
path: 'settings/',
components: {
subview: () => import('components/settings-components/SettingsView.vue')
},
meta: {
title: () => `${appTitle} - ${Profile.getActiveProfile().getProfileName()}`
}
meta: {title: profileTitle}
}
]
},
{
name: 'config-editor',
path: 'config-editor/',
component: () => import('pages/ConfigEditor.vue'),
meta: {
title: () => `${appTitle} - ${Profile.getActiveProfile().getProfileName()}`
}
meta: {title: profileTitle}
},
{
name: 'help',
path: 'help/',
component: () => import('pages/Help.vue'),
meta: {
title: () => `${appTitle} - ${Profile.getActiveProfile().getProfileName()}`
}
meta: {title: profileTitle}
},
{
name: 'downloads',
path: 'downloads/',
component: () => import('pages/DownloadMonitor.vue'),
meta: {
title: () => `${appTitle} - ${Profile.getActiveProfile().getProfileName()}`
}
meta: {title: profileTitle}
}
]
}
Expand Down

0 comments on commit 9b2d18d

Please sign in to comment.