From 308257d50091916df00b662ab996538f06fe24db Mon Sep 17 00:00:00 2001 From: Gabino Ocotl Date: Wed, 9 Jul 2025 23:35:53 -0500 Subject: [PATCH] completed phase 6 and made the results screen more intuitive --- apps/mobile/src/components/CoachingCards.tsx | 439 ++++++++++++++++++ apps/mobile/src/components/SentimentMeter.tsx | 121 +++++ .../src/components/TranscriptDisplay.tsx | 65 ++- apps/mobile/src/context/AppContext.tsx | 11 +- apps/mobile/src/screens/ResultsScreen.tsx | 236 +--------- 5 files changed, 643 insertions(+), 229 deletions(-) create mode 100644 apps/mobile/src/components/CoachingCards.tsx diff --git a/apps/mobile/src/components/CoachingCards.tsx b/apps/mobile/src/components/CoachingCards.tsx new file mode 100644 index 0000000..11b7dc6 --- /dev/null +++ b/apps/mobile/src/components/CoachingCards.tsx @@ -0,0 +1,439 @@ +import React, { useState } from 'react'; +import { + View, + Text, + StyleSheet, + TouchableOpacity, + Linking, + Alert, +} from 'react-native'; +import { Button } from './ui/Button'; +import { Card } from './ui/Card'; +import { colors } from '../constants/Colors'; +import { typography } from '../constants/Typography'; +import { spacing, borderRadius } from '../constants/Layout'; +import { CheckinResponse } from '../services/api'; + +// Types for coaching data +type CoachingData = CheckinResponse['coaching']; +type ResourceCategory = 'counseling' | 'meditation' | 'emergency'; + +interface CoachingCardsProps { + coaching: CoachingData; + sentimentScore?: number; +} + +interface BreathingExerciseCardProps { + exercise: CoachingData['breathingExercise']; + sentimentScore?: number; +} + +interface StretchExerciseCardProps { + exercise: CoachingData['stretchExercise']; +} + +interface ResourcesCardProps { + resources: CoachingData['resources']; +} + +// Resource category styling +const getCategoryStyles = (category: ResourceCategory) => { + switch (category) { + case 'emergency': + return { + backgroundColor: colors.error + '15', + borderColor: colors.error, + iconColor: colors.error, + icon: '🚨', + }; + case 'counseling': + return { + backgroundColor: colors.primary + '15', + borderColor: colors.primary, + iconColor: colors.primary, + icon: '💬', + }; + case 'meditation': + return { + backgroundColor: colors.success + '15', + borderColor: colors.success, + iconColor: colors.success, + icon: '🧘', + }; + default: + return { + backgroundColor: colors.surfaceLight, + borderColor: colors.border, + iconColor: colors.text, + icon: '📋', + }; + } +}; + +// Breathing Exercise Card with Enhanced Timer +export function BreathingExerciseCard({ + exercise, + sentimentScore, +}: BreathingExerciseCardProps) { + const [isExpanded, setIsExpanded] = useState(false); + const [isActive, setIsActive] = useState(false); + + // Get sentiment-specific messaging + const getSentimentMessage = (score?: number) => { + if (!score) return 'Take a moment to focus on your breathing'; + if (score < 0.4) return "Let's calm your mind with guided breathing"; + if (score < 0.7) return 'Center yourself with mindful breathing'; + return 'Energize your positive mood with rhythmic breathing'; + }; + + const startExercise = () => { + setIsActive(true); + setIsExpanded(true); + }; + + return ( + + setIsExpanded(!isExpanded)} + style={styles.cardHeader} + > + + 💨 + + {exercise.title} + + {getSentimentMessage(sentimentScore)} + + + + {isExpanded ? '▼' : '▶'} + + + {isExpanded && ( + + + Duration: {Math.floor(exercise.duration / 60)}: + {(exercise.duration % 60).toString().padStart(2, '0')} minutes + + + + {exercise.instructions.map((instruction, index) => ( + + {index + 1} + {instruction} + + ))} + + +