From cf70867470a8cdf8624c63476b0325778b260a88 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 29 May 2024 08:03:01 +0800 Subject: [PATCH] chore: update tag section --- .../components/HomeSidebar/TagsSection.tsx | 34 +++---------------- web/src/components/UserStatisticsView.tsx | 30 ++++++++++++++-- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/web/src/components/HomeSidebar/TagsSection.tsx b/web/src/components/HomeSidebar/TagsSection.tsx index 01eca7632..aa150208e 100644 --- a/web/src/components/HomeSidebar/TagsSection.tsx +++ b/web/src/components/HomeSidebar/TagsSection.tsx @@ -1,5 +1,4 @@ -import { Dropdown, Menu, MenuButton, MenuItem, Tooltip } from "@mui/joy"; -import clsx from "clsx"; +import { Dropdown, Menu, MenuButton, MenuItem } from "@mui/joy"; import toast from "react-hot-toast"; import { useLocation } from "react-router-dom"; import useDebounce from "react-use/lib/useDebounce"; @@ -42,36 +41,11 @@ const TagsSection = (props: Props) => { await tagStore.fetchTags(filters.join(" && ")); }; - const handleRebuildMemoTags = () => { - showCommonDialog({ - title: "Rebuild tags", - content: "It will rebuild tags for all memos, are you sure?", - style: "warning", - dialogName: "rebuild-memo-tags-dialog", - onConfirm: async () => { - await memoServiceClient.rebuildMemoProperty({ - name: "memos/-", - }); - await fetchTags(); - toast.success("Rebuild tags successfully"); - }, - }); - }; - return (
-
- {t("common.tags")} - {!props.readonly && ( -
0 ? "hidden" : "")}> - - - -
- )} +
+ {t("common.tags")} + {tagAmounts.length > 0 && ({tagAmounts.length})}
{tagAmounts.length > 0 ? (
diff --git a/web/src/components/UserStatisticsView.tsx b/web/src/components/UserStatisticsView.tsx index 3d13ed811..e9bb6c7c5 100644 --- a/web/src/components/UserStatisticsView.tsx +++ b/web/src/components/UserStatisticsView.tsx @@ -1,10 +1,12 @@ -import { Divider } from "@mui/joy"; +import { Divider, Tooltip } from "@mui/joy"; import { useEffect, useState } from "react"; +import toast from "react-hot-toast"; import { memoServiceClient } from "@/grpcweb"; import { useFilterStore } from "@/store/module"; import { useMemoStore } from "@/store/v1"; import { User } from "@/types/proto/api/v1/user_service"; import { useTranslate } from "@/utils/i18n"; +import { showCommonDialog } from "./Dialog/CommonDialog"; import Icon from "./Icon"; interface Props { @@ -52,10 +54,34 @@ const UserStatisticsView = (props: Props) => { })(); }, [memos.length, user.name]); + const handleRebuildMemoTags = () => { + showCommonDialog({ + title: "Refresh", + content: "It will refersh memo properties, are you sure?", + style: "warning", + dialogName: "refersh-memo-property-dialog", + onConfirm: async () => { + await memoServiceClient.rebuildMemoProperty({ + name: "memos/-", + }); + toast.success("Refresh successfully"); + window.location.reload(); + }, + }); + }; + return (
-
+

{t("common.statistics")}

+
+ + + +