Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update sidebar components
Stevenea6628066d07
diff --git a/server/route/api/v2/tag_service.go b/server/route/api/v2/tag_service.goindex 35f75fe16..431c596d3 100644--- a/server/route/api/v2/tag_service.go+++ b/server/route/api/v2/tag_service.go@@ -51,22 +51,13 @@ func (s *APIV2Service) BatchUpsertTag(ctx context.Context, request *apiv2pb.Batc}func (s *APIV2Service) ListTags(ctx context.Context, request *apiv2pb.ListTagsRequest) (*apiv2pb.ListTagsResponse, error) {+ tagFind := &store.FindTag{}userID, err := ExtractUserIDFromName(request.User)if err != nil {return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err)}- user, err := s.Store.GetUser(ctx, &store.FindUser{- ID: &userID,- })- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)- }- if user == nil {- return nil, status.Errorf(codes.NotFound, "user not found")- }- tags, err := s.Store.ListTags(ctx, &store.FindTag{- CreatorID: user.ID,- })+ tagFind.CreatorID = userID+ tags, err := s.Store.ListTags(ctx, tagFind)if err != nil {return nil, status.Errorf(codes.Internal, "failed to list tags: %v", err)}diff --git a/web/src/components/ExploreSidebar/ExploreSidebar.tsx b/web/src/components/ExploreSidebar/ExploreSidebar.tsxindex 3b2a8a6ac..ab2744f55 100644--- a/web/src/components/ExploreSidebar/ExploreSidebar.tsx+++ b/web/src/components/ExploreSidebar/ExploreSidebar.tsx@@ -1,6 +1,6 @@import classNames from "classnames";import SearchBar from "@/components/SearchBar";-import UserList from "../UserList";+import UsersSection from "./UsersSection";interface Props {className?: string;@@ -15,7 +15,7 @@ const ExploreSidebar = (props: Props) => {)}><SearchBar />- <UserList />+ <UsersSection /></aside>);};diff --git a/web/src/components/UserList.tsx b/web/src/components/ExploreSidebar/UsersSection.tsxsimilarity index 93%rename from web/src/components/UserList.tsxrename to web/src/components/ExploreSidebar/UsersSection.tsxindex 25f2568ec..f4bb02513 100644--- a/web/src/components/UserList.tsx+++ b/web/src/components/ExploreSidebar/UsersSection.tsx@@ -3,10 +3,10 @@ import { useEffect, useState } from "react";import { Link } from "react-router-dom";import { useUserStore } from "@/store/v1";import { User } from "@/types/proto/api/v2/user_service";-import Icon from "./Icon";-import UserAvatar from "./UserAvatar";+import Icon from "../Icon";+import UserAvatar from "../UserAvatar";-const UserList = () => {+const UsersSection = () => {const userStore = useUserStore();const [users, setUsers] = useState<User[]>([]);@@ -48,4 +48,4 @@ const UserList = () => {);};-export default UserList;+export default UsersSection;diff --git a/web/src/components/HomeSidebar/HomeSidebar.tsx b/web/src/components/HomeSidebar/HomeSidebar.tsxindex c0fec52dd..d6fca6fcf 100644--- a/web/src/components/HomeSidebar/HomeSidebar.tsx+++ b/web/src/components/HomeSidebar/HomeSidebar.tsx@@ -1,8 +1,8 @@import classNames from "classnames";import PersonalStatistics from "@/components/PersonalStatistics";import SearchBar from "@/components/SearchBar";-import TagList from "@/components/TagList";import useCurrentUser from "@/hooks/useCurrentUser";+import TagsSection from "./TagsSection";interface Props {className?: string;@@ -20,7 +20,7 @@ const HomeSidebar = (props: Props) => {><SearchBar /><PersonalStatistics user={currentUser} />- <TagList />+ <TagsSection /></aside>);};diff --git a/web/src/components/TagList.tsx b/web/src/components/HomeSidebar/TagsSection.tsxsimilarity index 95%rename from web/src/components/TagList.tsxrename to web/src/components/HomeSidebar/TagsSection.tsxindex 2ad1c4047..a45c8d35a 100644--- a/web/src/components/TagList.tsx+++ b/web/src/components/HomeSidebar/TagsSection.tsx@@ -4,10 +4,10 @@ import useToggle from "react-use/lib/useToggle";import { useFilterStore, useTagStore } from "@/store/module";import { useMemoList } from "@/store/v1";import { useTranslate } from "@/utils/i18n";-import showCreateTagDialog from "./CreateTagDialog";-import { showCommonDialog } from "./Dialog/CommonDialog";-import Icon from "./Icon";-import showRenameTagDialog from "./RenameTagDialog";+import showCreateTagDialog from "../CreateTagDialog";+import { showCommonDialog } from "../Dialog/CommonDialog";+import Icon from "../Icon";+import showRenameTagDialog from "../RenameTagDialog";interface KVObject<T = any> {[key: string]: T;@@ -19,7 +19,7 @@ interface Tag {subTags: Tag[];}-const TagList = () => {+const TagsSection = () => {const t = useTranslate();const filterStore = useFilterStore();const tagStore = useTagStore();@@ -195,4 +195,4 @@ const TagItemContainer: React.FC<TagItemContainerProps> = (props: TagItemContain);};-export default TagList;+export default TagsSection;diff --git a/web/src/components/TimelineSidebar.tsx b/web/src/components/TimelineSidebar/TimelineSidebar.tsxsimilarity index 78%rename from web/src/components/TimelineSidebar.tsxrename to web/src/components/TimelineSidebar/TimelineSidebar.tsxindex 483e12d6b..bd670d8e0 100644--- a/web/src/components/TimelineSidebar.tsx+++ b/web/src/components/TimelineSidebar/TimelineSidebar.tsx@@ -1,6 +1,6 @@import classNames from "classnames";-import SearchBar from "./SearchBar";-import TagList from "./TagList";+import TagsSection from "../HomeSidebar/TagsSection";+import SearchBar from "../SearchBar";interface Props {className?: string;@@ -15,7 +15,7 @@ const TimelineSidebar = (props: Props) => {)}><SearchBar />- <TagList />+ <TagsSection /></aside>);};diff --git a/web/src/components/TimelineSidebarDrawer.tsx b/web/src/components/TimelineSidebar/TimelineSidebarDrawer.tsxsimilarity index 97%rename from web/src/components/TimelineSidebarDrawer.tsxrename to web/src/components/TimelineSidebar/TimelineSidebarDrawer.tsxindex a281f99ff..175c102ac 100644--- a/web/src/components/TimelineSidebarDrawer.tsx+++ b/web/src/components/TimelineSidebar/TimelineSidebarDrawer.tsx@@ -1,7 +1,7 @@import { Drawer, IconButton } from "@mui/joy";import { useEffect, useState } from "react";import { useLocation } from "react-router-dom";-import Icon from "./Icon";+import Icon from "../Icon";import TimelineSidebar from "./TimelineSidebar";const TimelineSidebarDrawer = () => {diff --git a/web/src/components/TimelineSidebar/index.ts b/web/src/components/TimelineSidebar/index.tsnew file mode 100644index 000000000..b5dbfcf58--- /dev/null+++ b/web/src/components/TimelineSidebar/index.ts@@ -0,0 +1,4 @@+import TimelineSidebar from "./TimelineSidebar";+import TimelineSidebarDrawer from "./TimelineSidebarDrawer";++export { TimelineSidebar, TimelineSidebarDrawer };diff --git a/web/src/pages/Timeline.tsx b/web/src/pages/Timeline.tsxindex a4048d35a..956016379 100644--- a/web/src/pages/Timeline.tsx+++ b/web/src/pages/Timeline.tsx@@ -8,8 +8,7 @@ import showMemoEditorDialog from "@/components/MemoEditor/MemoEditorDialog";import MemoFilter from "@/components/MemoFilter";import MemoView from "@/components/MemoView";import MobileHeader from "@/components/MobileHeader";-import TimelineSidebar from "@/components/TimelineSidebar";-import TimelineSidebarDrawer from "@/components/TimelineSidebarDrawer";+import { TimelineSidebar, TimelineSidebarDrawer } from "@/components/TimelineSidebar";import { memoServiceClient } from "@/grpcweb";import { DAILY_TIMESTAMP, DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/helpers/consts";import { getNormalizedTimeString, getTimeStampByDate } from "@/helpers/datetime";