Your Mood Journey
+My Mood Journey
Visualizing your emotional well-being over the last {timeRange} days.
{formatMonth(currentDate)}
diff --git a/web/src/components/MoodCenter.tsx b/web/src/components/MoodCenter.tsx
index ac3a4b3..447cf18 100644
--- a/web/src/components/MoodCenter.tsx
+++ b/web/src/components/MoodCenter.tsx
@@ -1,4 +1,5 @@
-import { useState, useEffect, useCallback, useRef } from 'react';
+import { useState, useEffect, useCallback } from 'react';
+import { useNavigate } from 'react-router-dom';
import { useAuth } from '../auth/AuthContext';
import { useToast } from './ToastProvider';
import { api } from '../service';
@@ -8,6 +9,7 @@ import { emotionSpectrum, positiveEmotions, negativeEmotions } from "../config/e
export default function MoodCenter() {
const { user } = useAuth();
const toast = useToast();
+ const navigate = useNavigate();
const [inputText, setInputText] = useState('');
const [isSubmitting, setIsSubmitting] = useState(false);
const [moodHistory, setMoodHistory] = useState([]);
@@ -94,14 +96,16 @@ export default function MoodCenter() {
-
- restaurant
+ navigate('/my-mood?kind=positive')} className={`size-12 rounded-full bg-orange-100 dark:bg-orange-900/30 flex items-center justify-center text-orange-500 ${positiveAnimating ? 'animate-glow' : ''}`}>
+
Candy Jar
Store joy
-
+ navigate('/my-mood?kind=negative')} className={`size-12 rounded-full bg-slate-100 dark:bg-slate-900/50 flex items-center justify-center text-slate-400 ${negativeAnimating ? 'animate-shake' : ''}`}>
delete_outline
Recycle
diff --git a/web/src/components/SentimentDistribution.tsx b/web/src/components/SentimentDistribution.tsx
index 72b4159..bc12125 100644
--- a/web/src/components/SentimentDistribution.tsx
+++ b/web/src/components/SentimentDistribution.tsx
@@ -1,24 +1,11 @@
import type { TeamMoodDistribution } from '../service/types';
+import { emotionSpectrum } from "../config/enum";
+
interface SentimentDistributionProps {
distribution: TeamMoodDistribution[];
}
-const emotionLabels: Record = {
- joyful: 'Joyful',
- calm: 'Calm',
- anxious: 'Anxious',
- stressed: 'Stressed',
- excited: 'Excited',
- tired: 'Tired',
- grateful: 'Grateful',
- frustrated: 'Frustrated',
- positive: 'Positive',
- neutral: 'Neutral',
- negative: 'Negative',
- productive: 'Productive',
-};
-
const pieColors = ['#22C55E', '#EAB308', '#DC2626', '#F97316', '#1E40AF', '#EC4899', '#9CA3AF', '#6B7280'];
export default function SentimentDistribution({ distribution }: SentimentDistributionProps) {
@@ -60,7 +47,7 @@ export default function SentimentDistribution({ distribution }: SentimentDistrib
style={{ backgroundColor: pieColors[index % pieColors.length] }}
/>
- {emotionLabels[item.emotion] || item.emotion} ({item.percentage}%)
+ {emotionSpectrum[item.emotion]?.label || item.emotion} ({item.percentage}%)
))}
diff --git a/web/src/config/enum.ts b/web/src/config/enum.ts
index 26c1b9d..3effcc5 100644
--- a/web/src/config/enum.ts
+++ b/web/src/config/enum.ts
@@ -1,13 +1,13 @@
// 情绪光谱系统配置
-export const emotionSpectrum: Record = {
- stress: { color: '#6B7280', icon: 'delete_outline' },
- boredom: { color: '#9CA3AF', icon: 'hourglass_empty' },
- anxiety: { color: '#1E40AF', icon: 'cloud' },
- anger: { color: '#DC2626', icon: 'local_fire_department' },
- joy: { color: '#F97316', icon: 'restaurant' },
- achievement: { color: '#EAB308', icon: 'star' },
- warmth: { color: '#EC4899', icon: 'lightbulb' },
- calm: { color: '#22C55E', icon: 'eco' },
+export const emotionSpectrum: Record = {
+ stress: { label: 'Stressed', color: '#6B7280', icon: 'delete_outline' },
+ boredom: { label: 'Boredom', color: '#9CA3AF', icon: 'hourglass_empty' },
+ anxiety: { label: 'Anxious', color: '#1E40AF', icon: 'cloud' },
+ anger: { label: 'Anger', color: '#DC2626', icon: 'local_fire_department' },
+ joy: { label: 'Joyful', color: '#F97316', icon: 'restaurant' },
+ achievement: { label: 'Achievement', color: '#EAB308', icon: 'star' },
+ warmth: { label: 'Warmth', color: '#EC4899', icon: 'lightbulb' },
+ calm: { label: 'Calm', color: '#22C55E', icon: 'eco' },
};
// 积极情绪列表
diff --git a/web/src/pages/GroupMood.tsx b/web/src/pages/GroupMood.tsx
index 6da07c5..e82014e 100644
--- a/web/src/pages/GroupMood.tsx
+++ b/web/src/pages/GroupMood.tsx
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
import { useAuth } from '../auth/AuthContext';
import { api } from '../service';
import type { TeamMoodStats, TeamMoodDistribution, TeamMoodTrend, TeamInsights } from '../service/types';
+import { emotionSpectrum } from "../config/enum";
import GroupMoodCalendar from '../components/GroupMoodCalendar';
import GroupMoodTrendChart from '../components/GroupMoodTrendChart';
import SentimentDistribution from '../components/SentimentDistribution';
@@ -10,21 +11,6 @@ import TeamInsightsCard from '../components/TeamInsights';
import GroupActionableAdvice from '../components/GroupActionableAdvice';
import StatCard from '../components/StatCard';
-// 情绪标签映射
-const emotionLabels: Record = {
- joyful: 'Joyful',
- calm: 'Calm',
- anxious: 'Anxious',
- stressed: 'Stressed',
- excited: 'Excited',
- tired: 'Tired',
- grateful: 'Grateful',
- frustrated: 'Frustrated',
- positive: 'Positive',
- neutral: 'Neutral',
- negative: 'Negative',
- productive: 'Productive',
-};
export default function GroupMood() {
const navigate = useNavigate();
@@ -175,7 +161,7 @@ export default function GroupMood() {
title="Average Sentiment"
icon="sentiment_satisfied"
iconColor="text-green-500"
- value={stats?.topEmotion ? emotionLabels[stats.topEmotion] || stats.topEmotion : 'Neutral'}
+ value={stats?.topEmotion ? emotionSpectrum[stats.topEmotion]?.label || stats.topEmotion : 'Neutral'}
footer={
<>
trending_up
diff --git a/web/src/pages/MyMood.tsx b/web/src/pages/MyMood.tsx
index 766c32c..069c837 100644
--- a/web/src/pages/MyMood.tsx
+++ b/web/src/pages/MyMood.tsx
@@ -6,24 +6,16 @@ import type { Mood } from '../service/types';
import MoodCalendar from '../components/MoodCalendar';
import MoodTrendChart from '../components/MoodTrendChart';
+import { emotionSpectrum } from "../config/enum";
+
+
interface MoodStats {
total: number;
- currentStreak: number;
- topEmotion: string | null;
+ streakDays: number;
+ mostFrequentMood: string | null;
moodDistribution: Record;
}
-const emotionLabels: Record = {
- joyful: 'Joyful',
- calm: 'Calm',
- anxious: 'Anxious',
- stressed: 'Stressed',
- excited: 'Excited',
- tired: 'Tired',
- grateful: 'Grateful',
- frustrated: 'Frustrated',
-};
-
export default function MyMood() {
const navigate = useNavigate();
const { user } = useAuth();
@@ -153,7 +145,7 @@ export default function MyMood() {
Current Streak
- {stats?.currentStreak || 0} Days
+ {stats?.streakDays || 0} Days
@@ -171,22 +163,26 @@ export default function MyMood() {
Top Emotion
- {stats?.topEmotion ? emotionLabels[stats.topEmotion] || stats.topEmotion : 'None'}
+ {stats?.mostFrequentMood ? emotionSpectrum[stats.mostFrequentMood]?.label || stats.mostFrequentMood : 'None'}
Store joy
Current Streak
-{stats?.currentStreak || 0} Days
+{stats?.streakDays || 0} Days
Top Emotion
-{stats?.topEmotion ? emotionLabels[stats.topEmotion] || stats.topEmotion : 'None'}
+{stats?.mostFrequentMood ? emotionSpectrum[stats.mostFrequentMood]?.label || stats.mostFrequentMood : 'None'}
Weekly Mood Insight
- {stats?.topEmotion - ? `You've been feeling mostly ${emotionLabels[stats.topEmotion] || stats.topEmotion.toLowerCase()}. Keep tracking your mood to discover patterns!` + {stats?.mostFrequentMood + ? `You've been feeling mostly ${emotionSpectrum[stats.mostFrequentMood].label || stats.mostFrequentMood.toLowerCase()}. Keep tracking your mood to discover patterns!` : 'Start logging your mood daily to receive personalized insights about your emotional patterns.'}