import React from 'react'; import { Pressable, StyleSheet, Text, View } from 'react-native'; import { NativeStackScreenProps } from '@react-navigation/native-stack'; import { SetupSection } from '@/components/common/SetupSection'; import { ScreenContainer } from '@/components/common/ScreenContainer'; import { StatCard } from '@/components/common/StatCard'; import { shootingStyleOptions } from '@/data/shootingStyles'; import { ModesStackParamList } from '@/navigation/types'; import { useAppStore } from '@/store/useAppStore'; import { colors } from '@/theme/colors'; import { spacing } from '@/theme/spacing'; type Props = NativeStackScreenProps; export function PracticeModeScreen({ navigation }: Props): React.JSX.Element { const archerProfile = useAppStore((state) => state.archerProfile); const sessionSetup = useAppStore((state) => state.sessionSetups.practice); const setSessionStyle = useAppStore((state) => state.setSessionStyle); const setSessionTargetFace = useAppStore((state) => state.setSessionTargetFace); const applyProfileDefaultsToSessions = useAppStore( (state) => state.applyProfileDefaultsToSessions ); const activeSession = useAppStore((state) => state.activeSession); const startSession = useAppStore((state) => state.startSession); const clearActiveSession = useAppStore((state) => state.clearActiveSession); const enabledStyles = shootingStyleOptions.filter((style) => archerProfile.stylePreferences.some( (preference) => preference.styleId === style.id && preference.enabled ) ); const activeStyleLabel = shootingStyleOptions.find((style) => style.id === sessionSetup.styleId)?.label ?? 'Not set'; const livePracticeStyle = shootingStyleOptions.find((style) => style.id === activeSession?.styleId)?.label ?? 'Not set'; const practiceIsActive = activeSession?.mode === 'practice'; return ( Practice mode Start by confirming the profile defaults for this practice session, then layer in drills, timers, notes, and equipment tuning checkpoints. setSessionStyle('practice', styleId)} onTargetFaceSelect={(targetFace) => setSessionTargetFace('practice', targetFace)} onApplyDefaults={applyProfileDefaultsToSessions} onStart={() => { if (!practiceIsActive) { startSession('practice'); } navigation.navigate('PracticeSession'); }} /> {practiceIsActive ? ( Practice session live {livePracticeStyle} •{' '} {activeSession.targetFace === 'single-face' ? 'Single Face' : 'Multi Face'} End Session Started at {new Date(activeSession.startedAt).toLocaleTimeString()} ) : null} ); } const styles = StyleSheet.create({ title: { fontSize: 30, fontWeight: '800', color: colors.text, }, subtitle: { color: colors.muted, lineHeight: 22, }, statsRow: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.md, }, activeSessionCard: { borderRadius: 20, padding: spacing.md, backgroundColor: colors.surfaceAlt, borderWidth: 1, borderColor: colors.success, gap: spacing.sm, }, activeSessionHeader: { flexDirection: 'row', gap: spacing.md, alignItems: 'flex-start', }, activeSessionText: { flex: 1, gap: spacing.xs, }, activeSessionLabel: { color: colors.success, fontSize: 13, fontWeight: '800', textTransform: 'uppercase', letterSpacing: 1, }, activeSessionValue: { color: colors.text, fontSize: 20, fontWeight: '800', }, activeSessionMeta: { color: colors.muted, }, endButton: { borderRadius: 999, paddingHorizontal: spacing.md, paddingVertical: spacing.sm, borderWidth: 1, borderColor: colors.border, }, endButtonText: { color: colors.text, fontWeight: '700', }, });