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