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