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