feat: 移除目标管理演示页面并优化相关组件
- 删除目标管理演示页面的代码,简化项目结构 - 更新底部导航,移除目标管理演示页面的路由 - 调整相关组件的样式和逻辑,确保界面一致性 - 优化颜色常量的使用,提升视觉效果
This commit is contained in:
@@ -27,6 +27,7 @@ import { Colors } from '@/constants/Colors';
|
||||
import { getTabBarBottomPadding } from '@/constants/TabBar';
|
||||
import { useAppDispatch, useAppSelector } from '@/hooks/redux';
|
||||
import { useAuthGuard } from '@/hooks/useAuthGuard';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
import { useCosUpload } from '@/hooks/useCosUpload';
|
||||
import { deleteConversation, getConversationDetail, listConversations, type AiConversationListItem } from '@/services/aiCoach';
|
||||
import { loadAiCoachSessionCache, saveAiCoachSessionCache } from '@/services/aiCoachSession';
|
||||
@@ -124,7 +125,8 @@ export default function CoachScreen() {
|
||||
|
||||
const { isLoggedIn, pushIfAuthedElseLogin } = useAuthGuard();
|
||||
// 为了让页面更贴近品牌主题与更亮的观感,这里使用亮色系配色
|
||||
const theme = Colors.light;
|
||||
const colorScheme = useColorScheme();
|
||||
const theme = Colors[colorScheme ?? 'light'];
|
||||
const botName = (params?.name || 'Seal').toString();
|
||||
const [input, setInput] = useState('');
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
@@ -282,6 +284,16 @@ export default function CoachScreen() {
|
||||
{ key: 'weight', label: '#记体重', action: () => insertWeightInputCard() },
|
||||
{ key: 'diet', label: '#记饮食', action: () => insertDietInputCard() },
|
||||
{ key: 'dietPlan', label: '#饮食方案', action: () => insertDietPlanCard() },
|
||||
{
|
||||
key: 'mood',
|
||||
label: '#记心情',
|
||||
action: () => {
|
||||
if (Platform.OS === 'ios') {
|
||||
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
||||
}
|
||||
router.push('/mood/calendar');
|
||||
}
|
||||
},
|
||||
], [router, planDraft, checkin]);
|
||||
|
||||
const scrollToEnd = useCallback(() => {
|
||||
@@ -1333,7 +1345,7 @@ export default function CoachScreen() {
|
||||
{/* 标题部分 */}
|
||||
<View style={styles.dietPlanHeader}>
|
||||
<View style={styles.dietPlanTitleContainer}>
|
||||
<Ionicons name="restaurant-outline" size={20} color={Colors.light.accentGreenDark} />
|
||||
<Ionicons name="restaurant-outline" size={20} color={theme.success} />
|
||||
<Text style={styles.dietPlanTitle}>我的饮食方案</Text>
|
||||
</View>
|
||||
<Text style={styles.dietPlanSubtitle}>MY DIET PLAN</Text>
|
||||
@@ -1522,7 +1534,7 @@ export default function CoachScreen() {
|
||||
</View>
|
||||
)}
|
||||
{isSelected && isPending && (
|
||||
<ActivityIndicator size="small" color={Colors.light.accentGreenDark} />
|
||||
<ActivityIndicator size="small" color={theme.success} />
|
||||
)}
|
||||
{isSelected && !isPending && (
|
||||
<View style={styles.selectedBadge}>
|
||||
@@ -1829,7 +1841,7 @@ export default function CoachScreen() {
|
||||
<View style={styles.screen}>
|
||||
{/* 背景渐变 */}
|
||||
<LinearGradient
|
||||
colors={['#F0F9FF', '#E0F2FE']}
|
||||
colors={['#fafaff', '#f4f3ff']} // 使用紫色主题的浅色渐变
|
||||
style={styles.gradientBackground}
|
||||
start={{ x: 0, y: 0 }}
|
||||
end={{ x: 1, y: 1 }}
|
||||
@@ -1866,7 +1878,7 @@ export default function CoachScreen() {
|
||||
source={require('@/assets/images/icons/iconFlash.png')}
|
||||
style={styles.usageIcon}
|
||||
/>
|
||||
<Text style={[styles.usageText, { color: theme.text }]}>
|
||||
<Text style={styles.usageText}>
|
||||
{userProfile?.isVip ? '不限' : `${userProfile?.freeUsageCount || 0}/${userProfile?.maxUsageCount || 0}`}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
@@ -1876,16 +1888,16 @@ export default function CoachScreen() {
|
||||
<TouchableOpacity
|
||||
accessibilityRole="button"
|
||||
onPress={startNewConversation}
|
||||
style={[styles.headerActionButton, { backgroundColor: `${Colors.light.accentGreen}33` }]} // 20% opacity
|
||||
style={[styles.headerActionButton, { backgroundColor: `${theme.primary}20` }]} // 20% opacity
|
||||
>
|
||||
<Ionicons name="add-outline" size={18} color={theme.onPrimary} />
|
||||
<Ionicons name="add-outline" size={18} color={theme.primary} />
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
accessibilityRole="button"
|
||||
onPress={openHistory}
|
||||
style={[styles.headerActionButton, { backgroundColor: `${Colors.light.accentGreen}33` }]} // 20% opacity
|
||||
style={[styles.headerActionButton, { backgroundColor: `${theme.primary}20` }]} // 20% opacity
|
||||
>
|
||||
<Ionicons name="time-outline" size={18} color={theme.onPrimary} />
|
||||
<Ionicons name="time-outline" size={18} color={theme.primary} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
@@ -1948,8 +1960,18 @@ export default function CoachScreen() {
|
||||
contentContainerStyle={{ paddingHorizontal: 6, gap: 8 }}
|
||||
>
|
||||
{chips.map((c) => (
|
||||
<TouchableOpacity key={c.key} style={[styles.chip, { borderColor: `${Colors.light.accentGreen}59`, backgroundColor: `${Colors.light.accentGreen}1F` }]} onPress={c.action}>
|
||||
<Text style={[styles.chipText, { color: '#192126' }]}>{c.label}</Text>
|
||||
<TouchableOpacity
|
||||
key={c.key}
|
||||
style={[
|
||||
styles.chip,
|
||||
{
|
||||
borderColor: c.key === 'mood' ? `${theme.success}40` : `${theme.primary}40`,
|
||||
backgroundColor: c.key === 'mood' ? `${theme.success}15` : `${theme.primary}15`
|
||||
}
|
||||
]}
|
||||
onPress={c.action}
|
||||
>
|
||||
<Text style={[styles.chipText, { color: c.key === 'mood' ? theme.success : theme.text }]}>{c.label}</Text>
|
||||
</TouchableOpacity>
|
||||
))}
|
||||
</ScrollView>
|
||||
@@ -1990,18 +2012,18 @@ export default function CoachScreen() {
|
||||
</ScrollView>
|
||||
)}
|
||||
|
||||
<View style={[styles.inputRow, { borderColor: `${Colors.light.accentGreen}59`, backgroundColor: `${Colors.light.accentGreen}14` }]}>
|
||||
<View style={[styles.inputRow, { borderColor: `${theme.primary}30`, backgroundColor: `${theme.primary}08` }]}>
|
||||
<TouchableOpacity
|
||||
accessibilityRole="button"
|
||||
onPress={pickImages}
|
||||
style={[styles.mediaBtn, { backgroundColor: `${Colors.light.accentGreen}28` }]}
|
||||
style={[styles.mediaBtn, { backgroundColor: `${theme.primary}20` }]}
|
||||
>
|
||||
<Ionicons name="image-outline" size={18} color={'#192126'} />
|
||||
<Ionicons name="image-outline" size={18} color={theme.text} />
|
||||
</TouchableOpacity>
|
||||
<TextInput
|
||||
placeholder="问我任何健康相关的问题,如营养、健身、生活管理等..."
|
||||
placeholderTextColor={theme.textMuted}
|
||||
style={[styles.input, { color: '#192126' }]}
|
||||
style={[styles.input, { color: theme.text }]}
|
||||
value={input}
|
||||
onChangeText={setInput}
|
||||
multiline
|
||||
@@ -2021,7 +2043,7 @@ export default function CoachScreen() {
|
||||
style={[
|
||||
styles.sendBtn,
|
||||
{
|
||||
backgroundColor: (isSending || isStreaming) ? '#FF4444' : theme.primary,
|
||||
backgroundColor: (isSending || isStreaming) ? theme.danger : theme.primary,
|
||||
opacity: ((input.trim() || selectedImages.length > 0) || (isSending || isStreaming)) ? 1 : 0.5
|
||||
}
|
||||
]}
|
||||
@@ -2144,8 +2166,8 @@ const styles = StyleSheet.create({
|
||||
width: 60,
|
||||
height: 60,
|
||||
borderRadius: 30,
|
||||
backgroundColor: '#0EA5E9',
|
||||
opacity: 0.1,
|
||||
backgroundColor: '#7a5af8', // 紫色主题
|
||||
opacity: 0.08,
|
||||
},
|
||||
decorativeCircle2: {
|
||||
position: 'absolute',
|
||||
@@ -2154,8 +2176,8 @@ const styles = StyleSheet.create({
|
||||
width: 40,
|
||||
height: 40,
|
||||
borderRadius: 20,
|
||||
backgroundColor: '#0EA5E9',
|
||||
opacity: 0.05,
|
||||
backgroundColor: '#7a5af8', // 紫色主题
|
||||
opacity: 0.04,
|
||||
},
|
||||
headerLeft: {
|
||||
flexDirection: 'row',
|
||||
@@ -2177,6 +2199,11 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 16,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
shadowColor: '#7a5af8',
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 4,
|
||||
elevation: 2,
|
||||
},
|
||||
historyButton: {
|
||||
width: 32,
|
||||
@@ -2237,7 +2264,7 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 8,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: `${Colors.light.accentGreen}99` // 60% opacity
|
||||
backgroundColor: '#7a5af899' // 紫色主题 60% opacity
|
||||
},
|
||||
dietOptionsContainer: {
|
||||
gap: 8,
|
||||
@@ -2249,13 +2276,13 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 12,
|
||||
backgroundColor: 'rgba(255,255,255,0.9)',
|
||||
borderWidth: 1,
|
||||
borderColor: `${Colors.light.accentGreen}4D`, // 30% opacity
|
||||
borderColor: '#7a5af84d', // 紫色主题 30% opacity
|
||||
},
|
||||
dietOptionIconContainer: {
|
||||
width: 40,
|
||||
height: 40,
|
||||
borderRadius: 20,
|
||||
backgroundColor: `${Colors.light.accentGreen}33`, // 20% opacity
|
||||
backgroundColor: '#7a5af833', // 紫色主题 20% opacity
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
marginRight: 12,
|
||||
@@ -2304,7 +2331,7 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 10,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: `${Colors.light.accentGreen}99`, // 60% opacity
|
||||
backgroundColor: '#7a5af899', // 紫色主题 60% opacity
|
||||
alignSelf: 'flex-end',
|
||||
},
|
||||
// markdown 基础样式承载容器的字体尺寸保持与气泡一致
|
||||
@@ -2349,7 +2376,7 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 12,
|
||||
overflow: 'hidden',
|
||||
position: 'relative',
|
||||
backgroundColor: 'rgba(0,0,0,0.06)'
|
||||
backgroundColor: 'rgba(122,90,248,0.08)' // 使用紫色主题的浅色背景
|
||||
},
|
||||
imageThumb: {
|
||||
width: '100%',
|
||||
@@ -2404,7 +2431,7 @@ const styles = StyleSheet.create({
|
||||
padding: 8,
|
||||
borderWidth: 1,
|
||||
borderRadius: 16,
|
||||
backgroundColor: 'rgba(0,0,0,0.04)'
|
||||
backgroundColor: 'rgba(122,90,248,0.04)' // 使用紫色主题的极浅色背景
|
||||
},
|
||||
mediaBtn: {
|
||||
width: 40,
|
||||
@@ -2617,17 +2644,17 @@ const styles = StyleSheet.create({
|
||||
choiceButton: {
|
||||
backgroundColor: 'rgba(255,255,255,0.9)',
|
||||
borderWidth: 1,
|
||||
borderColor: `${Colors.light.accentGreen}4D`, // 30% opacity
|
||||
borderColor: '#7a5af84d', // 紫色主题 30% opacity
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
},
|
||||
choiceButtonRecommended: {
|
||||
borderColor: `${Colors.light.accentGreen}99`, // 60% opacity
|
||||
backgroundColor: `${Colors.light.accentGreen}1A`, // 10% opacity
|
||||
borderColor: '#7a5af899', // 紫色主题 60% opacity
|
||||
backgroundColor: '#7a5af81a', // 紫色主题 10% opacity
|
||||
},
|
||||
choiceButtonSelected: {
|
||||
borderColor: Colors.light.accentGreenDark,
|
||||
backgroundColor: `${Colors.light.accentGreen}33`, // 20% opacity
|
||||
borderColor: '#19b36e', // success[500]
|
||||
backgroundColor: '#19b36e33', // 20% opacity
|
||||
borderWidth: 2,
|
||||
},
|
||||
choiceButtonDisabled: {
|
||||
@@ -2647,10 +2674,10 @@ const styles = StyleSheet.create({
|
||||
flex: 1,
|
||||
},
|
||||
choiceLabelRecommended: {
|
||||
color: Colors.light.accentGreenDark,
|
||||
color: '#19b36e', // success[500]
|
||||
},
|
||||
choiceLabelSelected: {
|
||||
color: Colors.light.accentGreenDark,
|
||||
color: '#19b36e', // success[500]
|
||||
fontWeight: '700',
|
||||
},
|
||||
choiceLabelDisabled: {
|
||||
@@ -2662,7 +2689,7 @@ const styles = StyleSheet.create({
|
||||
gap: 8,
|
||||
},
|
||||
recommendedBadge: {
|
||||
backgroundColor: `${Colors.light.accentGreen}CC`, // 80% opacity
|
||||
backgroundColor: '#7a5af8cc', // 紫色主题 80% opacity
|
||||
borderRadius: 6,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 2,
|
||||
@@ -2670,10 +2697,10 @@ const styles = StyleSheet.create({
|
||||
recommendedText: {
|
||||
fontSize: 12,
|
||||
fontWeight: '700',
|
||||
color: Colors.light.accentGreenDark,
|
||||
color: '#19b36e', // success[500]
|
||||
},
|
||||
selectedBadge: {
|
||||
backgroundColor: Colors.light.accentGreenDark,
|
||||
backgroundColor: '#19b36e', // success[500]
|
||||
borderRadius: 6,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 2,
|
||||
@@ -2714,7 +2741,7 @@ const styles = StyleSheet.create({
|
||||
padding: 16,
|
||||
gap: 16,
|
||||
borderWidth: 1,
|
||||
borderColor: `${Colors.light.accentGreen}33`, // 20% opacity
|
||||
borderColor: '#7a5af833', // 紫色主题 20% opacity
|
||||
},
|
||||
dietPlanHeader: {
|
||||
gap: 4,
|
||||
@@ -2834,7 +2861,7 @@ const styles = StyleSheet.create({
|
||||
caloriesValue: {
|
||||
fontSize: 18,
|
||||
fontWeight: '800',
|
||||
color: Colors.light.accentGreenDark,
|
||||
color: '#19b36e', // success[500]
|
||||
},
|
||||
nutritionGrid: {
|
||||
flexDirection: 'row',
|
||||
@@ -2871,7 +2898,7 @@ const styles = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: 8,
|
||||
backgroundColor: Colors.light.accentGreenDark,
|
||||
backgroundColor: '#19b36e', // success[500]
|
||||
paddingVertical: 12,
|
||||
paddingHorizontal: 16,
|
||||
borderRadius: 12,
|
||||
@@ -2889,7 +2916,7 @@ const styles = StyleSheet.create({
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 4,
|
||||
borderRadius: 12,
|
||||
backgroundColor: 'rgba(0,0,0,0.06)',
|
||||
backgroundColor: 'rgba(122,90,248,0.08)', // 紫色主题浅色背景
|
||||
},
|
||||
usageIcon: {
|
||||
width: 16,
|
||||
@@ -2898,7 +2925,7 @@ const styles = StyleSheet.create({
|
||||
usageText: {
|
||||
fontSize: 12,
|
||||
fontWeight: '600',
|
||||
color: '#687076',
|
||||
color: '#7a5af8', // 紫色主题文字颜色
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user