feat: 移除目标管理演示页面并优化相关组件

- 删除目标管理演示页面的代码,简化项目结构
- 更新底部导航,移除目标管理演示页面的路由
- 调整相关组件的样式和逻辑,确保界面一致性
- 优化颜色常量的使用,提升视觉效果
This commit is contained in:
2025-08-22 21:24:31 +08:00
parent 9e719a9eda
commit c12329bc96
16 changed files with 1130 additions and 759 deletions

View File

@@ -195,11 +195,15 @@ export default function MoodCalendarScreen() {
return (
<View style={styles.container}>
<LinearGradient
colors={backgroundGradientColors}
colors={['#fafaff', '#f4f3ff']} // 使用紫色主题的浅色渐变
style={styles.gradientBackground}
start={{ x: 0, y: 0 }}
end={{ x: 0, y: 1 }}
/>
{/* 装饰性圆圈 */}
<View style={styles.decorativeCircle1} />
<View style={styles.decorativeCircle2} />
<SafeAreaView style={styles.safeArea}>
<HeaderBar
title="心情日历"
@@ -345,6 +349,26 @@ const styles = StyleSheet.create({
top: 0,
bottom: 0,
},
decorativeCircle1: {
position: 'absolute',
top: 40,
right: 20,
width: 60,
height: 60,
borderRadius: 30,
backgroundColor: '#7a5af8',
opacity: 0.08,
},
decorativeCircle2: {
position: 'absolute',
bottom: -15,
left: -15,
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: '#7a5af8',
opacity: 0.04,
},
safeArea: {
flex: 1,
},
@@ -353,45 +377,56 @@ const styles = StyleSheet.create({
flex: 1,
},
calendar: {
backgroundColor: '#fff',
backgroundColor: 'rgba(255,255,255,0.95)',
margin: 16,
borderRadius: 16,
padding: 16,
borderRadius: 20,
padding: 20,
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
shadowRadius: 12,
elevation: 6,
},
monthNavigation: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: 20,
marginBottom: 24,
},
navButton: {
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: '#f8f9fa',
width: 44,
height: 44,
borderRadius: 22,
backgroundColor: 'rgba(122,90,248,0.1)',
justifyContent: 'center',
alignItems: 'center',
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 4,
elevation: 2,
},
navButtonText: {
fontSize: 20,
color: '#333',
fontWeight: '600',
fontSize: 24,
color: '#7a5af8',
fontWeight: '700',
},
monthTitle: {
fontSize: 18,
fontWeight: '700',
fontSize: 20,
fontWeight: '800',
color: '#192126',
},
weekHeader: {
flexDirection: 'row',
justifyContent: 'space-around',
marginBottom: 16,
marginBottom: 20,
},
weekDay: {
fontSize: 14,
color: '#666',
fontSize: 13,
color: '#5d6676',
textAlign: 'center',
width: (width - 96) / 7,
fontWeight: '600',
},
weekRow: {
flexDirection: 'row',
@@ -403,19 +438,25 @@ const styles = StyleSheet.create({
alignItems: 'center',
},
dayButton: {
width: 40,
height: 40,
borderRadius: 20,
width: 44,
height: 44,
borderRadius: 22,
justifyContent: 'center',
alignItems: 'center',
marginBottom: 8,
backgroundColor: 'transparent',
},
dayButtonSelected: {
backgroundColor: Colors.light.accentGreen,
backgroundColor: '#FFFFFF',
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.15,
shadowRadius: 6,
elevation: 4,
},
dayButtonToday: {
borderWidth: 2,
borderColor: Colors.light.accentGreen,
borderColor: '#7a5af8',
},
dayContent: {
position: 'relative',
@@ -426,142 +467,174 @@ const styles = StyleSheet.create({
},
dayNumber: {
fontSize: 14,
color: '#999',
fontWeight: '500',
color: '#777f8c',
fontWeight: '600',
position: 'absolute',
top: 2,
zIndex: 1,
},
dayNumberSelected: {
color: '#FFFFFF',
fontWeight: '600',
color: '#192126',
fontWeight: '700',
},
dayNumberToday: {
color: Colors.light.accentGreen,
fontWeight: '600',
color: '#7a5af8',
fontWeight: '700',
},
dayNumberDisabled: {
color: '#ccc',
color: '#c0c4ca',
},
moodIconContainer: {
position: 'absolute',
bottom: 2,
width: 20,
height: 20,
borderRadius: 10,
width: 22,
height: 22,
borderRadius: 11,
justifyContent: 'center',
alignItems: 'center',
shadowColor: '#000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.1,
shadowRadius: 2,
elevation: 1,
},
moodIcon: {
width: 16,
height: 16,
borderRadius: 8,
backgroundColor: 'rgba(255,255,255,0.9)',
width: 18,
height: 18,
borderRadius: 9,
backgroundColor: 'rgba(255,255,255,0.95)',
justifyContent: 'center',
alignItems: 'center',
},
moodEmoji: {
fontSize: 12,
fontSize: 11,
},
defaultMoodIcon: {
position: 'absolute',
bottom: 2,
width: 20,
height: 20,
borderRadius: 10,
borderWidth: 1,
borderColor: '#ddd',
width: 22,
height: 22,
borderRadius: 11,
borderWidth: 1.5,
borderColor: 'rgba(122,90,248,0.3)',
borderStyle: 'dashed',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(122,90,248,0.05)',
},
defaultMoodEmoji: {
fontSize: 10,
opacity: 0.3,
opacity: 0.4,
color: '#7a5af8',
},
selectedDateSection: {
backgroundColor: '#fff',
backgroundColor: 'rgba(255,255,255,0.95)',
margin: 16,
marginTop: 0,
borderRadius: 16,
padding: 16,
borderRadius: 20,
padding: 20,
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
shadowRadius: 12,
elevation: 6,
},
selectedDateHeader: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: 16,
marginBottom: 20,
},
selectedDateTitle: {
fontSize: 20,
fontWeight: '700',
fontSize: 22,
fontWeight: '800',
color: '#192126',
},
addMoodButton: {
paddingHorizontal: 16,
height: 32,
borderRadius: 16,
backgroundColor: Colors.light.accentGreen,
paddingHorizontal: 20,
height: 36,
borderRadius: 18,
backgroundColor: '#7a5af8',
justifyContent: 'center',
alignItems: 'center',
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowRadius: 4,
elevation: 3,
},
addMoodButtonText: {
color: '#fff',
fontSize: 14,
fontWeight: '600',
fontWeight: '700',
},
moodRecord: {
flexDirection: 'row',
alignItems: 'flex-start',
paddingVertical: 12,
paddingVertical: 16,
backgroundColor: 'rgba(122,90,248,0.05)',
borderRadius: 16,
paddingHorizontal: 16,
},
recordIcon: {
width: 48,
height: 48,
borderRadius: 24,
backgroundColor: Colors.light.accentGreen,
width: 52,
height: 52,
borderRadius: 26,
backgroundColor: '#7a5af8',
justifyContent: 'center',
alignItems: 'center',
marginRight: 12,
marginRight: 16,
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.15,
shadowRadius: 4,
elevation: 2,
},
recordContent: {
flex: 1,
},
recordMood: {
fontSize: 16,
color: '#333',
fontWeight: '500',
fontSize: 18,
color: '#192126',
fontWeight: '700',
marginBottom: 4,
},
recordIntensity: {
fontSize: 14,
color: '#666',
color: '#5d6676',
marginTop: 2,
fontWeight: '500',
},
recordDescription: {
fontSize: 14,
color: '#666',
marginTop: 4,
color: '#5d6676',
marginTop: 6,
fontStyle: 'italic',
lineHeight: 20,
},
spacer: {
flex: 1,
},
recordTime: {
fontSize: 14,
color: '#999',
color: '#777f8c',
fontWeight: '500',
},
emptyRecord: {
alignItems: 'center',
paddingVertical: 20,
paddingVertical: 32,
},
emptyRecordText: {
fontSize: 16,
color: '#666',
color: '#5d6676',
marginBottom: 8,
fontWeight: '600',
},
emptyRecordSubtext: {
fontSize: 12,
color: '#999',
fontSize: 13,
color: '#777f8c',
textAlign: 'center',
lineHeight: 18,
},
});

View File

@@ -4,25 +4,25 @@ import { useAppDispatch, useAppSelector } from '@/hooks/redux';
import { useColorScheme } from '@/hooks/useColorScheme';
import { getMoodOptions, MoodType } from '@/services/moodCheckins';
import {
createMoodRecord,
deleteMoodRecord,
fetchDailyMoodCheckins,
selectMoodRecordsByDate,
updateMoodRecord
createMoodRecord,
deleteMoodRecord,
fetchDailyMoodCheckins,
selectMoodRecordsByDate,
updateMoodRecord
} from '@/store/moodSlice';
import dayjs from 'dayjs';
import { LinearGradient } from 'expo-linear-gradient';
import { router, useLocalSearchParams } from 'expo-router';
import React, { useEffect, useState } from 'react';
import {
Alert,
SafeAreaView,
ScrollView,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
View,
Alert,
SafeAreaView,
ScrollView,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
View,
} from 'react-native';
export default function MoodEditScreen() {
@@ -163,11 +163,15 @@ export default function MoodEditScreen() {
return (
<View style={styles.container}>
<LinearGradient
colors={backgroundGradientColors}
colors={['#fafaff', '#f4f3ff']} // 使用紫色主题的浅色渐变
style={styles.gradientBackground}
start={{ x: 0, y: 0 }}
end={{ x: 0, y: 1 }}
/>
{/* 装饰性圆圈 */}
<View style={styles.decorativeCircle1} />
<View style={styles.decorativeCircle2} />
<SafeAreaView style={styles.safeArea}>
<HeaderBar
title={existingMood ? '编辑心情' : '记录心情'}
@@ -220,6 +224,7 @@ export default function MoodEditScreen() {
<TextInput
style={styles.descriptionInput}
placeholder="描述一下你的心情..."
placeholderTextColor="#777f8c"
value={description}
onChangeText={setDescription}
multiline
@@ -270,6 +275,26 @@ const styles = StyleSheet.create({
top: 0,
bottom: 0,
},
decorativeCircle1: {
position: 'absolute',
top: 40,
right: 20,
width: 60,
height: 60,
borderRadius: 30,
backgroundColor: '#7a5af8',
opacity: 0.08,
},
decorativeCircle2: {
position: 'absolute',
bottom: -15,
left: -15,
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: '#7a5af8',
opacity: 0.04,
},
safeArea: {
flex: 1,
},
@@ -278,29 +303,39 @@ const styles = StyleSheet.create({
flex: 1,
},
dateSection: {
backgroundColor: '#fff',
backgroundColor: 'rgba(255,255,255,0.95)',
margin: 16,
borderRadius: 16,
padding: 16,
borderRadius: 20,
padding: 20,
alignItems: 'center',
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
shadowRadius: 12,
elevation: 6,
},
dateTitle: {
fontSize: 24,
fontWeight: '700',
fontSize: 26,
fontWeight: '800',
color: '#192126',
},
moodSection: {
backgroundColor: '#fff',
backgroundColor: 'rgba(255,255,255,0.95)',
margin: 16,
marginTop: 0,
borderRadius: 16,
padding: 16,
borderRadius: 20,
padding: 20,
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
shadowRadius: 12,
elevation: 6,
},
sectionTitle: {
fontSize: 18,
fontWeight: '600',
color: '#333',
marginBottom: 16,
fontSize: 20,
fontWeight: '700',
color: '#192126',
marginBottom: 20,
},
moodOptions: {
flexDirection: 'row',
@@ -310,114 +345,163 @@ const styles = StyleSheet.create({
moodOption: {
width: '30%',
alignItems: 'center',
paddingVertical: 16,
paddingVertical: 20,
marginBottom: 16,
borderRadius: 12,
backgroundColor: '#f8f8f8',
borderRadius: 16,
backgroundColor: 'rgba(122,90,248,0.05)',
borderWidth: 1,
borderColor: 'rgba(122,90,248,0.1)',
},
selectedMoodOption: {
backgroundColor: '#e8f5e8',
backgroundColor: 'rgba(122,90,248,0.15)',
borderWidth: 2,
borderColor: Colors.light.accentGreen,
borderColor: '#7a5af8',
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.15,
shadowRadius: 4,
elevation: 2,
},
moodEmoji: {
fontSize: 24,
marginBottom: 8,
fontSize: 28,
marginBottom: 10,
},
moodLabel: {
fontSize: 14,
color: '#333',
color: '#192126',
fontWeight: '600',
},
intensitySection: {
backgroundColor: '#fff',
backgroundColor: 'rgba(255,255,255,0.95)',
margin: 16,
marginTop: 0,
borderRadius: 16,
padding: 16,
borderRadius: 20,
padding: 20,
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
shadowRadius: 12,
elevation: 6,
},
intensityContainer: {
alignItems: 'center',
},
intensityLabel: {
fontSize: 16,
fontWeight: '600',
color: '#333',
marginBottom: 12,
fontSize: 18,
fontWeight: '700',
color: '#192126',
marginBottom: 16,
},
intensitySlider: {
flexDirection: 'row',
justifyContent: 'space-between',
width: '100%',
marginBottom: 8,
marginBottom: 12,
paddingHorizontal: 10,
},
intensityDot: {
width: 20,
height: 20,
borderRadius: 10,
backgroundColor: '#ddd',
width: 24,
height: 24,
borderRadius: 12,
backgroundColor: 'rgba(122,90,248,0.1)',
borderWidth: 2,
borderColor: 'rgba(122,90,248,0.2)',
},
intensityDotActive: {
backgroundColor: Colors.light.accentGreen,
backgroundColor: '#7a5af8',
borderColor: '#7a5af8',
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowRadius: 4,
elevation: 2,
},
intensityLabels: {
flexDirection: 'row',
justifyContent: 'space-between',
width: '100%',
paddingHorizontal: 10,
},
intensityLabelText: {
fontSize: 12,
color: '#666',
fontSize: 13,
color: '#5d6676',
fontWeight: '500',
},
descriptionSection: {
backgroundColor: '#fff',
backgroundColor: 'rgba(255,255,255,0.95)',
margin: 16,
marginTop: 0,
borderRadius: 16,
padding: 16,
borderRadius: 20,
padding: 20,
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
shadowRadius: 12,
elevation: 6,
},
descriptionInput: {
borderWidth: 1,
borderColor: '#ddd',
borderRadius: 8,
padding: 12,
borderWidth: 1.5,
borderColor: 'rgba(122,90,248,0.2)',
borderRadius: 12,
padding: 16,
fontSize: 16,
minHeight: 80,
minHeight: 100,
textAlignVertical: 'top',
backgroundColor: 'rgba(122,90,248,0.02)',
color: '#192126',
},
characterCount: {
fontSize: 12,
color: '#999',
color: '#777f8c',
textAlign: 'right',
marginTop: 4,
marginTop: 8,
fontWeight: '500',
},
footer: {
padding: 16,
backgroundColor: '#fff',
padding: 20,
backgroundColor: 'rgba(255,255,255,0.95)',
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: -4 },
shadowOpacity: 0.1,
shadowRadius: 12,
elevation: 6,
},
saveButton: {
backgroundColor: Colors.light.accentGreen,
borderRadius: 12,
paddingVertical: 16,
backgroundColor: '#7a5af8',
borderRadius: 16,
paddingVertical: 18,
alignItems: 'center',
marginTop: 8,
marginTop: 12,
shadowColor: '#7a5af8',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowRadius: 4,
elevation: 3,
},
deleteButton: {
backgroundColor: '#F44336',
borderRadius: 12,
paddingVertical: 16,
backgroundColor: '#f95555',
borderRadius: 16,
paddingVertical: 18,
alignItems: 'center',
shadowColor: '#f95555',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowRadius: 4,
elevation: 3,
},
disabledButton: {
backgroundColor: '#ccc',
backgroundColor: '#c0c4ca',
shadowOpacity: 0,
elevation: 0,
},
saveButtonText: {
color: '#fff',
fontSize: 16,
fontWeight: '600',
fontWeight: '700',
},
deleteButtonText: {
color: '#fff',
fontSize: 16,
fontWeight: '600',
fontWeight: '700',
},
});