]> Untitled Git - lemmy-ui.git/blob - src/shared/routes.ts
d48631620f02c1f1b95eca43b283e5f8cc8aca09
[lemmy-ui.git] / src / shared / routes.ts
1 import { IRouteProps } from "inferno-router/dist/Route";
2 import { Communities } from "./components/community/communities";
3 import { Community } from "./components/community/community";
4 import { CreateCommunity } from "./components/community/create-community";
5 import { AdminSettings } from "./components/home/admin-settings";
6 import { Home } from "./components/home/home";
7 import { Instances } from "./components/home/instances";
8 import { Login } from "./components/home/login";
9 import { PasswordChange } from "./components/home/password_change";
10 import { Setup } from "./components/home/setup";
11 import { Modlog } from "./components/modlog";
12 import { Inbox } from "./components/person/inbox";
13 import { Person } from "./components/person/person";
14 import { CreatePost } from "./components/post/create-post";
15 import { Post } from "./components/post/post";
16 import { CreatePrivateMessage } from "./components/private_message/create-private-message";
17 import { Search } from "./components/search";
18 import { InitialFetchRequest } from "./interfaces";
19
20 interface IRoutePropsWithFetch extends IRouteProps {
21   fetchInitialData?(req: InitialFetchRequest): Promise<any>[];
22 }
23
24 export const routes: IRoutePropsWithFetch[] = [
25   {
26     path: `/`,
27     exact: true,
28     component: Home,
29     fetchInitialData: req => Home.fetchInitialData(req),
30   },
31   {
32     path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
33     component: Home,
34     fetchInitialData: req => Home.fetchInitialData(req),
35   },
36   {
37     path: `/login`,
38     component: Login,
39   },
40   {
41     path: `/create_post`,
42     component: CreatePost,
43     fetchInitialData: req => CreatePost.fetchInitialData(req),
44   },
45   {
46     path: `/create_community`,
47     component: CreateCommunity,
48   },
49   {
50     path: `/create_private_message/recipient/:recipient_id`,
51     component: CreatePrivateMessage,
52     fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
53   },
54   {
55     path: `/communities/listing_type/:listing_type/page/:page`,
56     component: Communities,
57     fetchInitialData: req => Communities.fetchInitialData(req),
58   },
59   {
60     path: `/communities`,
61     component: Communities,
62     fetchInitialData: req => Communities.fetchInitialData(req),
63   },
64   {
65     path: `/post/:id/comment/:comment_id`,
66     component: Post,
67     fetchInitialData: req => Post.fetchInitialData(req),
68   },
69   {
70     path: `/post/:id`,
71     component: Post,
72     fetchInitialData: req => Post.fetchInitialData(req),
73   },
74   {
75     path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
76     component: Community,
77     fetchInitialData: req => Community.fetchInitialData(req),
78   },
79   {
80     path: `/c/:name`,
81     component: Community,
82     fetchInitialData: req => Community.fetchInitialData(req),
83   },
84   {
85     path: `/u/:username/view/:view/sort/:sort/page/:page`,
86     component: Person,
87     fetchInitialData: req => Person.fetchInitialData(req),
88   },
89   {
90     path: `/u/:username`,
91     component: Person,
92     fetchInitialData: req => Person.fetchInitialData(req),
93   },
94   {
95     path: `/inbox`,
96     component: Inbox,
97     fetchInitialData: req => Inbox.fetchInitialData(req),
98   },
99   {
100     path: `/modlog/community/:community_id`,
101     component: Modlog,
102     fetchInitialData: req => Modlog.fetchInitialData(req),
103   },
104   {
105     path: `/modlog`,
106     component: Modlog,
107     fetchInitialData: req => Modlog.fetchInitialData(req),
108   },
109   { path: `/setup`, component: Setup },
110   {
111     path: `/admin`,
112     component: AdminSettings,
113     fetchInitialData: req => AdminSettings.fetchInitialData(req),
114   },
115   {
116     path: `/search/q/:q/type/:type/sort/:sort/listing_type/:listing_type/community_id/:community_id/creator_id/:creator_id/page/:page`,
117     component: Search,
118     fetchInitialData: req => Search.fetchInitialData(req),
119   },
120   {
121     path: `/search`,
122     component: Search,
123     fetchInitialData: req => Search.fetchInitialData(req),
124   },
125   {
126     path: `/password_change/:token`,
127     component: PasswordChange,
128   },
129   { path: `/instances`, component: Instances },
130 ];