Files
habitica/website/client/router.js
Matteo Pagliazzi 706de95458 Client: Header & Menu & Icons (#8770)
* header revamp - wip

* fix webpack fonts

* wip icons

* fix compilation errors

* implement icons loading without iconmoo

* new svg implementation

* wip

* fix issues with svgs

* fix issues with svgs

* fix bits svg

* fix displaying of pet in avatar

* avatar class icon

* no party header

* update navigation

* split code by route

* round gems and gp

* add string for faqs

* fix icons in css
2017-06-08 12:04:19 -07:00

112 lines
3.8 KiB
JavaScript

import Vue from 'vue';
import VueRouter from 'vue-router';
// import EmptyView from './components/emptyView';
// TODO Dummy elements used as placeholder until real components are implemented
import ParentPage from './components/parentPage';
import Page from './components/page';
// Tasks
import UserTasks from './components/userTasks';
// Except for tasks that are always loaded all the other main level
// components are loaded in separate webpack chunks.
// See https://webpack.js.org/guides/code-splitting-async/
// for docs
// Inventory
const InventoryContainer = () => import(/* webpackChunkName: "inventory" */'./components/inventory/index');
const ItemsPage = () => import(/* webpackChunkName: "inventory" */'./components/inventory/items/index');
const EquipmentPage = () => import(/* webpackChunkName: "inventory" */'./components/inventory/equipment/index');
const StablePage = () => import(/* webpackChunkName: "inventory" */'./components/inventory/stable');
// Social
// TODO add inbox back
// import InboxPage from './components/social/inbox/index';
// import InboxConversationPage from './components/social/inbox/conversationPage';
// Guilds
const GuildIndex = () => import(/* webpackChunkName: "guilds" */ './components/guilds/index');
const TavernPage = () => import(/* webpackChunkName: "guilds" */ './components/guilds/tavern');
const MyGuilds = () => import(/* webpackChunkName: "guilds" */ './components/guilds/myGuilds');
const GuildsDiscoveryPage = () => import(/* webpackChunkName: "guilds" */ './components/guilds/discovery');
const GuildPage = () => import(/* webpackChunkName: "guilds" */ './components/guilds/guild');
Vue.use(VueRouter);
export default new VueRouter({
mode: 'history',
base: process.env.NODE_ENV === 'production' ? '/new-app' : __dirname, // eslint-disable-line no-process-env
linkActiveClass: 'active',
// When navigating to another route always scroll to the top
// To customize the behavior see https://router.vuejs.org/en/advanced/scroll-behavior.html
scrollBehavior () {
return { x: 0, y: 0 };
},
routes: [
{ name: 'tasks', path: '/', component: UserTasks },
{
path: '/inventory',
component: InventoryContainer,
children: [
{ name: 'items', path: 'items', component: ItemsPage },
{ name: 'equipment', path: 'equipment', component: EquipmentPage },
{ name: 'stable', path: 'stable', component: StablePage },
],
},
{ name: 'shops', path: '/shops', component: Page },
{
path: '/guilds',
component: GuildIndex,
children: [
{ name: 'tavern', path: 'tavern', component: TavernPage },
{
name: 'myGuilds',
path: 'myGuilds',
component: MyGuilds,
},
{
name: 'guildsDiscovery',
path: 'discovery',
component: GuildsDiscoveryPage,
},
{
name: 'guild',
path: 'guild/:guildId',
component: GuildPage,
props: true,
},
],
},
{ name: 'challenges', path: 'challenges', component: Page },
{ name: 'party', path: 'party', component: Page },
/* TODO add inbox back
{
path: 'inbox',
component: EmptyView,
children: [
{
name: 'inbox',
path: '',
component: InboxPage,
},
{
name: 'conversation',
path: 'conversation/:id',
component: InboxConversationPage,
},
],
}, */
{
path: '/user',
component: ParentPage,
children: [
{ name: 'avatar', path: 'avatar', component: Page },
{ name: 'stats', path: 'stats', component: Page },
{ name: 'achievements', path: 'achievements', component: Page },
{ name: 'settings', path: 'settings', component: Page },
],
},
],
});