diff --git a/web/src/components/AboutSiteDialog.tsx b/web/src/components/AboutSiteDialog.tsx deleted file mode 100644 index 2e323c1e..00000000 --- a/web/src/components/AboutSiteDialog.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { Divider, IconButton } from "@mui/joy"; -import { useGlobalStore } from "@/store/module"; -import { useTranslate } from "@/utils/i18n"; -import { generateDialog } from "./Dialog"; -import Icon from "./Icon"; - -type Props = DialogProps; - -const AboutSiteDialog: React.FC = ({ destroy }: Props) => { - const t = useTranslate(); - const globalStore = useGlobalStore(); - const profile = globalStore.state.systemStatus.profile; - const customizedProfile = globalStore.state.systemStatus.customizedProfile; - - const handleCloseBtnClick = () => { - destroy(); - }; - - return ( - <> -
-

- {t("common.about")} {customizedProfile.name} -

- - - -
-
-

{t("about.memos-description")}

-

{customizedProfile.description || t("about.no-server-description")}

- -
- {t("about.powered-by")} - - - - v{profile.version} -
-
- - ); -}; - -export default function showAboutSiteDialog(): void { - generateDialog( - { - className: "about-site-dialog", - dialogName: "about-site-dialog", - }, - AboutSiteDialog - ); -} diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index 4cdb83a8..6f7cc00c 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -98,10 +98,16 @@ const Navigation = () => { title: t("common.sign-in"), icon: , }; + const aboutNavLink: NavLinkItem = { + id: "header-about", + path: "/about", + title: t("common.about"), + icon: , + }; const navLinks: NavLinkItem[] = user ? [homeNavLink, timelineNavLink, resourcesNavLink, exploreNavLink, profileNavLink, inboxNavLink, archivedNavLink, settingNavLink] - : [exploreNavLink, signInNavLink]; + : [exploreNavLink, signInNavLink, aboutNavLink]; return (
diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index 066f98e5..938f7cf3 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -2,7 +2,6 @@ import * as api from "@/helpers/api"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useGlobalStore } from "@/store/module"; import { useTranslate } from "@/utils/i18n"; -import showAboutSiteDialog from "./AboutSiteDialog"; import Icon from "./Icon"; import UserAvatar from "./UserAvatar"; import Dropdown from "./kit/Dropdown"; @@ -14,10 +13,6 @@ const UserBanner = () => { const user = useCurrentUser(); const title = user ? user.nickname || user.username : systemStatus.customizedProfile.name || "memos"; - const handleAboutBtnClick = () => { - showAboutSiteDialog(); - }; - const handleSignOutBtnClick = async () => { await api.signout(); window.location.href = "/auth"; @@ -33,22 +28,17 @@ const UserBanner = () => { {title} } + disabled={user == undefined} actionsClassName="min-w-[128px] max-w-full" positionClassName="top-full mt-2" actions={ <> - {user != undefined && ( )} diff --git a/web/src/components/kit/Dropdown.tsx b/web/src/components/kit/Dropdown.tsx index 6d96b252..de848529 100644 --- a/web/src/components/kit/Dropdown.tsx +++ b/web/src/components/kit/Dropdown.tsx @@ -5,13 +5,14 @@ import Icon from "../Icon"; interface Props { trigger?: ReactNode; actions?: ReactNode; + disabled?: boolean; className?: string; actionsClassName?: string; positionClassName?: string; } const Dropdown: React.FC = (props: Props) => { - const { trigger, actions, className, actionsClassName, positionClassName } = props; + const { trigger, actions, disabled, className, actionsClassName, positionClassName } = props; const [dropdownStatus, toggleDropdownStatus] = useToggle(false); const dropdownWrapperRef = useRef(null); @@ -29,11 +30,18 @@ const Dropdown: React.FC = (props: Props) => { } }, [dropdownStatus]); + const handleDropdownClick = () => { + if (disabled) { + return; + } + toggleDropdownStatus(); + }; + return (
toggleDropdownStatus()} + onClick={handleDropdownClick} > {trigger ? ( trigger diff --git a/web/src/pages/About.tsx b/web/src/pages/About.tsx new file mode 100644 index 00000000..b21009f5 --- /dev/null +++ b/web/src/pages/About.tsx @@ -0,0 +1,36 @@ +import { Link } from "@mui/joy"; +import Icon from "@/components/Icon"; +import MobileHeader from "@/components/MobileHeader"; + +const About = () => { + return ( +
+ +
+
+ +

A privacy-first, lightweight note-taking service. Easily capture and share your great thoughts.

+
+ + GitHub Repo + + + + Offical Website + + + + Blogs + + + + Documents + +
+
+
+
+ ); +}; + +export default About; diff --git a/web/src/pages/UserProfile.tsx b/web/src/pages/UserProfile.tsx index 7a2cd19b..675d8e91 100644 --- a/web/src/pages/UserProfile.tsx +++ b/web/src/pages/UserProfile.tsx @@ -10,7 +10,6 @@ import UserAvatar from "@/components/UserAvatar"; import { DEFAULT_MEMO_LIMIT } from "@/helpers/consts"; import { getTimeStampByDate } from "@/helpers/datetime"; import useLoading from "@/hooks/useLoading"; -import { useFilterStore } from "@/store/module"; import { useMemoList, useMemoStore, useUserStore } from "@/store/v1"; import { User } from "@/types/proto/api/v2/user_service"; import { useTranslate } from "@/utils/i18n"; @@ -21,12 +20,10 @@ const UserProfile = () => { const userStore = useUserStore(); const loadingState = useLoading(); const [user, setUser] = useState(); - const filterStore = useFilterStore(); const memoStore = useMemoStore(); const memoList = useMemoList(); const [isRequesting, setIsRequesting] = useState(true); const [isComplete, setIsComplete] = useState(false); - const { tag: tagQuery, text: textQuery } = filterStore.state; const sortedMemos = memoList.value .sort((a, b) => getTimeStampByDate(b.displayTime) - getTimeStampByDate(a.displayTime)) .sort((a, b) => Number(b.pinned) - Number(a.pinned)); @@ -56,7 +53,7 @@ const UserProfile = () => { memoList.reset(); fetchMemos(); - }, [user, tagQuery, textQuery]); + }, [user]); const fetchMemos = async () => { if (!user) { @@ -64,16 +61,6 @@ const UserProfile = () => { } const filters = [`creator == "${user.name}"`, `row_status == "NORMAL"`, `order_by_pinned == true`]; - const contentSearch: string[] = []; - if (tagQuery) { - contentSearch.push(`"#${tagQuery}"`); - } - if (textQuery) { - contentSearch.push(`"${textQuery}"`); - } - if (contentSearch.length > 0) { - filters.push(`content_search == [${contentSearch.join(", ")}]`); - } setIsRequesting(true); const data = await memoStore.fetchMemos({ filter: filters.join(" && "), @@ -91,18 +78,17 @@ const UserProfile = () => { {!loadingState.isLoading && (user ? ( <> +

{user?.nickname}

- - -
{sortedMemos.map((memo) => ( diff --git a/web/src/router/index.tsx b/web/src/router/index.tsx index 8c7369b7..06db028a 100644 --- a/web/src/router/index.tsx +++ b/web/src/router/index.tsx @@ -18,6 +18,7 @@ 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")); @@ -118,6 +119,10 @@ const router = createBrowserRouter([ path: "u/:username", element: , }, + { + path: "about", + element: , + }, { path: "403", element: ,