]> Untitled Git - lemmy-ui.git/blob - src/shared/routes.ts
Remove categories
[lemmy-ui.git] / src / shared / routes.ts
1 import { IRouteProps } from "inferno-router/dist/Route";
2 import { Main } from "./components/main";
3 import { Login } from "./components/login";
4 import { CreatePost } from "./components/create-post";
5 import { CreateCommunity } from "./components/create-community";
6 import { CreatePrivateMessage } from "./components/create-private-message";
7 import { PasswordChange } from "./components/password_change";
8 import { Post } from "./components/post";
9 import { Community } from "./components/community";
10 import { Communities } from "./components/communities";
11 import { User } from "./components/user";
12 import { Modlog } from "./components/modlog";
13 import { Setup } from "./components/setup";
14 import { AdminSettings } from "./components/admin-settings";
15 import { Inbox } from "./components/inbox";
16 import { Search } from "./components/search";
17 import { Instances } from "./components/instances";
18 import { InitialFetchRequest } from "./interfaces";
19
20 interface IRoutePropsWithFetch extends IRouteProps {
21   fetchInitialData?(req: InitialFetchRequest): Promise<any>[];
22 }
23
24 export const routes: IRoutePropsWithFetch[] = [
25   {
26     path: `/`,
27     exact: true,
28     component: Main,
29     fetchInitialData: req => Main.fetchInitialData(req),
30   },
31   {
32     path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
33     component: Main,
34     fetchInitialData: req => Main.fetchInitialData(req),
35   },
36   {
37     path: `/login`,
38     component: Login,
39   },
40   {
41     path: `/create_post`,
42     component: CreatePost,
43     fetchInitialData: req => CreatePost.fetchInitialData(req),
44   },
45   {
46     path: `/create_community`,
47     component: CreateCommunity,
48   },
49   {
50     path: `/create_private_message/recipient/:recipient_id`,
51     component: CreatePrivateMessage,
52     fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
53   },
54   {
55     path: `/communities/page/:page`,
56     component: Communities,
57     fetchInitialData: req => Communities.fetchInitialData(req),
58   },
59   {
60     path: `/communities`,
61     component: Communities,
62     fetchInitialData: req => Communities.fetchInitialData(req),
63   },
64   {
65     path: `/post/:id/comment/:comment_id`,
66     component: Post,
67     fetchInitialData: req => Post.fetchInitialData(req),
68   },
69   {
70     path: `/post/:id`,
71     component: Post,
72     fetchInitialData: req => Post.fetchInitialData(req),
73   },
74   {
75     path: `/community/:id/data_type/:data_type/sort/:sort/page/:page`,
76     component: Community,
77     fetchInitialData: req => Community.fetchInitialData(req),
78   },
79   {
80     path: `/community/:id`,
81     component: Community,
82     fetchInitialData: req => Community.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: User,
97     fetchInitialData: req => User.fetchInitialData(req),
98   },
99   {
100     path: `/user/:id/view/:view/sort/:sort/page/:page`,
101     component: User,
102     fetchInitialData: req => User.fetchInitialData(req),
103   },
104   {
105     path: `/user/:id`,
106     component: User,
107     fetchInitialData: req => User.fetchInitialData(req),
108   },
109   {
110     path: `/u/:username`,
111     component: User,
112     fetchInitialData: req => User.fetchInitialData(req),
113   },
114   {
115     path: `/inbox`,
116     component: Inbox,
117     fetchInitialData: req => Inbox.fetchInitialData(req),
118   },
119   {
120     path: `/modlog/community/:community_id`,
121     component: Modlog,
122     fetchInitialData: req => Modlog.fetchInitialData(req),
123   },
124   {
125     path: `/modlog`,
126     component: Modlog,
127     fetchInitialData: req => Modlog.fetchInitialData(req),
128   },
129   { path: `/setup`, component: Setup },
130   {
131     path: `/admin`,
132     component: AdminSettings,
133     fetchInitialData: req => AdminSettings.fetchInitialData(req),
134   },
135   {
136     path: `/search/q/:q/type/:type/sort/:sort/page/:page`,
137     component: Search,
138     fetchInitialData: req => Search.fetchInitialData(req),
139   },
140   {
141     path: `/search`,
142     component: Search,
143     fetchInitialData: req => Search.fetchInitialData(req),
144   },
145   {
146     path: `/password_change/:token`,
147     component: PasswordChange,
148   },
149   { path: `/instances`, component: Instances },
150 ];