From 842257165badde882bcb29e695cc94655bc4f6d5 Mon Sep 17 00:00:00 2001 From: admin <1297598740@qq.com> Date: Thu, 29 Jan 2026 11:01:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20DailyInsightCard?= =?UTF-8?q?=20=E7=BB=84=E4=BB=B6=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=AF=8F=E6=97=A5=E6=B6=88=E8=B4=B9=E6=B4=9E=E5=AF=9F?= =?UTF-8?q?=E3=80=81=E9=A2=84=E7=AE=97=E5=88=86=E6=9E=90=E5=8F=8AAI?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=AE=80=E6=8A=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DailyInsightCard/DailyInsightCard.tsx | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/home/DailyInsightCard/DailyInsightCard.tsx b/src/components/home/DailyInsightCard/DailyInsightCard.tsx index bfd82f7..b7cf788 100644 --- a/src/components/home/DailyInsightCard/DailyInsightCard.tsx +++ b/src/components/home/DailyInsightCard/DailyInsightCard.tsx @@ -90,8 +90,25 @@ export const DailyInsightCard: React.FC = ({ return () => clearTimeout(timer); }, [todaySpend, yesterdaySpend, monthlyBudget, monthlySpent, topCategory, maxTransaction, lastWeekSpend, streakDays, budgetRemaining, daysRemaining, weeklyTotal, avgDailySpend, top3Categories, todayTransactionCount, last7DaysSpend, recentTransactions]); + // Helper to render text with newlines and bolding + const FormattedText = ({ text }: { text: string }) => { + return ( + <> + {text.split('\n').map((line, i) => ( + + {line.split(/(\*\*.*?\*\*)/).map((part, j) => + part.startsWith('**') && part.endsWith('**') ? + {part.slice(2, -2)} : + part + )} + + ))} + + ); + }; + const getSpendingInsight = (today: number, yesterday: number) => { - if (aiData) return { text: {aiData.spending}, type: 'ai' }; + if (aiData) return { text: , type: 'ai' }; if (today === 0) return { text: "今天还没有花钱,保持这种“零消费”状态就是最大的赚钱!", type: 'success' }; @@ -110,7 +127,7 @@ export const DailyInsightCard: React.FC = ({ }; const getBudgetInsight = (spent: number, total: number) => { - if (aiData) return { text: {aiData.budget}, type: 'ai' }; + if (aiData) return { text: , type: 'ai' }; if (total === 0) return { text: "您还没有设置月度预算,建议去设置一个。", type: 'normal' };