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' };