fix(android): update HomeScreen + AppNavigation routing

This commit is contained in:
null 2026-06-28 17:09:07 -05:00
parent 4215563873
commit afa64bfb36
2 changed files with 61 additions and 39 deletions

View File

@ -1,14 +1,9 @@
package app.closer.core.navigation
import androidx.annotation.DrawableRes
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.Chat
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@ -23,6 +18,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.vectorResource
import androidx.navigation.NavType
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.NavHost
@ -33,6 +29,7 @@ import androidx.navigation.navArgument
import androidx.navigation.navDeepLink
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.LaunchedEffect
import app.closer.R
import app.closer.ui.auth.ForgotPasswordScreen
import app.closer.ui.answers.AnswerHistoryScreen
import app.closer.ui.answers.AnswerRevealScreen
@ -599,15 +596,15 @@ fun AppNavigation(
private data class TopLevelRoute(
val route: String,
val label: String,
val icon: ImageVector
@DrawableRes val iconRes: Int
)
private val topLevelRoutes = listOf(
TopLevelRoute(AppRoute.HOME, "Home", Icons.Filled.Home),
TopLevelRoute(AppRoute.DAILY_QUESTION, "Today", Icons.Filled.Favorite),
TopLevelRoute(AppRoute.PLAY, "Play", Icons.Filled.PlayArrow),
TopLevelRoute(AppRoute.MESSAGES, "Messages", Icons.AutoMirrored.Filled.Chat),
TopLevelRoute(AppRoute.SETTINGS, "Settings", Icons.Filled.Settings)
TopLevelRoute(AppRoute.HOME, "Home", R.drawable.glyph_home),
TopLevelRoute(AppRoute.DAILY_QUESTION, "Today", R.drawable.glyph_daily_card),
TopLevelRoute(AppRoute.PLAY, "Play", R.drawable.glyph_play),
TopLevelRoute(AppRoute.MESSAGES, "Messages", R.drawable.glyph_chat),
TopLevelRoute(AppRoute.SETTINGS, "Settings", R.drawable.glyph_settings)
)
private val shellBackRoutes = setOf(
@ -651,7 +648,7 @@ private fun AppBottomNavigation(
onClick = { onRouteSelected(item.route) },
icon = {
Icon(
imageVector = item.icon,
imageVector = ImageVector.vectorResource(item.iconRes),
contentDescription = item.label
)
},

View File

@ -3,6 +3,7 @@ package app.closer.ui.home
import app.closer.core.navigation.AppRoute
import app.closer.domain.model.Question
import app.closer.domain.model.QuestionCategory
import androidx.annotation.DrawableRes
import androidx.compose.foundation.layout.Spacer
import androidx.compose.material3.Button
import androidx.compose.ui.window.Dialog
@ -43,13 +44,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.TrendingUp
import androidx.compose.material.icons.automirrored.filled.ArrowForward
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Lock
import androidx.compose.material.icons.filled.LocalFireDepartment
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material3.ButtonDefaults
import app.closer.domain.model.OutcomeDay
import app.closer.ui.components.OutcomeCheckInDialog
@ -71,8 +65,10 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.foundation.clickable
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.vectorResource
import app.closer.ui.components.BrandIllustration
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
@ -384,6 +380,35 @@ private fun HomeContent(
}
}
@DrawableRes
private fun homeActionGlyph(target: HomeActionTarget): Int = when (target) {
HomeActionTarget.InvitePartner -> R.drawable.glyph_couple
HomeActionTarget.DailyQuestion -> R.drawable.glyph_daily_card
HomeActionTarget.AnswerHistory -> R.drawable.glyph_paired_cards
HomeActionTarget.QuestionPacks -> R.drawable.glyph_question_packs
HomeActionTarget.Settings -> R.drawable.glyph_settings
HomeActionTarget.AnswerReveal -> R.drawable.glyph_sealed_answer
HomeActionTarget.Game -> R.drawable.glyph_closer_heart_keyhole
HomeActionTarget.Challenge -> R.drawable.glyph_connection_challenge
HomeActionTarget.DatePlan -> R.drawable.glyph_date_card_heart
HomeActionTarget.MemoryCapsule -> R.drawable.glyph_memory_capsule
}
@Composable
private fun HomeGlyphIcon(
@DrawableRes resId: Int,
contentDescription: String?,
tint: Color,
modifier: Modifier = Modifier
) {
Icon(
imageVector = ImageVector.vectorResource(resId),
contentDescription = contentDescription,
tint = tint,
modifier = modifier
)
}
@Composable
private fun StreakCard(
streakCount: Int,
@ -417,8 +442,8 @@ private fun StreakCard(
modifier = Modifier.size(52.dp)
) {
Box(contentAlignment = Alignment.Center) {
Icon(
imageVector = Icons.Filled.LocalFireDepartment,
HomeGlyphIcon(
resId = R.drawable.glyph_streak,
contentDescription = null,
tint = CloserPalette.PinkAccentDeep,
modifier = Modifier.size(28.dp)
@ -491,8 +516,8 @@ private fun HomeHeader(
.clickable(onClick = onTogether),
contentAlignment = Alignment.Center
) {
Icon(
Icons.Filled.Favorite,
HomeGlyphIcon(
resId = R.drawable.glyph_closer_heart_keyhole,
contentDescription = "Together activity",
tint = CloserPalette.PurpleRich,
modifier = Modifier.size(20.dp)
@ -576,8 +601,8 @@ private fun PartnerActivationCard(
horizontalArrangement = Arrangement.spacedBy(5.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Filled.Lock,
HomeGlyphIcon(
resId = R.drawable.glyph_lock,
contentDescription = null,
tint = inviteTone.deep,
modifier = Modifier.size(14.dp)
@ -838,8 +863,8 @@ private fun PrimaryHomeActionCard(
modifier = Modifier.size(52.dp)
) {
Box(contentAlignment = Alignment.Center) {
Icon(
imageVector = Icons.Filled.Favorite,
HomeGlyphIcon(
resId = homeActionGlyph(action.target),
contentDescription = null,
tint = colors.deep,
modifier = Modifier.size(26.dp)
@ -987,8 +1012,8 @@ private fun SecondaryHomeActionCard(
.background(colors.soft, RoundedCornerShape(CloserRadii.Button)),
contentAlignment = Alignment.Center
) {
Icon(
imageVector = Icons.Filled.Favorite,
HomeGlyphIcon(
resId = homeActionGlyph(action.target),
contentDescription = null,
tint = colors.deep,
modifier = Modifier.size(20.dp)
@ -1025,8 +1050,8 @@ private fun SecondaryHomeActionCard(
shape = RoundedCornerShape(CloserRadii.Button),
color = colors.soft
) {
Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowForward,
HomeGlyphIcon(
resId = R.drawable.glyph_forward,
contentDescription = action.cta,
tint = colors.deep,
modifier = Modifier
@ -1319,8 +1344,8 @@ private fun GameWaitingHeroCard(
.border(1.5.dp, Color.White.copy(alpha = 0.5f), CircleShape),
contentAlignment = Alignment.Center
) {
Icon(
imageVector = Icons.Filled.PlayArrow,
HomeGlyphIcon(
resId = R.drawable.glyph_play,
contentDescription = null,
tint = Color.White,
modifier = Modifier.size(24.dp)
@ -1349,7 +1374,7 @@ private fun GameWaitingHeroCard(
shape = RoundedCornerShape(CloserRadii.Button)
) {
Icon(
imageVector = Icons.Filled.PlayArrow,
imageVector = ImageVector.vectorResource(R.drawable.glyph_play),
contentDescription = null,
modifier = Modifier.size(20.dp)
)
@ -1389,8 +1414,8 @@ private fun PendingActionCardView(
.background(colors.soft, RoundedCornerShape(CloserRadii.Button)),
contentAlignment = Alignment.Center
) {
Icon(
imageVector = Icons.Filled.Favorite,
HomeGlyphIcon(
resId = homeActionGlyph(card.target),
contentDescription = null,
tint = colors.deep,
modifier = Modifier.size(20.dp)
@ -1417,8 +1442,8 @@ private fun PendingActionCardView(
)
}
}
Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowForward,
HomeGlyphIcon(
resId = R.drawable.glyph_forward,
contentDescription = "Open",
tint = colors.deep,
modifier = Modifier.size(20.dp)