Skip to content

Commit

Permalink
[FEATURE]#74 : 쪽지 목록 아이템 공통 UI 파라미터, Message -> 각 타이틀로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Aug 4, 2024
1 parent 31b0025 commit e9c051d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
18 changes: 9 additions & 9 deletions core/ui/src/main/kotlin/com/bff/wespot/ui/ReservedMessageItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.bff.wespot.designsystem.theme.StaticTypeScale
import com.bff.wespot.designsystem.theme.WeSpotThemeManager
import com.bff.wespot.model.message.response.Message

@Composable
fun ReservedMessageItem(
reservedMessage: Message,
title: String,
subTitle: String,
backgroundColor: String,
iconUrl: String,
chipText: String,
chipEnabled: Boolean = false,
chipEnabled: Boolean = true,
chipDisabledText: String = "",
onClick: () -> Unit,
) {
Expand All @@ -39,22 +41,20 @@ fun ReservedMessageItem(
modifier = Modifier.padding(start = 18.dp, end = 18.dp, top = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
val profile = reservedMessage.receiver.profileCharacter

Box(
modifier = Modifier
.size(42.dp)
.clip(CircleShape)
.background(
runCatching {
Color(parseColor(profile.backgroundColor))
Color(parseColor(backgroundColor))
}.getOrDefault(WeSpotThemeManager.colors.cardBackgroundColor),
),
contentAlignment = Alignment.Center,
) {
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(profile.iconUrl)
.data(iconUrl)
.crossfade(true)
.build(),
contentDescription = stringResource(com.bff.wespot.ui.R.string.user_character_image),
Expand All @@ -67,13 +67,13 @@ fun ReservedMessageItem(
.weight(1f),
) {
Text(
text = stringResource(com.bff.wespot.designsystem.R.string.letter_receiver),
text = title,
style = StaticTypeScale.Default.body6,
color = WeSpotThemeManager.colors.txtSubColor,
)

Text(
text = reservedMessage.receiver.toDescription(),
text = subTitle,
style = StaticTypeScale.Default.body6,
color = WeSpotThemeManager.colors.txtTitleColor,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ fun BlockListScreen(
color = WeSpotThemeManager.colors.txtTitleColor,
)

LazyColumn(
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
items(state.blockList, key = { message -> message.id }) { item ->
LazyColumn(verticalArrangement = Arrangement.spacedBy(12.dp)) {
items(state.blockedMessageList, key = { message -> message.id }) { item ->
ReservedMessageItem(
reservedMessage = item,
title = stringResource(com.bff.wespot.designsystem.R.string.letter_sender),
subTitle = item.senderName,
backgroundColor = item.senderProfile.backgroundColor,
iconUrl = item.senderProfile.iconUrl,
chipText = stringResource(R.string.unblock),
chipEnabled = item.id in state.unBlockList,
chipEnabled = item.id !in state.unBlockList,
chipDisabledText = stringResource(R.string.unblock_done),
onClick = {
action(EntireAction.UnBlockMessage(item.id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ fun ReservedMessageScreen(
) {
items(state.reservedMessageList, key = { message -> message.id }) { item ->
ReservedMessageItem(
reservedMessage = item,
title = stringResource(string.letter_receiver),
subTitle = item.receiver.toDescription(),
backgroundColor = item.receiver.profileCharacter.backgroundColor,
iconUrl = item.receiver.profileCharacter.iconUrl,
chipText = stringResource(R.string.message_edit),
onClick = {
navigator.navigateMessageEditScreen(
Expand Down

0 comments on commit e9c051d

Please sign in to comment.