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