refactor(home): extract action feed -> components/HomeActionFeed.kt

Step 5/9. Verbatim move (section public, card private). compileDebugKotlin green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
null 2026-07-11 19:31:42 -05:00
parent 88460922c3
commit 48197ffd1e
2 changed files with 125 additions and 96 deletions

View File

@ -87,6 +87,7 @@ import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.SnackbarHostState
import androidx.hilt.navigation.compose.hiltViewModel import androidx.hilt.navigation.compose.hiltViewModel
import app.closer.R import app.closer.R
import app.closer.ui.home.components.ActionFeedSection
import app.closer.ui.home.components.CategoryPreviewGrid import app.closer.ui.home.components.CategoryPreviewGrid
import app.closer.ui.home.components.EmptyHomeContent import app.closer.ui.home.components.EmptyHomeContent
import app.closer.ui.home.components.ErrorHomeCard import app.closer.ui.home.components.ErrorHomeCard
@ -1181,102 +1182,6 @@ private fun PrimaryHomeActionCard(
} }
} }
@Composable
private fun ActionFeedSection(
actions: List<HomeAction>,
onAction: (HomeAction) -> Unit
) {
if (actions.isEmpty()) return
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text(
text = "More ways to connect",
style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.SemiBold),
color = MaterialTheme.colorScheme.onSurface
)
actions.forEach { action ->
SecondaryHomeActionCard(action = action, onAction = onAction)
}
}
}
@Composable
private fun SecondaryHomeActionCard(
action: HomeAction,
onAction: (HomeAction) -> Unit
) {
val colors = action.tone.actionColors()
CloserClickableCard(
onClick = { onAction(action) },
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(CloserRadii.Card),
containerColor = MaterialTheme.colorScheme.surface,
elevation = CloserElevations.Card
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
horizontalArrangement = Arrangement.spacedBy(13.dp),
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
.size(40.dp)
.background(colors.soft, RoundedCornerShape(CloserRadii.Button)),
contentAlignment = Alignment.Center
) {
HomeGlyphIcon(
resId = homeActionGlyph(action.target),
contentDescription = null,
tint = colors.deep,
modifier = Modifier.size(20.dp)
)
}
Column(
modifier = Modifier.weight(1f),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
text = action.eyebrow,
style = MaterialTheme.typography.labelMedium,
color = colors.deep,
fontWeight = FontWeight.SemiBold,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
text = action.title,
style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.SemiBold),
color = MaterialTheme.colorScheme.onSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
text = action.body,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
}
Surface(
shape = RoundedCornerShape(CloserRadii.Button),
color = colors.soft
) {
HomeGlyphIcon(
resId = R.drawable.glyph_forward,
contentDescription = action.cta,
tint = colors.deep,
modifier = Modifier
.padding(9.dp)
.size(18.dp)
)
}
}
}
}
@Composable @Composable
private fun MomentCueCard() { private fun MomentCueCard() {

View File

@ -0,0 +1,124 @@
package app.closer.ui.home.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import app.closer.R
import app.closer.ui.components.CloserClickableCard
import app.closer.ui.components.CloserElevations
import app.closer.ui.components.CloserRadii
import app.closer.ui.home.HomeAction
/** Home's "More ways to connect" secondary action feed. Extracted from HomeScreen.kt. */
@Composable
fun ActionFeedSection(
actions: List<HomeAction>,
onAction: (HomeAction) -> Unit
) {
if (actions.isEmpty()) return
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text(
text = "More ways to connect",
style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.SemiBold),
color = MaterialTheme.colorScheme.onSurface
)
actions.forEach { action ->
SecondaryHomeActionCard(action = action, onAction = onAction)
}
}
}
@Composable
private fun SecondaryHomeActionCard(
action: HomeAction,
onAction: (HomeAction) -> Unit
) {
val colors = action.tone.actionColors()
CloserClickableCard(
onClick = { onAction(action) },
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(CloserRadii.Card),
containerColor = MaterialTheme.colorScheme.surface,
elevation = CloserElevations.Card
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
horizontalArrangement = Arrangement.spacedBy(13.dp),
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
.size(40.dp)
.background(colors.soft, RoundedCornerShape(CloserRadii.Button)),
contentAlignment = Alignment.Center
) {
HomeGlyphIcon(
resId = homeActionGlyph(action.target),
contentDescription = null,
tint = colors.deep,
modifier = Modifier.size(20.dp)
)
}
Column(
modifier = Modifier.weight(1f),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
text = action.eyebrow,
style = MaterialTheme.typography.labelMedium,
color = colors.deep,
fontWeight = FontWeight.SemiBold,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
text = action.title,
style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.SemiBold),
color = MaterialTheme.colorScheme.onSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
text = action.body,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
}
Surface(
shape = RoundedCornerShape(CloserRadii.Button),
color = colors.soft
) {
HomeGlyphIcon(
resId = R.drawable.glyph_forward,
contentDescription = action.cta,
tint = colors.deep,
modifier = Modifier
.padding(9.dp)
.size(18.dp)
)
}
}
}
}