]> Untitled Git - lemmy-ui.git/blob - src/shared/routes.ts
Somewhat working webpack. Sponsors and communities pages done.
[lemmy-ui.git] / src / shared / routes.ts
1 import { IRouteProps } from 'inferno-router/dist/Route';
2 import { Main } from './components/main';
3 import { Login } from './components/login';
4 import { CreatePost } from './components/create-post';
5 import { CreateCommunity } from './components/create-community';
6 import { CreatePrivateMessage } from './components/create-private-message';
7 import { PasswordChange } from './components/password_change';
8 import { Post } from './components/post';
9 import { Community } from './components/community';
10 import { Communities } from './components/communities';
11 import { User } from './components/user';
12 import { Modlog } from './components/modlog';
13 import { Setup } from './components/setup';
14 import { AdminSettings } from './components/admin-settings';
15 import { Inbox } from './components/inbox';
16 import { Search } from './components/search';
17 import { Sponsors } from './components/sponsors';
18 import { Instances } from './components/instances';
19
20 interface IRoutePropsWithFetch extends IRouteProps {
21   fetchInitialData?(auth: string, path: string): Promise<any>[];
22 }
23
24 export const routes: IRoutePropsWithFetch[] = [
25   { exact: true, path: `/`, component: Main },
26   {
27     path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
28     component: Main,
29   },
30   { path: `/login`, component: Login },
31   { path: `/create_post`, component: CreatePost },
32   { path: `/create_community`, component: CreateCommunity },
33   {
34     path: `/create_private_message`,
35     component: CreatePrivateMessage,
36   },
37   {
38     path: `/communities/page/:page`,
39     component: Communities,
40     fetchInitialData: (auth, path) => Communities.fetchInitialData(auth, path),
41   },
42   {
43     path: `/communities`,
44     component: Communities,
45     fetchInitialData: (auth, path) => Communities.fetchInitialData(auth, path),
46   },
47   {
48     path: `/post/:id/comment/:comment_id`,
49     component: Post,
50   },
51   { path: `/post/:id`, component: Post },
52   {
53     path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
54     component: Community,
55   },
56   { path: `/community/:id`, component: Community },
57   { path: `/c/:name`, component: Community },
58   {
59     path: `/u/:username/view/:view/sort/:sort/page/:page`,
60     component: User,
61   },
62   { path: `/user/:id`, component: User },
63   { path: `/u/:username`, component: User },
64   { path: `/inbox`, component: Inbox },
65   {
66     path: `/modlog/community/:community_id`,
67     component: Modlog,
68   },
69   { path: `/modlog`, component: Modlog },
70   { path: `/setup`, component: Setup },
71   { path: `/admin`, component: AdminSettings },
72   {
73     path: `/search/q/:q/type/:type/sort/:sort/page/:page`,
74     component: Search,
75   },
76   { path: `/search`, component: Search },
77   { path: `/sponsors`, component: Sponsors },
78   {
79     path: `/password_change/:token`,
80     component: PasswordChange,
81   },
82   { path: `/instances`, component: Instances },
83 ];