Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ data class DutchPayDetailResponseDto(
val shares: List<ShareDto>,
val roundedPerPerson: Int?,
val payMore: Boolean,
val createdAt: String
)

@Serializable
data class CreatorDto(
val id: Long,
val name: String
)

@Serializable
data class ShareDto(
val userId: Long,
val name: String,
val amount: Int,
val status: String
val createdAt: String,
val requestUserId: Long
)
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
package com.ssafy.tiggle.data.model.dutchpay.response

import kotlinx.serialization.Serializable
@Serializable
data class DutchPayRequestDetailResponseDto(
val dutchpayId: Long,
val id: Long,
val requestUserId: Long,
val title: String,
val message: String,
val requesterName: String,
val participantCount: Int,
val totalAmount: Long,
val requestedAt: String,
val myAmount: Long,
val originalAmount: Long,
val tiggleAmount: Long,
val payMoreDefault: Boolean,
val creator: Boolean
val status: String,
val creator: CreatorDto,
val shares: List<ShareDto>,
val roundedPerPerson: Long,
val createdAt: String
)
@Serializable
data class CreatorDto(
val id: Long,
val name: String
)

@Serializable
data class ShareDto(
val userId: Long,
val name: String,
val amount: Long,
val status: String,
val tiggleAmount: Long?
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import com.ssafy.tiggle.domain.entity.dutchpay.UserSummary
*/
data class UserSummaryDto(
val id: Long,
val name: String
val name: String,
val university: String? = null,
val department: String? = null
) {
fun toDomain(): UserSummary = UserSummary(
id = id,
name = name
name = name,
university = university,
department = department
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,23 @@ class DutchPayRepositoryImpl @Inject constructor(
if (response.isSuccessful) {
val responseData = response.body()?.data
if (responseData != null) {

val currentUserId = responseData.requestUserId
val currentShare = responseData.shares.find { it.userId == currentUserId }

val detail = DutchPayRequestDetail(
dutchPayId = responseData.dutchpayId,
dutchPayId = responseData.id,
title = responseData.title,
message = responseData.message,
requesterName = responseData.requesterName,
participantCount = responseData.participantCount,
requesterName = responseData.creator.name,
participantCount = responseData.shares.size,
totalAmount = responseData.totalAmount,
requestedAt = responseData.requestedAt,
myAmount = responseData.myAmount,
originalAmount = responseData.originalAmount,
tiggleAmount = responseData.tiggleAmount,
payMoreDefault = responseData.payMoreDefault,
isCreator = responseData.creator
requestedAt = responseData.createdAt,
myAmount = currentShare?.amount ?: 0L,
originalAmount = currentShare?.amount ?: 0L,
tiggleAmount = responseData.roundedPerPerson - (currentShare?.amount ?: 0L),
payMoreDefault = true, // ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์„ค์ •
isCreator = responseData.creator.id == currentUserId
)
Result.success(detail)
} else {
Expand Down Expand Up @@ -96,13 +100,15 @@ class DutchPayRepositoryImpl @Inject constructor(
Share(
userId = shareDto.userId,
name = shareDto.name,
amount = shareDto.amount,
amount = shareDto.amount.toInt(),
tiggleAmount = shareDto.tiggleAmount?.toInt(),
status = shareDto.status
)
},
roundedPerPerson = responseData.roundedPerPerson,
payMore = responseData.payMore,
createdAt = responseData.createdAt
createdAt = responseData.createdAt,
requestUserId = responseData.requestUserId
)
Result.success(detail)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ data class DutchPayDetail(
val shares: List<Share>,
val roundedPerPerson: Int?,
val payMore: Boolean,
val createdAt: String
val createdAt: String,
val requestUserId: Long
)

data class Creator(
Expand All @@ -22,5 +23,6 @@ data class Share(
val userId: Long,
val name: String,
val amount: Int,
val tiggleAmount: Int? = null,
val status: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ package com.ssafy.tiggle.domain.entity.dutchpay
*/
data class UserSummary(
val id: Long,
val name: String
val name: String,
val university: String? = null,
val department: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ fun NavigationGraph(
is Screen.DutchPayDetail -> NavEntry(key) {
DutchPayDetailScreen(
dutchPayId = key.dutchPayId,
onBackClick = { navBackStack.removeLastOrNull() }
onBackClick = { navBackStack.removeLastOrNull() },
onPaymentClick = {
navBackStack.add(Screen.DutchpayRecieve(key.dutchPayId))
}
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Check
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
Expand All @@ -35,15 +36,20 @@ import androidx.compose.runtime.saveable.rememberSaveable
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.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.ssafy.tiggle.R
import com.ssafy.tiggle.domain.entity.dutchpay.UserSummary
import com.ssafy.tiggle.presentation.ui.theme.AppTypography
import com.ssafy.tiggle.presentation.ui.theme.TiggleBlue
import com.ssafy.tiggle.presentation.ui.theme.TiggleBlueLight
import com.ssafy.tiggle.presentation.ui.theme.TiggleGrayLight
import com.ssafy.tiggle.presentation.ui.theme.TiggleGrayText
import com.ssafy.tiggle.presentation.ui.theme.TiggleSkyBlue

@Composable
fun UserPicker(
Expand Down Expand Up @@ -123,39 +129,93 @@ private fun UserRow(user: UserSummary, isSelected: Boolean, onClick: () -> Unit)
modifier = Modifier
.fillMaxWidth()
.clickable { onClick() }
.padding(horizontal = 12.dp, vertical = 14.dp),
.padding(horizontal = 16.dp, vertical = 16.dp),
verticalAlignment = Alignment.CenterVertically
) {
// ์•„๋ฐ”ํƒ€ (์ด๋‹ˆ์…œ)
// ์•„๋ฐ”ํƒ€ (๋‘ฅ๊ทผ ์‚ฌ๊ฐํ˜•)
Box(
modifier = Modifier
.size(32.dp)
.size(48.dp)
.clip(RoundedCornerShape(12.dp))
.background(
color = if (isSelected) TiggleBlue else TiggleGrayLight,
shape = CircleShape
color = if (isSelected) TiggleBlue else TiggleGrayLight
),
contentAlignment = Alignment.Center
) {
Text(
text = user.name.firstOrNull()?.toString() ?: "?",
color = if (isSelected) Color.White else Color.Black,
fontWeight = FontWeight.Bold
fontWeight = FontWeight.Bold,
style = AppTypography.titleMedium
)
}

Column(
modifier = Modifier
.weight(1f)
.padding(start = 12.dp)
.padding(start = 16.dp)
) {
Text(text = user.name, color = Color.Black)
Text(
text = user.name,
color = Color.Black,
fontWeight = FontWeight.Medium,
style = AppTypography.bodyLarge
)

// ํ•™๊ต์™€ ํ•™๊ณผ ์ •๋ณด
if (user.university != null || user.department != null) {
Spacer(Modifier.height(2.dp))
Text(
text = buildString {
if (user.university != null) {
append(user.university)
}
if (user.university != null && user.department != null) {
append(" โ€ข ")
}
if (user.department != null) {
append(user.department)
}
},
color = TiggleGrayText,
style = AppTypography.bodySmall,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
}

Icon(
painter = androidx.compose.ui.res.painterResource(id = R.drawable.check),
contentDescription = null,
tint = if (isSelected) TiggleBlue else TiggleGrayText
)
// ์„ ํƒ ์ƒํƒœ ํ‘œ์‹œ (TiggleSkyBlue ์›ํ˜• ๋ฒ„ํŠผ)
Box(
modifier = Modifier
.size(24.dp)
.clip(CircleShape)
.background(
color = if (isSelected) TiggleBlueLight else Color.White
)
.padding(2.dp),
contentAlignment = Alignment.Center
) {
if (isSelected) {
Icon(
imageVector = Icons.Default.Check,
contentDescription = "selected",
tint = Color.White,
modifier = Modifier.size(16.dp)
)
} else {
// ์„ ํƒ๋˜์ง€ ์•Š์€ ์ƒํƒœ์˜ ํ…Œ๋‘๋ฆฌ (๋™์ผํ•œ ํฌ๊ธฐ ์œ ์ง€)
Box(
modifier = Modifier
.size(20.dp)
.clip(CircleShape)
.background(
color = TiggleGrayText.copy(alpha = 0.3f),
shape = CircleShape
)
)
}
}
}
}

Expand All @@ -167,7 +227,7 @@ private fun SelectedUserChip(name: String, onRemove: () -> Unit, modifier: Modif
.padding(horizontal = 10.dp, vertical = 6.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(text = name, style = MaterialTheme.typography.bodySmall)
Text(text = name, style = AppTypography.bodySmall)
Spacer(Modifier.size(6.dp))
Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.ssafy.tiggle.presentation.ui.dutchpay

import android.R.attr.label
import android.util.Log
import androidx.compose.animation.core.animateIntAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
Expand Down Expand Up @@ -327,9 +329,18 @@ private fun AnimatedNumberCounter(
targetValue: Long,
modifier: Modifier = Modifier
) {
var isVisible by remember { mutableStateOf(false) }

LaunchedEffect(Unit) {
isVisible = true
}

val animatedValue by animateIntAsState(
targetValue = targetValue.toInt(),
animationSpec = tween(durationMillis = 1000),
targetValue = if (isVisible) targetValue.toInt() else 0,
animationSpec = tween(
durationMillis = 1000,
easing = androidx.compose.animation.core.LinearEasing
),
label = "number_animation"
)

Expand Down Expand Up @@ -512,8 +523,12 @@ fun DutchPayCompleteContent(
val myAmount = if (payMore) roundUpToHundreds(perHead) else perHead.toLong()
val friendAmount = perHead.toLong()



Text("์ฐธ์—ฌ์ž (${participantCount}๋ช…)")

DetailRow(
label = "์ฐธ์—ฌ์ž (${participantCount}๋ช…)",
label = "๋‚ด๊ฐ€ ๋‚ธ ๊ธˆ์•ก",
value = Formatter.formatCurrency(myAmount)
)

Expand Down Expand Up @@ -614,9 +629,9 @@ private fun InfoStep(text: String) {
@Composable
private fun PreviewDutchPay_PickUsers() {
val sampleUsers = listOf(
UserSummary(4, "๊น€ํ…Œ์ŠคํŠธ"),
UserSummary(5, "๋ฐ•ํ…Œ์ŠคํŠธ"),
UserSummary(6, "์ดํ…Œ์ŠคํŠธ")
UserSummary(4, "๊น€ํ…Œ์ŠคํŠธ", "์‹ ์€๋Œ€ํ•™๊ต", "์ปดํ“จํ„ฐํ•™๋ถ€"),
UserSummary(5, "๋ฐ•ํ…Œ์ŠคํŠธ", "์‹ ํ•œ๋Œ€ํ•™๊ต", "๊ฑด์ถ•ํ•™๊ณผ"),
UserSummary(6, "์ดํ…Œ์ŠคํŠธ", "์‹ธํ”ผ๋Œ€ํ•™๊ต", "์ธ๊ณต์ง€๋Šฅํ•™๊ณผ")
)
val uiState = CreateDutchPayState(
step = CreateDutchPayStep.PICK_USERS,
Expand Down Expand Up @@ -668,9 +683,9 @@ private fun PreviewDutchPay_InputAmount() {
) {
DutchPayInputAmountContent(
selectedUsers = listOf(
UserSummary(1, "๊น€๋ฏผํ˜ธ"),
UserSummary(2, "๋ฏผ๊ฒฝ์ด"),
UserSummary(3, "ํ™๊ธธ๋™")
UserSummary(1, "๊น€๋ฏผํ˜ธ", "์‹ ์€๋Œ€ํ•™๊ต", "์ปดํ“จํ„ฐํ•™๋ถ€"),
UserSummary(2, "๋ฏผ๊ฒฝ์ด", "์‹ ํ•œ๋Œ€ํ•™๊ต", "๊ฑด์ถ•ํ•™๊ณผ"),
UserSummary(3, "ํ™๊ธธ๋™", "์‹ธํ”ผ๋Œ€ํ•™๊ต", "์ธ๊ณต์ง€๋Šฅํ•™๊ณผ")
),
amountText = uiState.amountText,
onAmountChange = {},
Expand Down Expand Up @@ -704,8 +719,8 @@ private fun PreviewDutchPay_Complete() {
DutchPayCompleteContent(
totalAmount = 50000L,
selectedUsers = listOf(
UserSummary(1, "๊น€๋ฏผ์ค€"),
UserSummary(2, "๋ฐ•์˜ˆ์ค€")
UserSummary(1, "๊น€๋ฏผ์ค€", "์‹ ์€๋Œ€ํ•™๊ต", "์ปดํ“จํ„ฐํ•™๋ถ€"),
UserSummary(2, "๋ฐ•์˜ˆ์ค€", "์‹ ํ•œ๋Œ€ํ•™๊ต", "๊ฑด์ถ•ํ•™๊ณผ")
),
payMore = true
)
Expand Down
Loading