]> Untitled Git - lemmy-ui.git/blob - src/shared/routes.ts
Add post, inbox, and user routes.
[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   {
26     path: `/`,
27     exact: true,
28     component: Main,
29     fetchInitialData: (auth, path) => Main.fetchInitialData(auth, path),
30   },
31   {
32     path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
33     component: Main,
34     fetchInitialData: (auth, path) => Main.fetchInitialData(auth, path),
35   },
36   { path: `/login`, component: Login },
37   {
38     path: `/create_post`,
39     component: CreatePost,
40     fetchInitialData: (auth, path) => CreatePost.fetchInitialData(auth, path),
41   },
42   {
43     path: `/create_community`,
44     component: CreateCommunity,
45     fetchInitialData: (auth, path) =>
46       CreateCommunity.fetchInitialData(auth, path),
47   },
48   {
49     path: `/create_private_message/recipient/:recipient_id`,
50     component: CreatePrivateMessage,
51     fetchInitialData: (auth, path) =>
52       CreatePrivateMessage.fetchInitialData(auth, path),
53   },
54   {
55     path: `/communities/page/:page`,
56     component: Communities,
57     fetchInitialData: (auth, path) => Communities.fetchInitialData(auth, path),
58   },
59   {
60     path: `/communities`,
61     component: Communities,
62     fetchInitialData: (auth, path) => Communities.fetchInitialData(auth, path),
63   },
64   {
65     path: `/post/:id/comment/:comment_id`,
66     component: Post,
67     fetchInitialData: (auth, path) => Post.fetchInitialData(auth, path),
68   },
69   {
70     path: `/post/:id`,
71     component: Post,
72     fetchInitialData: (auth, path) => Post.fetchInitialData(auth, path),
73   },
74   {
75     path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
76     component: Community,
77     fetchInitialData: (auth, path) => Community.fetchInitialData(auth, path),
78   },
79   {
80     path: `/community/:id`,
81     component: Community,
82     fetchInitialData: (auth, path) => Community.fetchInitialData(auth, path),
83   },
84   {
85     path: `/c/:name`,
86     component: Community,
87     fetchInitialData: (auth, path) => Community.fetchInitialData(auth, path),
88   },
89   {
90     path: `/u/:username/view/:view/sort/:sort/page/:page`,
91     component: User,
92     fetchInitialData: (auth, path) => User.fetchInitialData(auth, path),
93   },
94   {
95     path: `/user/:id`,
96     component: User,
97     fetchInitialData: (auth, path) => User.fetchInitialData(auth, path),
98   },
99   {
100     path: `/u/:username`,
101     component: User,
102     fetchInitialData: (auth, path) => User.fetchInitialData(auth, path),
103   },
104   {
105     path: `/inbox`,
106     component: Inbox,
107     fetchInitialData: (auth, path) => Inbox.fetchInitialData(auth, path),
108   },
109   {
110     path: `/modlog/community/:community_id`,
111     component: Modlog,
112   },
113   { path: `/modlog`, component: Modlog },
114   { path: `/setup`, component: Setup },
115   { path: `/admin`, component: AdminSettings },
116   {
117     path: `/search/q/:q/type/:type/sort/:sort/page/:page`,
118     component: Search,
119   },
120   { path: `/search`, component: Search },
121   { path: `/sponsors`, component: Sponsors },
122   {
123     path: `/password_change/:token`,
124     component: PasswordChange,
125   },
126   { path: `/instances`, component: Instances },
127 ];