package com.craigvg.lichun_android.ui.screens.dating.components import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.craigvg.lichun_android.domain.models.DateMiniGameState import com.craigvg.lichun_android.ui.theme.AppColors import com.craigvg.lichun_android.ui.theme.AppSpacing import com.craigvg.lichun_android.ui.theme.AppTypography /** * Score/outcome display after mini-game completes */ @Composable fun MiniGameResults( gameState: DateMiniGameState, partnerName: String, onComplete: () -> Unit ) { val performanceColor = when { gameState.correctAnswers >= gameState.totalRounds * 0.9 -> AppColors.success gameState.correctAnswers >= gameState.totalRounds * 0.7 -> AppColors.primary gameState.correctAnswers >= gameState.totalRounds * 0.5 -> AppColors.warning else -> AppColors.error } Column( modifier = Modifier .fillMaxSize() .padding(AppSpacing.xl), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center ) { Box( modifier = Modifier .size(120.dp) .clip(CircleShape) .background(performanceColor.copy(alpha = 0.2f)), contentAlignment = Alignment.Center ) { Text(text = "\uD83C\uDF89", fontSize = 60.sp) } Spacer(modifier = Modifier.height(AppSpacing.lg)) Text( text = "Date Complete!", style = AppTypography.title, color = AppColors.primaryText ) Spacer(modifier = Modifier.height(AppSpacing.sm)) Text( text = "You had a ${gameState.performance.lowercase()} time with $partnerName", style = AppTypography.body, color = AppColors.secondaryText, textAlign = TextAlign.Center ) Spacer(modifier = Modifier.height(AppSpacing.xl)) Card( modifier = Modifier.fillMaxWidth(), shape = RoundedCornerShape(AppSpacing.cornerRadius), colors = CardDefaults.cardColors(containerColor = AppColors.surfaceElevated) ) { Column( modifier = Modifier.padding(AppSpacing.lg), horizontalAlignment = Alignment.CenterHorizontally ) { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceEvenly ) { ResultStatItem( label = "Correct", value = "${gameState.correctAnswers}/${gameState.totalRounds}", color = performanceColor ) ResultStatItem( label = "Affinity", value = "+${gameState.totalAffinity}", color = AppColors.primary ) } } } Spacer(modifier = Modifier.height(AppSpacing.xl)) Button( onClick = onComplete, modifier = Modifier .fillMaxWidth() .height(AppSpacing.buttonHeight), shape = RoundedCornerShape(AppSpacing.cornerRadius), colors = ButtonDefaults.buttonColors(containerColor = AppColors.primary) ) { Text( text = "Continue", style = AppTypography.headline, color = Color.White ) } } } @Composable private fun ResultStatItem( label: String, value: String, color: Color ) { Column(horizontalAlignment = Alignment.CenterHorizontally) { Text( text = value, fontSize = 28.sp, fontWeight = FontWeight.Bold, color = color ) Text( text = label, style = AppTypography.caption, color = AppColors.secondaryText ) } }