refactor: rename status to matchStatus and inline modifier call
This commit is contained in:
parent
75cf97a3a4
commit
fc2c939e0b
5 changed files with 11 additions and 12 deletions
|
@ -29,7 +29,7 @@ fun MatchDto.toDomain(): Match {
|
|||
id = serie.id,
|
||||
name = serie.fullName ?: ""
|
||||
),
|
||||
status = status?.toMatchStatus() ?: MatchStatus.UNKNOWN
|
||||
matchStatus = status?.toMatchStatus() ?: MatchStatus.UNKNOWN
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -7,5 +7,5 @@ data class Match(
|
|||
val opponents: List<Opponent>,
|
||||
val league: League,
|
||||
val serie: Serie,
|
||||
val status: MatchStatus
|
||||
val matchStatus: MatchStatus
|
||||
)
|
|
@ -51,7 +51,7 @@ fun MatchCard(
|
|||
Box(modifier = modifier.fillMaxWidth()) {
|
||||
val (leftOpponent, rightOpponent) = getOrDefaultOpponents(match.opponents)
|
||||
val leagueAndSerieName = "${match.league.name} + ${match.serie.name}"
|
||||
val scheduleConfig = match.status.scheduleConfigFor(match.beginAt)
|
||||
val scheduleConfig = match.matchStatus.scheduleConfigFor(match.beginAt)
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(), shape = RoundedCornerShape(16.dp), onClick = {
|
||||
|
@ -61,7 +61,7 @@ fun MatchCard(
|
|||
rightOpponentId = rightOpponent.id,
|
||||
leagueAndSerieName = leagueAndSerieName,
|
||||
scheduleString = scheduleConfig.first,
|
||||
status = match.status
|
||||
matchStatus = match.matchStatus
|
||||
)
|
||||
)
|
||||
}, colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
|
||||
|
|
|
@ -13,7 +13,7 @@ data class MatchDetailsRoute(
|
|||
val rightOpponentId: Long,
|
||||
val leagueAndSerieName: String,
|
||||
val scheduleString: String,
|
||||
val status: MatchStatus
|
||||
val matchStatus: MatchStatus
|
||||
)
|
||||
|
||||
fun NavGraphBuilder.matchDetailsScreen(onBackClick: () -> Unit) {
|
||||
|
|
|
@ -70,7 +70,7 @@ fun MatchDetailsScreen(
|
|||
value.isLoading -> LoadingIndicator()
|
||||
value.leftTeam != null && value.rightTeam != null -> Column {
|
||||
MatchupRow(leftTeam = value.leftTeam, rightTeam = value.rightTeam)
|
||||
ScheduleRow(matchDetails.scheduleString, matchDetails.status)
|
||||
ScheduleRow(matchDetails.scheduleString, matchDetails.matchStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,11 +78,6 @@ fun MatchDetailsScreen(
|
|||
|
||||
@Composable
|
||||
fun ScheduleRow(scheduleString: String, matchStatus: MatchStatus) {
|
||||
val modifier = if (matchStatus == MatchStatus.LIVE)
|
||||
Modifier
|
||||
.background(LiveRed, RoundedCornerShape(16.dp))
|
||||
.padding(horizontal = 12.dp, vertical = 8.dp)
|
||||
else Modifier
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
|
@ -92,7 +87,11 @@ fun ScheduleRow(scheduleString: String, matchStatus: MatchStatus) {
|
|||
scheduleString,
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
color = White,
|
||||
modifier = modifier
|
||||
modifier = if (matchStatus == MatchStatus.LIVE)
|
||||
Modifier
|
||||
.background(LiveRed, RoundedCornerShape(16.dp))
|
||||
.padding(horizontal = 12.dp, vertical = 8.dp)
|
||||
else Modifier
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue