diff --git a/web/src/components/StatisticsView/StatCard.tsx b/web/src/components/StatisticsView/StatCard.tsx
index e33a58160..48673a579 100644
--- a/web/src/components/StatisticsView/StatCard.tsx
+++ b/web/src/components/StatisticsView/StatCard.tsx
@@ -1,37 +1,55 @@
+import { cloneElement, isValidElement } from "react";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import type { StatCardProps } from "@/types/statistics";
export const StatCard = ({ icon, label, count, onClick, tooltip, className }: StatCardProps) => {
- const content = (
-
{
+ if (typeof count === "number" || typeof count === "string") {
+ return
{count};
+ }
+ if (isValidElement(count)) {
+ return cloneElement(count, {
+ className: cn("text-foreground/80", count.props.className),
+ });
+ }
+ return
{count};
+ })();
+
+ const button = (
+
+ {iconNode}
+ {label}
+ {countNode}
+
);
- if (tooltip) {
- return (
-
-
- {content}
-
- {tooltip}
-
-
-
- );
+ if (!tooltip) {
+ return button;
}
- return content;
+ return (
+
+
+ {button}
+
+ {tooltip}
+
+
+
+ );
};
diff --git a/web/src/components/StatisticsView/StatisticsView.tsx b/web/src/components/StatisticsView/StatisticsView.tsx
index feed59ba5..387a97a7c 100644
--- a/web/src/components/StatisticsView/StatisticsView.tsx
+++ b/web/src/components/StatisticsView/StatisticsView.tsx
@@ -46,10 +46,10 @@ const StatisticsView = observer(() => {
/>
-
+
{isRootPath && hasPinnedMemos && (
}
+ icon={}
label={t("common.pinned")}
count={userStore.state.currentUserStats!.pinnedMemos.length}
onClick={() => handleFilterClick("pinned")}
@@ -57,20 +57,14 @@ const StatisticsView = observer(() => {
)}
}
+ icon={}
label={t("memo.links")}
count={memoTypeStats.linkCount}
onClick={() => handleFilterClick("property.hasLink")}
/>
0 ? (
-
- ) : (
-
- )
- }
+ icon={memoTypeStats.undoCount > 0 ? : }
label={t("memo.to-do")}
count={
memoTypeStats.undoCount > 0 ? (
@@ -88,7 +82,7 @@ const StatisticsView = observer(() => {
/>
}
+ icon={}
label={t("memo.code")}
count={memoTypeStats.codeCount}
onClick={() => handleFilterClick("property.hasCode")}