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