From 02fcc5a059e4baea6e6dc8efe06c3afc049f59e8 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 14 Aug 2021 15:19:33 +0100 Subject: [PATCH] :sparkles: Make homepage render users chosen start page --- src/router.js | 24 ++++++++++++++++-------- src/utils/defaults.js | 13 +++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/router.js b/src/router.js index 72d3ebac..9331226f 100644 --- a/src/router.js +++ b/src/router.js @@ -1,16 +1,24 @@ +/** + * This is the router config, which defined the location for + * each page within the app, and how they should be loaded + * Note that the page paths are defined in @/utils/defaults.js + */ + // Import Vue.js and vue router import Vue from 'vue'; import Router from 'vue-router'; + // Import views import Home from '@/views/Home.vue'; import Login from '@/views/Login.vue'; import Workspace from '@/views/Workspace.vue'; import Minimal from '@/views/Minimal.vue'; import DownloadConfig from '@/views/DownloadConfig.vue'; + // Import helper functions, config data and defaults import { isLoggedIn } from '@/utils/Auth'; import { config } from '@/utils/ConfigHelpers'; -import { metaTagData } from '@/utils/defaults'; +import { metaTagData, startingView, routePaths } from '@/utils/defaults'; Vue.use(Router); @@ -25,7 +33,7 @@ const isAuthenticated = () => { }; /* Get the users chosen starting view from app config, or return default */ -const getStartingView = () => config.appConfig.startingView || 'default'; +const getStartingView = () => config.appConfig.startingView || startingView; /** * Returns the component that should be rendered at the base path, @@ -58,28 +66,28 @@ const router = new Router({ meta: makeMetaTags('Home Page'), }, { // Default home page - path: '/home', + path: routePaths.home, name: 'home', component: Home, props: config, meta: makeMetaTags('Home Page'), }, { // Workspace view page - path: '/workspace', + path: routePaths.workspace, name: 'workspace', component: Workspace, props: config, meta: makeMetaTags('Workspace'), }, { // Minimal view page - path: '/minimal', + path: routePaths.minimal, name: 'minimal', component: Minimal, props: config, meta: makeMetaTags('Start Page'), }, { // The login page - path: '/login', + path: routePaths.login, name: 'login', component: Login, props: { @@ -91,13 +99,13 @@ const router = new Router({ }, }, { // The about app page - path: '/about', + path: routePaths.about, name: 'about', component: () => import(/* webpackChunkName: "about" */ './views/About.vue'), meta: makeMetaTags('About Dashy'), }, { // The export config page - path: '/download', + path: routePaths.download, name: 'download', component: DownloadConfig, props: config, diff --git a/src/utils/defaults.js b/src/utils/defaults.js index 78ce5623..080a43f8 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -13,6 +13,8 @@ module.exports = { appConfig: {}, /* Default language code */ language: 'en', + /* The page to use as the starting homepage */ + startingView: 'default', /* Default icon size to be applied on initial load */ iconSize: 'medium', /* Default layout to be applied on initial load */ @@ -23,6 +25,15 @@ module.exports = { fontAwesomeKey: '0821c65656', /* Default API to use for fetching of user service favicon icons (if enabled) */ faviconApi: 'faviconkit', + /* The page paths for each route within the app for the router */ + routePaths: { + home: '/home', + minimal: '/minimal', + workspace: '/workspace', + about: '/about', + login: '/login', + download: '/download', + }, /* List of built-in themes, to be displayed within the theme-switcher dropdown */ builtInThemes: [ 'callisto', @@ -62,6 +73,8 @@ module.exports = { hideFurnitureOn: [ 'minimal', 'login', + 'download', + 'landing-page-minimal', ], /* Key names for local storage identifiers */ localStorageKeys: {