lemmy-ui/src/shared/routes.ts

142 lines
3.9 KiB
TypeScript
Raw Normal View History

2021-02-22 02:39:04 +00:00
import { IRouteProps } from "inferno-router/dist/Route";
import { Communities } from "./components/community/communities";
import { Community } from "./components/community/community";
import { CreateCommunity } from "./components/community/create-community";
import { AdminSettings } from "./components/home/admin-settings";
import { Home } from "./components/home/home";
import { Instances } from "./components/home/instances";
import { Legal } from "./components/home/legal";
import { Login } from "./components/home/login";
import { Setup } from "./components/home/setup";
import { Signup } from "./components/home/signup";
2021-02-22 02:39:04 +00:00
import { Modlog } from "./components/modlog";
import { Inbox } from "./components/person/inbox";
import { PasswordChange } from "./components/person/password-change";
import { Profile } from "./components/person/profile";
import { RegistrationApplications } from "./components/person/registration-applications";
import { Reports } from "./components/person/reports";
import { Settings } from "./components/person/settings";
import { VerifyEmail } from "./components/person/verify-email";
import { CreatePost } from "./components/post/create-post";
import { Post } from "./components/post/post";
import { CreatePrivateMessage } from "./components/private_message/create-private-message";
2021-02-22 02:39:04 +00:00
import { Search } from "./components/search";
import { InitialFetchRequest } from "./interfaces";
Use http client (#1081) * Beginning work on websocket -> http client conversion. * About 30% done. * half done. * more done. * Almost passing lint. * Passing lint, but untested. * Add back in event listeners. * Fixing some community forms. * Remove webpack cache. * fixing some more. * Fixed ISOwrappers. * A few more fixes. * Refactor utils * Fix instance add/remove buttons * Not catching errors in isoWrapper. * Wrap Http client * Fixing up tagline and ratelimit forms. * Make all http client wrapping be in one place * Reworking some more forms. * Upgrading lemmy-js-client. * Fixing verify email. * Fix linting errors * Upgrading woodpecker node. * Fix comment scrolling rerender bug. * Fixing a few things, commenting out props for now. * v0.18.0-beta.1 * Trying to fix woodpecker, 1. * Trying to fix woodpecker, 2. * Handroll prompt * Add navigation prompt to other pages * Fix prompt navigation bug * Fix prompt bug introduced from last bug fix * Fix PWA bug * Fix isoData not working * Fix search page update url * Fix sharp issue. * v0.18.0-beta.2 * Make create post pre-fetch communities * Fix bug from last commit * Fix issue of posts/comments not being switched when changing select options * Fix unnecessary fetches on home screen * Make circular icon buttons not look stupid * Prevent unnecessary fetches * Make login experience smoother * Add PWA shortcuts * Add related application to PWA * Update translations * Forgot to add post editing. * Fixing site setup. * Deploy script setup. * v0.18.0-beta.4 * Sanitize again. * Adding sanitize json function. * Upping version. * Another sanitize fix. * Upping version. * Prevent search nav item from disappearing when on search page * Allow admin and mod actions on non-local comments. * Fix mobile menu collapse bug * Completely fix prompt component * Fix undefined value checks in use_http_client_2 (#1230) * fix: filter out undefined from posts * fix: emoji initialisation passing undefined * fix: || => ?? to be more explicit * linting --------- Co-authored-by: Alex Maras <alexmaras@gmail.com> * Re-add accidentally removed state * Fix dropdown bug * Use linkEvent where appropriate * Fix navigation warnings. --------- Co-authored-by: Dessalines <tyhou13@gmx.com> Co-authored-by: Alex Maras <dev@alexmaras.com> Co-authored-by: Alex Maras <alexmaras@gmail.com>
2023-06-14 12:20:40 +00:00
import { RequestState } from "./services/HttpService";
interface IRoutePropsWithFetch<T extends Record<string, RequestState<any>>>
extends IRouteProps {
// TODO Make sure this one is good.
fetchInitialData?(req: InitialFetchRequest): T;
}
2023-05-30 00:40:00 +00:00
export const routes: IRoutePropsWithFetch<Record<string, any>>[] = [
2020-09-08 04:09:11 +00:00
{
path: `/`,
component: Home,
fetchInitialData: Home.fetchInitialData,
exact: true,
},
2020-09-09 03:13:26 +00:00
{
path: `/login`,
component: Login,
},
{
path: `/signup`,
component: Signup,
},
{
path: `/create_post`,
component: CreatePost,
fetchInitialData: CreatePost.fetchInitialData,
},
{
path: `/create_community`,
component: CreateCommunity,
},
{
path: `/create_private_message/:recipient_id`,
component: CreatePrivateMessage,
fetchInitialData: CreatePrivateMessage.fetchInitialData,
},
{
path: `/communities`,
component: Communities,
fetchInitialData: Communities.fetchInitialData,
},
{
path: `/post/:post_id`,
component: Post,
fetchInitialData: Post.fetchInitialData,
2020-09-09 00:48:17 +00:00
},
{
path: `/comment/:comment_id`,
2020-09-09 00:48:17 +00:00
component: Post,
fetchInitialData: Post.fetchInitialData,
},
2020-09-08 15:17:49 +00:00
{
path: `/c/:name`,
component: Community,
fetchInitialData: Community.fetchInitialData,
2020-09-09 00:48:17 +00:00
},
{
path: `/u/:username`,
component: Profile,
fetchInitialData: Profile.fetchInitialData,
2020-09-09 00:48:17 +00:00
},
{
path: `/inbox`,
component: Inbox,
fetchInitialData: Inbox.fetchInitialData,
},
{
path: `/settings`,
component: Settings,
},
{
path: `/modlog/:communityId`,
component: Modlog,
fetchInitialData: Modlog.fetchInitialData,
},
{
path: `/modlog`,
component: Modlog,
fetchInitialData: Modlog.fetchInitialData,
},
{ path: `/setup`, component: Setup },
{
path: `/admin`,
component: AdminSettings,
fetchInitialData: AdminSettings.fetchInitialData,
},
{
path: `/reports`,
component: Reports,
fetchInitialData: Reports.fetchInitialData,
},
{
path: `/registration_applications`,
component: RegistrationApplications,
fetchInitialData: RegistrationApplications.fetchInitialData,
},
{
path: `/search`,
component: Search,
fetchInitialData: Search.fetchInitialData,
},
{
path: `/password_change/:token`,
component: PasswordChange,
},
{
path: `/verify_email/:token`,
component: VerifyEmail,
},
{
path: `/instances`,
component: Instances,
fetchInitialData: Instances.fetchInitialData,
},
{ path: `/legal`, component: Legal },
];