/**
* TabataFit Assessment Screen
* Initial movement assessment to personalize experience
*/
import { View, StyleSheet, ScrollView, Pressable } from 'react-native'
import { useRouter } from 'expo-router'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { LinearGradient } from 'expo-linear-gradient'
import Ionicons from '@expo/vector-icons/Ionicons'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useHaptics } from '@/src/shared/hooks'
import { useProgramStore } from '@/src/shared/stores'
import { ASSESSMENT_WORKOUT } from '@/src/shared/data/programs'
import { StyledText } from '@/src/shared/components/StyledText'
import { useThemeColors, BRAND } from '@/src/shared/theme'
import type { ThemeColors } from '@/src/shared/theme/types'
import { SPACING, LAYOUT } from '@/src/shared/constants/spacing'
import { RADIUS } from '@/src/shared/constants/borderRadius'
const FONTS = {
LARGE_TITLE: 28,
TITLE: 24,
HEADLINE: 17,
BODY: 16,
CAPTION: 13,
}
export default function AssessmentScreen() {
const { t } = useTranslation('screens')
const insets = useSafeAreaInsets()
const router = useRouter()
const haptics = useHaptics()
const colors = useThemeColors()
const styles = useMemo(() => createStyles(colors), [colors])
const [showIntro, setShowIntro] = useState(true)
const skipAssessment = useProgramStore((s) => s.skipAssessment)
const completeAssessment = useProgramStore((s) => s.completeAssessment)
const handleSkip = () => {
haptics.buttonTap()
skipAssessment()
router.back()
}
const handleStart = () => {
haptics.buttonTap()
setShowIntro(false)
}
const handleComplete = () => {
haptics.workoutComplete()
completeAssessment({
completedAt: new Date().toISOString(),
exercisesCompleted: ASSESSMENT_WORKOUT.exercises.map(e => e.name),
})
router.back()
}
if (!showIntro) {
// Here we'd show the actual assessment workout player
// For now, just show a completion screen
return (
setShowIntro(true)}>
{t('assessment.title')}
{ASSESSMENT_WORKOUT.exercises.map((exercise, index) => (
{index + 1}
{exercise.name}
{exercise.duration}s • {exercise.purpose}
))}
{t('assessment.tips')}
{ASSESSMENT_WORKOUT.tips.map((tip, index) => (
{tip}
))}
{t('assessment.startAssessment')}
)
}
return (
{/* Header */}
{/* Hero */}
{t('assessment.welcomeTitle')}
{t('assessment.welcomeDescription')}
{/* Features */}
{ASSESSMENT_WORKOUT.duration} {t('assessment.minutes')}
{t('assessment.quickCheck')}
{ASSESSMENT_WORKOUT.exercises.length} {t('assessment.movements')}
{t('assessment.testMovements')}
{t('assessment.noEquipment')}
{t('assessment.justYourBody')}
{/* Benefits */}
{t('assessment.whatWeCheck')}
{t('assessment.mobility')}
{t('assessment.strength')}
{t('assessment.stability')}
{t('assessment.balance')}
{/* Bottom Actions */}
{t('assessment.takeAssessment')}
{t('assessment.skipForNow')}
)
}
function createStyles(colors: ThemeColors) {
return StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.bg.base,
},
scrollView: {
flex: 1,
},
scrollContent: {
paddingHorizontal: LAYOUT.SCREEN_PADDING,
},
// Header
header: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: LAYOUT.SCREEN_PADDING,
paddingVertical: SPACING[3],
},
backButton: {
width: 40,
height: 40,
alignItems: 'center',
justifyContent: 'center',
},
placeholder: {
width: 40,
},
// Hero
heroSection: {
alignItems: 'center',
marginTop: SPACING[4],
marginBottom: SPACING[8],
},
iconContainer: {
width: 100,
height: 100,
borderRadius: 50,
backgroundColor: `${BRAND.PRIMARY}15`,
alignItems: 'center',
justifyContent: 'center',
marginBottom: SPACING[5],
},
heroTitle: {
textAlign: 'center',
marginBottom: SPACING[3],
},
heroDescription: {
textAlign: 'center',
lineHeight: 24,
paddingHorizontal: SPACING[4],
},
// Features
featuresSection: {
marginBottom: SPACING[8],
},
featureItem: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: SPACING[4],
backgroundColor: colors.bg.surface,
padding: SPACING[4],
borderRadius: RADIUS.LG,
},
featureIcon: {
width: 48,
height: 48,
borderRadius: 24,
backgroundColor: `${BRAND.PRIMARY}15`,
alignItems: 'center',
justifyContent: 'center',
marginRight: SPACING[3],
},
featureText: {
flex: 1,
},
// Benefits
benefitsSection: {
marginBottom: SPACING[6],
},
benefitsTitle: {
marginBottom: SPACING[3],
},
benefitsList: {
flexDirection: 'row',
flexWrap: 'wrap',
gap: SPACING[2],
},
benefitTag: {
backgroundColor: colors.bg.surface,
paddingHorizontal: SPACING[4],
paddingVertical: SPACING[2],
borderRadius: RADIUS.FULL,
borderWidth: 1,
borderColor: colors.border.glass,
},
// Assessment Container
assessmentContainer: {
marginTop: SPACING[2],
},
exerciseList: {
marginBottom: SPACING[6],
},
exerciseItem: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: colors.bg.surface,
padding: SPACING[4],
borderRadius: RADIUS.LG,
marginBottom: SPACING[2],
},
exerciseNumber: {
width: 36,
height: 36,
borderRadius: 18,
backgroundColor: `${BRAND.PRIMARY}15`,
alignItems: 'center',
justifyContent: 'center',
marginRight: SPACING[3],
},
exerciseInfo: {
flex: 1,
},
// Tips
tipsSection: {
backgroundColor: colors.bg.surface,
borderRadius: RADIUS.LG,
padding: SPACING[5],
},
tipsTitle: {
marginBottom: SPACING[4],
},
tipItem: {
flexDirection: 'row',
alignItems: 'flex-start',
marginBottom: SPACING[3],
},
tipText: {
marginLeft: SPACING[2],
flex: 1,
lineHeight: 20,
},
// Bottom Bar
bottomBar: {
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
backgroundColor: colors.bg.base,
paddingHorizontal: LAYOUT.SCREEN_PADDING,
paddingTop: SPACING[3],
borderTopWidth: 1,
borderTopColor: colors.border.glass,
},
ctaButton: {
borderRadius: RADIUS.LG,
overflow: 'hidden',
marginBottom: SPACING[3],
},
ctaGradient: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
paddingVertical: SPACING[4],
},
ctaIcon: {
marginLeft: SPACING[2],
},
skipButton: {
alignItems: 'center',
paddingVertical: SPACING[2],
},
})
}