feat(date-memories): add 'We did this' and 'Date memories' entry to DateMatchesScreen

This commit is contained in:
null 2026-06-30 18:14:10 -05:00
parent 90995cdaef
commit e4f10551a0
1 changed files with 47 additions and 5 deletions

View File

@ -29,6 +29,9 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.foundation.clickable
import androidx.compose.material3.TextButton
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
@ -42,8 +45,13 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel import androidx.hilt.navigation.compose.hiltViewModel
import app.closer.domain.model.DateCostLevel import app.closer.domain.model.DateCostLevel
import app.closer.domain.model.DateIdea import app.closer.domain.model.DateIdea
import app.closer.core.navigation.AppRoute
import app.closer.domain.model.DateMatch import app.closer.domain.model.DateMatch
import app.closer.domain.model.DateMatchSuggestion import app.closer.domain.model.DateMatchSuggestion
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.width
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.vectorResource
import app.closer.domain.model.SwipeAction import app.closer.domain.model.SwipeAction
import app.closer.ui.components.EmptyState import app.closer.ui.components.EmptyState
import app.closer.ui.components.ErrorState import app.closer.ui.components.ErrorState
@ -57,10 +65,17 @@ fun DateMatchesScreen(
) { ) {
val state by viewModel.uiState.collectAsState() val state by viewModel.uiState.collectAsState()
// After marking a date done, open its reflection.
LaunchedEffect(Unit) {
viewModel.markedDateId.collect { dateId -> onNavigate(AppRoute.dateReflection(dateId)) }
}
DateMatchesContent( DateMatchesContent(
state = state, state = state,
onRetry = viewModel::retry, onRetry = viewModel::retry,
onBack = { onNavigate("back") } onBack = { onNavigate("back") },
onMarkCompleted = viewModel::markCompleted,
onMemories = { onNavigate(AppRoute.DATE_MEMORIES) }
) )
} }
@ -68,7 +83,9 @@ fun DateMatchesScreen(
private fun DateMatchesContent( private fun DateMatchesContent(
state: DateMatchesUiState, state: DateMatchesUiState,
onRetry: () -> Unit, onRetry: () -> Unit,
onBack: () -> Unit onBack: () -> Unit,
onMarkCompleted: (DateMatch) -> Unit = {},
onMemories: () -> Unit = {}
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
@ -104,6 +121,16 @@ private fun DateMatchesContent(
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant color = MaterialTheme.colorScheme.onSurfaceVariant
) )
TextButton(onClick = onMemories, contentPadding = androidx.compose.foundation.layout.PaddingValues(vertical = 4.dp)) {
Icon(
imageVector = ImageVector.vectorResource(R.drawable.glyph_date_replay),
contentDescription = null,
modifier = Modifier.size(18.dp),
tint = MaterialTheme.colorScheme.primary
)
Spacer(Modifier.width(6.dp))
Text("Your date memories", style = MaterialTheme.typography.labelLarge)
}
} }
} }
@ -149,7 +176,7 @@ private fun DateMatchesContent(
) )
} }
items(state.mutualMatches, key = { it.id }) { match -> items(state.mutualMatches, key = { it.id }) { match ->
MatchCard(match = match) MatchCard(match = match, onMarkCompleted = { onMarkCompleted(match) })
} }
} }
@ -219,10 +246,22 @@ private fun SectionHeader(
} }
@Composable @Composable
private fun MatchCard(match: DateMatch) { private fun MatchCard(match: DateMatch, onMarkCompleted: () -> Unit = {}) {
val idea = match.dateIdea ?: return val idea = match.dateIdea ?: return
IdeaCard( IdeaCard(
idea = idea, idea = idea,
action = {
TextButton(onClick = onMarkCompleted, modifier = Modifier.fillMaxWidth()) {
Icon(
imageVector = CloserGlyphs.Heart,
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = Color(0xFF9B1B5A)
)
Spacer(Modifier.width(6.dp))
Text("We did this", fontWeight = FontWeight.SemiBold)
}
},
badge = { badge = {
Surface( Surface(
shape = RoundedCornerShape(999.dp), shape = RoundedCornerShape(999.dp),
@ -286,7 +325,8 @@ private fun SuggestionCard(suggestion: DateMatchSuggestion) {
@Composable @Composable
private fun IdeaCard( private fun IdeaCard(
idea: DateIdea, idea: DateIdea,
badge: @Composable () -> Unit badge: @Composable () -> Unit,
action: (@Composable () -> Unit)? = null
) { ) {
Card( Card(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@ -348,6 +388,8 @@ private fun IdeaCard(
InfoChip(label = "Premium", emphasis = true) InfoChip(label = "Premium", emphasis = true)
} }
} }
action?.invoke()
} }
} }
} }