From 65c28251f95cebc3965093cb1719184d3fd48132 Mon Sep 17 00:00:00 2001 From: wxj Date: Tue, 30 Jun 2026 14:35:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E8=81=94?= =?UTF-8?q?=E5=8A=A8=E6=95=B0=E6=8D=AE=EF=BC=9ADashboard=20=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20rangeKey=20=E7=8A=B6=E6=80=81=EF=BC=8CuseDashboardD?= =?UTF-8?q?ata=20=E6=8C=89=E5=A4=A9=E6=95=B0=E7=94=9F=E6=88=90=20dailyStat?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/dashboard/BentoTrend.jsx | 11 ++++++----- web/src/components/dashboard/index.jsx | 20 +++++++++++++++++--- web/src/hooks/dashboard/useDashboardData.js | 6 +++--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/web/src/components/dashboard/BentoTrend.jsx b/web/src/components/dashboard/BentoTrend.jsx index 9f5cde0..2e55665 100644 --- a/web/src/components/dashboard/BentoTrend.jsx +++ b/web/src/components/dashboard/BentoTrend.jsx @@ -48,9 +48,10 @@ const BentoTrend = ({ className = '', onRefresh, loading = false, + rangeKey = '7d', + onRangeChange, }) => { const [rangeOpen, setRangeOpen] = useState(false); - const [selectedKey, setSelectedKey] = useState('7d'); const [customStart, setCustomStart] = useState(''); const [customEnd, setCustomEnd] = useState(''); const [tooltip, setTooltip] = useState(null); // { dayIdx, x, y } or null @@ -67,11 +68,11 @@ const BentoTrend = ({ return () => document.removeEventListener('mousedown', handler); }, []); - const selectedLabel = RANGE_OPTIONS.find((r) => r.key === selectedKey)?.label || '近 7 天'; + const selectedLabel = RANGE_OPTIONS.find((r) => r.key === rangeKey)?.label || '近 7 天'; const handleApply = () => { if (customStart && customEnd) { - setSelectedKey('custom'); + onRangeChange('custom'); } setRangeOpen(false); }; @@ -150,13 +151,13 @@ const BentoTrend = ({