feat: question pack library screen, pack art assets, iOS question views
|
|
@ -2,6 +2,7 @@ package app.closer.ui.questions
|
|||
|
||||
import app.closer.ui.theme.closerCardColor
|
||||
import app.closer.ui.theme.closerBackgroundBrush
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
|
|
@ -37,14 +38,18 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import app.closer.R
|
||||
import app.closer.core.navigation.AppRoute
|
||||
import app.closer.domain.model.QuestionCategory
|
||||
import app.closer.ui.components.CategoryGlyph
|
||||
|
|
@ -212,9 +217,23 @@ private fun QuestionPackCard(
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(5.dp)
|
||||
.background(if (item.isLocked) Color(0xFFE3D4EB) else accent)
|
||||
)
|
||||
.height(94.dp)
|
||||
.clip(RoundedCornerShape(topStart = 22.dp, topEnd = 22.dp))
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(packArtworkRes(item.category.id)),
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomStart)
|
||||
.fillMaxWidth()
|
||||
.height(5.dp)
|
||||
.background(if (item.isLocked) Color(0xFFE3D4EB) else accent)
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
|
@ -366,6 +385,33 @@ private fun packAccent(categoryId: String): Color {
|
|||
return palette[kotlin.math.abs(categoryId.hashCode()) % palette.size]
|
||||
}
|
||||
|
||||
private fun packArtworkRes(categoryId: String): Int = when (categoryId) {
|
||||
"communication" -> R.drawable.pack_art_communication
|
||||
"trust",
|
||||
"boundaries",
|
||||
"conflict",
|
||||
"conflict_repair",
|
||||
"rebuilding_trust" -> R.drawable.pack_art_trust_repair
|
||||
"emotional_intimacy",
|
||||
"gratitude",
|
||||
"couple_intimacy" -> R.drawable.pack_art_intimacy
|
||||
"fun",
|
||||
"date_night",
|
||||
"quality_time" -> R.drawable.pack_art_fun_date
|
||||
"future",
|
||||
"values" -> R.drawable.pack_art_future_goals
|
||||
"home_life",
|
||||
"stress" -> R.drawable.pack_art_home_life
|
||||
"money" -> R.drawable.pack_art_money_values
|
||||
"marriage",
|
||||
"parenting" -> R.drawable.pack_art_family_commitment
|
||||
"sex_and_desire",
|
||||
"sexual_preferences",
|
||||
"physical_intimacy" -> R.drawable.pack_art_desire
|
||||
"difficult_conversations" -> R.drawable.pack_art_deep_reflection
|
||||
else -> R.drawable.pack_art_deep_reflection
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LoadingPackCard() {
|
||||
Card(
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 510 KiB |
|
After Width: | Height: | Size: 620 KiB |
|
After Width: | Height: | Size: 550 KiB |
|
After Width: | Height: | Size: 598 KiB |
|
After Width: | Height: | Size: 586 KiB |
|
After Width: | Height: | Size: 587 KiB |
|
After Width: | Height: | Size: 606 KiB |
|
After Width: | Height: | Size: 570 KiB |
|
After Width: | Height: | Size: 468 KiB |
|
After Width: | Height: | Size: 566 KiB |
|
|
@ -409,6 +409,13 @@ struct PackCard: View {
|
|||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: CloserSpacing.sm) {
|
||||
Image(packArtworkName(pack.id))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 82)
|
||||
.clipShape(RoundedRectangle(cornerRadius: CloserRadius.medium, style: .continuous))
|
||||
|
||||
CategoryGlyph(name: pack.name, color: .closerPrimary)
|
||||
|
||||
Text(pack.name)
|
||||
|
|
@ -431,6 +438,33 @@ struct PackCard: View {
|
|||
}
|
||||
}
|
||||
|
||||
private func packArtworkName(_ packId: String) -> String {
|
||||
switch packId {
|
||||
case "communication":
|
||||
return "pack-art-communication"
|
||||
case "trust", "boundaries", "conflict", "conflict_repair", "rebuilding_trust":
|
||||
return "pack-art-trust-repair"
|
||||
case "emotional_intimacy", "gratitude", "couple_intimacy":
|
||||
return "pack-art-intimacy"
|
||||
case "fun", "date_night", "quality_time":
|
||||
return "pack-art-fun-date"
|
||||
case "future", "values":
|
||||
return "pack-art-future-goals"
|
||||
case "home_life", "stress":
|
||||
return "pack-art-home-life"
|
||||
case "money":
|
||||
return "pack-art-money-values"
|
||||
case "marriage", "parenting":
|
||||
return "pack-art-family-commitment"
|
||||
case "sex_and_desire", "sexual_preferences", "physical_intimacy":
|
||||
return "pack-art-desire"
|
||||
case "difficult_conversations":
|
||||
return "pack-art-deep-reflection"
|
||||
default:
|
||||
return "pack-art-deep-reflection"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Question Category
|
||||
|
||||
struct QuestionCategoryView: View {
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 510 KiB |
|
After Width: | Height: | Size: 620 KiB |
|
After Width: | Height: | Size: 550 KiB |
|
After Width: | Height: | Size: 598 KiB |
|
After Width: | Height: | Size: 586 KiB |
|
After Width: | Height: | Size: 587 KiB |
|
After Width: | Height: | Size: 606 KiB |
|
After Width: | Height: | Size: 570 KiB |
|
After Width: | Height: | Size: 468 KiB |
|
After Width: | Height: | Size: 566 KiB |