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

Update certification result dialog UI #28

Merged
merged 4 commits into from
May 7, 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 @@ -50,8 +50,11 @@ data class CertifyMissionResponse(
@SerialName("total_tokens") val totalTokens: Int,
)

fun toEntity(): MissionCertificationInfo{
fun toEntity(): MissionCertificationInfo {
val splitedList: List<String>? = choices.first().message.content?.split('|')
return MissionCertificationInfo(isSuccessful = splitedList?.first().toBoolean(), reason = splitedList?.last() ?: "현재 서버 문제로 판단 근거를 출력하기 어렵습니다.")
return MissionCertificationInfo(
isSuccessful = splitedList?.first().toBoolean(),
reason = splitedList?.last() ?: "현재 서버 문제로 판단 근거를 출력하기 어렵습니다.",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package univ.earthbreaker.namu.feature.mission
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -36,15 +37,29 @@ fun MissionCertificationResultDialog(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Spacer(modifier = Modifier.height(30.dp))
Text(
text = if (isSuccessful) "미션 인증에 성공했습니다!" else "미션 인증이 불가한 사진입니다.\n다른 사진으로 신청해주세요.",
style = GTTheme.typography.bodyMedium16,
textAlign = TextAlign.Center,
)
Row {
Text("미션 인증에 ", style = GTTheme.typography.titleSemiBold18)
if (isSuccessful) {
Text(
text = "성공",
style = GTTheme.typography.titleSemiBold18,
color = GTTheme.colors.green1,
)
Text(text = "했습니다!", style = GTTheme.typography.titleSemiBold18)
} else {
Text(
text = "실패",
style = GTTheme.typography.titleSemiBold18,
color = GTTheme.colors.red1,
)
Text(text = "했습니다.", style = GTTheme.typography.titleSemiBold18)
}
}
Spacer(modifier = Modifier.height(10.dp))
Text(
text = reason,
style = GTTheme.typography.detailMedium14,
color = GTTheme.colors.gray6,
textAlign = TextAlign.Center,
)
Spacer(modifier = Modifier.height(30.dp))
Expand Down Expand Up @@ -74,11 +89,21 @@ fun MissionCertificationResultDialog(
private fun MissionCertificationResultIsSuccessfulDialogDialogPreview() {
Column(modifier = Modifier.fillMaxSize()) {
}
MissionCertificationResultDialog(onDismissRequest = {}, isSuccessful = true, reason = "성공한 이유가 여기에 3줄로 표시됨")
MissionCertificationResultDialog(
onDismissRequest = {},
isSuccessful = true,
reason = "성공한 이유가 여기에 3줄로 표시됨",
)
}

@Preview
@Composable
private fun MissionCertificationResultIsNotSuccessfulDialogDialogPreview() {
MissionCertificationResultDialog(onDismissRequest = {}, isSuccessful = false, reason = "실패한 이유가 여기에 3줄로 표시됨")
Column(modifier = Modifier.fillMaxSize()) {
}
MissionCertificationResultDialog(
onDismissRequest = {},
isSuccessful = false,
reason = "실패한 이유가 여기에 3줄로 표시됨",
)
}
3 changes: 3 additions & 0 deletions app/src/main/java/univ/earthbreaker/namu/ui/theme/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ data class Colors(
val bg2Black: Color = Bg2Black,
val bg3Black: Color = Bg3Black,
val bgWhite: Color = BgWhite,
val red1: Color = Red1,
)

val Purple80 = Color(0xFFD0BCFF)
Expand All @@ -39,6 +40,8 @@ val Green3 = Color(0xFFF5FFF8)
val Blue1 = Color(0xFF67B6EF)
val Blue2 = Color(0xFFE0F1FF)

val Red1 = Color(0xFFEF6767)

val White = Color(0xFFFFFFFF)
val Gray1 = Color(0xFFF6F8FF)
val Gray2 = Color(0xFFE9EEF7)
Expand Down