]> Untitled Git - lemmy-ui.git/blob - src/shared/routes.ts
ce2eafed67f44b6c157158ca642ea2c60a7a4080
[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 { Instances } from "./components/instances";
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: Main,
29     fetchInitialData: req => Main.fetchInitialData(req),
30   },
31   {
32     path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
33     component: Main,
34     fetchInitialData: req => Main.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     fetchInitialData: req => CreateCommunity.fetchInitialData(req),
49   },
50   {
51     path: `/create_private_message/recipient/:recipient_id`,
52     component: CreatePrivateMessage,
53     fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
54   },
55   {
56     path: `/communities/page/:page`,
57     component: Communities,
58     fetchInitialData: req => Communities.fetchInitialData(req),
59   },
60   {
61     path: `/communities`,
62     component: Communities,
63     fetchInitialData: req => Communities.fetchInitialData(req),
64   },
65   {
66     path: `/post/:id/comment/:comment_id`,
67     component: Post,
68     fetchInitialData: req => Post.fetchInitialData(req),
69   },
70   {
71     path: `/post/:id`,
72     component: Post,
73     fetchInitialData: req => Post.fetchInitialData(req),
74   },
75   {
76     path: `/community/:id/data_type/:data_type/sort/:sort/page/:page`,
77     component: Community,
78     fetchInitialData: req => Community.fetchInitialData(req),
79   },
80   {
81     path: `/community/:id`,
82     component: Community,
83     fetchInitialData: req => Community.fetchInitialData(req),
84   },
85   {
86     path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
87     component: Community,
88     fetchInitialData: req => Community.fetchInitialData(req),
89   },
90   {
91     path: `/c/:name`,
92     component: Community,
93     fetchInitialData: req => Community.fetchInitialData(req),
94   },
95   {
96     path: `/u/:username/view/:view/sort/:sort/page/:page`,
97     component: User,
98     fetchInitialData: req => User.fetchInitialData(req),
99   },
100   {
101     path: `/user/:id/view/:view/sort/:sort/page/:page`,
102     component: User,
103     fetchInitialData: req => User.fetchInitialData(req),
104   },
105   {
106     path: `/user/:id`,
107     component: User,
108     fetchInitialData: req => User.fetchInitialData(req),
109   },
110   {
111     path: `/u/:username`,
112     component: User,
113     fetchInitialData: req => User.fetchInitialData(req),
114   },
115   {
116     path: `/inbox`,
117     component: Inbox,
118     fetchInitialData: req => Inbox.fetchInitialData(req),
119   },
120   {
121     path: `/modlog/community/:community_id`,
122     component: Modlog,
123     fetchInitialData: req => Modlog.fetchInitialData(req),
124   },
125   {
126     path: `/modlog`,
127     component: Modlog,
128     fetchInitialData: req => Modlog.fetchInitialData(req),
129   },
130   { path: `/setup`, component: Setup },
131   {
132     path: `/admin`,
133     component: AdminSettings,
134     fetchInitialData: req => AdminSettings.fetchInitialData(req),
135   },
136   {
137     path: `/search/q/:q/type/:type/sort/:sort/page/:page`,
138     component: Search,
139     fetchInitialData: req => Search.fetchInitialData(req),
140   },
141   {
142     path: `/search`,
143     component: Search,
144     fetchInitialData: req => Search.fetchInitialData(req),
145   },
146   {
147     path: `/password_change/:token`,
148     component: PasswordChange,
149   },
150   { path: `/instances`, component: Instances },
151 ];