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