Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

챌린지 관련 리뉴얼 디자인 적용 #90

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ data class ChallengeDetailResponse(
val participants = walkies.map { it.toUser() }
return com.whyranoid.domain.model.challenge.Challenge(
badge = challenge.badge.toBadge(),
calorie = challenge.calorie,
challengeType = ChallengeType.getChallengeTypeByString(challenge.category),
id = challenge.challengeId.toLong(),
contents = challenge.content,
Expand All @@ -18,6 +19,11 @@ data class ChallengeDetailResponse(
process = challenge.progress,
participants = participants,
participantCount = participants.size,
period = challenge.period,
distance = challenge.distance,
endTime = challenge.endTime,
startTime = challenge.startTime,
status = challenge.status
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package com.whyranoid.data.model.challenge

data class ChallengeFromServer(
val badge: BadgeResponse,
val calorie: Int?,
val category: String,
val challengeId: Int,
val content: String,
val distance: Int?,
val endTime: String,
val img: String,
val name: String,
val progress: Int?,
val status: String?
val period: Int?,
val progress: Int,
val startTime: String,
val status: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,9 @@ data class Challenge(
val participantCount: Int,
val participants: List<User>,
val process: Int? = null,
) {
companion object {

val DUMMY = Challenge(
id = 1,
imageUrl = "https://picsum.photos/250/250",
title = "햄버거 세트 불태우기",
contents = "햄버거 세트의 평균 칼로리는 1110kcal 에요.\n" +
"일주일 동안 걷기로 햄버거 세트 태우기 도전!",
period = 7,
challengeType = ChallengeType.values().toList().shuffled().first(),
badge = Badge(
id = 1,
name = "햄버거",
imageUrl = "https://picsum.photos/250/250",
),

participantCount = 12,
participants = List(12) { User.DUMMY},
process = (0..100).random(),
)
}
}
val calorie: Int? = null,
val distance: Int? = null,
val endTime: String,
val startTime: String,
val status: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.ExperimentalTextApi
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.drawText
import androidx.compose.ui.text.rememberTextMeasurer
Expand All @@ -36,10 +35,10 @@ import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.whyranoid.domain.model.challenge.Challenge
import com.whyranoid.domain.model.challenge.ChallengeType
import com.whyranoid.presentation.R
import com.whyranoid.presentation.theme.ChallengeColor.getColor

@OptIn(ExperimentalTextApi::class)
@Composable
fun ChallengeGoalContent(
challenge: Challenge
Expand Down Expand Up @@ -153,10 +152,30 @@ fun ChallengeGoalContent(
horizontalArrangement = Arrangement.SpaceEvenly,
verticalAlignment = Alignment.CenterVertically
) {
ChallengeGoalItem(
modifier = Modifier.weight(1f),
goal = "기간", limit = "${challenge.period}일"
)
when (challenge.challengeType) {
ChallengeType.LIFE -> {
ChallengeGoalItem(
modifier = Modifier.weight(1f),
// TODO : limit에 적합한 값 필요(새로운 필드)
// TODO : time 포멧 변경
goal = "${challenge.startTime}~${challenge.endTime}시 사이", limit = challenge.period.toString()
)
}
ChallengeType.CALORIE -> {
ChallengeGoalItem(
modifier = Modifier.weight(1f),
// TODO: 정확한 형식 필요, ex) 20일
goal = "기간", limit = challenge.period.toString()
)
}
ChallengeType.DISTANCE -> {
ChallengeGoalItem(
modifier = Modifier.weight(1f),
// TODO: 텍스트 꾸미기 적용 필요
goal = "거리", limit = "0/${challenge.distance}km"
)
}
}

Divider(
color = challengeColor.progressBarColor,
Expand All @@ -165,10 +184,9 @@ fun ChallengeGoalContent(
.width(1.dp)
)

// TODO: challenge type
ChallengeGoalItem(
modifier = Modifier.weight(1f),
goal = "칼로리", limit = "1110kcal"
goal = "칼로리", limit = if (challenge.challengeType == ChallengeType.CALORIE) "${challenge.calorie}kcal" else "0kcal"
)

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.whyranoid.presentation.theme.ChallengeColor
import com.whyranoid.presentation.theme.WalkieTypography
import com.whyranoid.presentation.util.bouncingClickable

@Composable
Expand Down Expand Up @@ -49,6 +50,7 @@ fun ChallengeItem(
textAlign = TextAlign.Start,
text = text,
overflow = TextOverflow.Ellipsis,
style = WalkieTypography.Body1,
maxLines = 2
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import com.whyranoid.presentation.theme.ChallengeColor
import com.whyranoid.presentation.theme.WalkieTypography
import com.whyranoid.presentation.util.bouncingClickable

// TODO: set Color System
Expand All @@ -33,8 +34,7 @@ fun ChallengingItem(
.fillMaxWidth()
.height(105.dp)
.clip(shape = RoundedCornerShape(20.dp))
.background(color = challengeColor.backgroundColor)
,
.background(color = challengeColor.backgroundColor),
) {

Box(
Expand All @@ -43,7 +43,10 @@ fun ChallengingItem(
.padding(start = 26.dp),
contentAlignment = Alignment.CenterStart
) {
Text(text)
Text(
text = text,
style = WalkieTypography.Body1
)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,29 @@ fun ChallengeExitModalBottomSheetContainer(
style = WalkieTypography.Title
)

Spacer(modifier = Modifier.height(8.dp))
Spacer(modifier = Modifier.height(16.dp))

Text(
text = "${challenge.badge.name} 뱃지가 코 앞이에요.",
style = WalkieTypography.Body2.copy(color = SystemColor.Negative)
)

Spacer(modifier = Modifier.height(22.dp))

Text(
text = challenge.title,
style = WalkieTypography.SubTitle.copy(color = SystemColor.Negative)
)

Spacer(modifier = Modifier.height(22.dp))
Spacer(modifier = Modifier.height(31.dp))

AsyncImage(
model = challenge.badge.imageUrl, contentDescription = "",
modifier = Modifier
.size(100.dp)
.clip(CircleShape)
.padding(bottom = 10.dp),
contentScale = ContentScale.Crop
)

Text(
text = "${challenge.badge.name} 뱃지",
style = WalkieTypography.Body2
)

Spacer(modifier = Modifier.height(16.dp))

Text(
text = "진행률 ${challenge.process}%",
style = WalkieTypography.Body2.copy(
Expand All @@ -97,9 +95,9 @@ fun ChallengeExitModalBottomSheetContainer(
)
)

Spacer(modifier = Modifier.height(37.dp))
Spacer(modifier = Modifier.height(50.dp))

WalkiePositiveButton(text = "계속하기") {
WalkiePositiveButton(text = "도전하기") {
coroutineScope.launch {
modalSheetState.hide()
onPositiveButtonClicked(challenge)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ fun ChallengeDetailContent(
.verticalScroll(scrollState),
) {
// TODO: Async Image
Image(
painter = painterResource(id = R.drawable.dummy_challenge_banner),
AsyncImage(
model = challenge.imageUrl,
contentDescription = null,
modifier = Modifier.fillMaxWidth(),
contentScale = ContentScale.FillWidth
Expand Down Expand Up @@ -208,7 +208,6 @@ fun ChallengeDetailContent(
modifier = Modifier
.size(100.dp)
.clip(CircleShape),
contentScale = ContentScale.Crop
)

Spacer(modifier = Modifier.height(8.dp))
Expand Down
Loading
Loading