You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memos/web/src/router/index.tsx

118 lines
3.0 KiB
TypeScript

import { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
import App from "@/App";
import HomeLayout from "@/layouts/HomeLayout";
import SuspenseWrapper from "@/layouts/SuspenseWrapper";
const SignIn = lazy(() => import("@/pages/SignIn"));
const SignUp = lazy(() => import("@/pages/SignUp"));
const AuthCallback = lazy(() => import("@/pages/AuthCallback"));
const Explore = lazy(() => import("@/pages/Explore"));
const Home = lazy(() => import("@/pages/Home"));
const UserProfile = lazy(() => import("@/pages/UserProfile"));
const MemoDetail = lazy(() => import("@/pages/MemoDetail"));
const Archived = lazy(() => import("@/pages/Archived"));
const Timeline = lazy(() => import("@/pages/Timeline"));
const Resources = lazy(() => import("@/pages/Resources"));
const Inboxes = lazy(() => import("@/pages/Inboxes"));
const Setting = lazy(() => import("@/pages/Setting"));
const About = lazy(() => import("@/pages/About"));
const NotFound = lazy(() => import("@/pages/NotFound"));
const PermissionDenied = lazy(() => import("@/pages/PermissionDenied"));
export enum Routes {
HOME = "/",
TIMELINE = "/timeline",
RESOURCES = "/resources",
INBOX = "/inbox",
ARCHIVED = "/archived",
SETTING = "/setting",
}
const router = createBrowserRouter([
{
path: "/",
element: <App />,
children: [
{
path: "/auth",
element: <SuspenseWrapper />,
children: [
{
path: "",
element: <SignIn />,
},
{
path: "signup",
element: <SignUp />,
},
{
path: "callback",
element: <AuthCallback />,
},
],
},
{
path: "/",
element: <HomeLayout />,
children: [
{
path: Routes.HOME,
element: <Home />,
},
{
path: Routes.TIMELINE,
element: <Timeline />,
},
{
path: Routes.RESOURCES,
element: <Resources />,
},
{
path: Routes.INBOX,
element: <Inboxes />,
},
{
path: Routes.ARCHIVED,
element: <Archived />,
},
{
path: Routes.SETTING,
element: <Setting />,
},
{
path: "explore",
element: <Explore />,
},
{
path: "m/:memoName",
element: <MemoDetail />,
},
{
path: "u/:username",
element: <UserProfile />,
},
{
path: "about",
element: <About />,
},
{
path: "403",
element: <PermissionDenied />,
},
{
path: "404",
element: <NotFound />,
},
{
path: "*",
element: <NotFound />,
},
],
feat: new resource dashboard (#1346) * feat: refator the file dashboard * feat: support select resouce file * feat: suppor delete select files * feat: support share menu, implement rename and delete * chore: change the color of hover * chore: refator file dashboard to page * feat: add i18n for button * feat: beautify the button * fix: the error position of button * feat: only select when click circle instead of whole card * feat: beautify file dashboard * chore: factor the filecard code * feat: using dropdown component intead of component * feat: add i18n for delete selected resource button * feat: delete the unused style of title * chore: refactor file cover * feat: support more type file cover * feat: use memo to reduce unused computing in filecover * feat: when no file be selected, click the delete will error * feat: store the select resource id instead of source to save memory * chore: delete unused code * feat: refactor the file card * chore: delete unused style file * chore: change file to resource * chore: delete unused import * chore: fix the typo * fix: the error of handle check click * fix: the error of handle of uncheck * chore: change the name of selectList to selectedList * chore: change the name of selectList to selectedList * chore: change the name of selectList to selectedList * chore: delete unused import * feat: support Responsive Design * feat: min display two card in a line * feat: adjust the num of a line in responsive design * feat: adjust the num of a line to 6 when using md * feat: add the color of hover source card when dark * chore: refactor resource cover css to reduce code * chore: delete unnessnary change * chore: change the type of callback function * chore: delete unused css code * feat: add zh-hant i18n * feat: change the position of buttons * feat: add title for the icon button * feat: add opacity for icon * feat: refactor searchbar * feat:move Debounce to search * feat: new resource search bar * feat: reduce the size of cover * support file search * Update web/src/pages/ResourcesDashboard.tsx Co-authored-by: boojack <stevenlgtm@gmail.com> * Update web/src/components/ResourceCard.tsx Co-authored-by: boojack <stevenlgtm@gmail.com> * chore: reduce css code * feat: support lowcase and uppercase search * chore: reserve the searchbar * feat: refator resource Search bar * chore: change the param name * feat: resource bar support dark mode * feat: beautify the UI of dashboard * chore: extract positionClassName from actionsClassName * feat: reduce the length of search bar --------- Co-authored-by: boojack <stevenlgtm@gmail.com>
2 years ago
},
],
},
]);
export default router;