2 import LightRouter from 'lightrouter';
4 // Initialize localization
6 import './config/i18n';
10 import ForumList from './components/forum_list/forum_list.svelte';
11 import Header from './components/header/header.svelte';
14 import Author from './components/author/author.svelte';
15 import Home from './components/home/home.svelte';
16 import InvalidRoute from './components/invalid_route/invalid_route.svelte';
17 import Post from './components/post/post.svelte';
18 import Topic from './components/topic/topic.svelte';
19 import TopicIndex from './components/topic_index/topic_index.svelte';
24 // sets the route params and current page.
26 const setRoute = function setRoute(targetPage) {
28 return function (routerParams) {
30 params = routerParams;
35 const router = new LightRouter({
37 '': () => (page = Home) && true,
38 'f/{id}': setRoute(TopicIndex),
39 'g/{id}': setRoute(TopicIndex),
40 'a/{id}': setRoute(Author),
41 't/{id}': setRoute(Topic),
42 'p/{id}': setRoute(Post),
43 '.*': setRoute(InvalidRoute)
53 <svelte:component this={ page } params={ params } />
59 grid-column: col-start 2 / span 11;