From fe31e4cdbe680050bf9e2e1d10213b0d2cb8007a Mon Sep 17 00:00:00 2001 From: jeongjaino Date: Mon, 9 Sep 2024 00:32:50 +0900 Subject: [PATCH] =?UTF-8?q?[FEATURE]#155=20:=20=EB=B0=9B=EC=9D=80=20?= =?UTF-8?q?=EC=AA=BD=EC=A7=80=20=ED=95=99=EA=B5=90=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bff/wespot/model/user/response/User.kt | 5 +++++ .../designsystem/component/list/WSMessageItem.kt | 13 +++++++++++-- .../wespot/message/screen/MessageStorageScreen.kt | 3 ++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/model/src/main/kotlin/com/bff/wespot/model/user/response/User.kt b/core/model/src/main/kotlin/com/bff/wespot/model/user/response/User.kt index b8ce838de..0051e68ac 100644 --- a/core/model/src/main/kotlin/com/bff/wespot/model/user/response/User.kt +++ b/core/model/src/main/kotlin/com/bff/wespot/model/user/response/User.kt @@ -12,6 +12,11 @@ data class User( fun toSchoolInfo() = "$schoolName ${grade}학년 ${classNumber}반" + fun toShortSchoolName(): String = + schoolName.replace("중학교", "중").replace("고등학교", "고") + + fun toUserInfoWithoutSchoolName() = "${grade}학년 ${classNumber}반 $name" + fun toDescription(): String { val schoolName = schoolName.replace("중학교", "중").replace("고등학교", "고") return "$schoolName ${grade}학년 ${classNumber}반 $name" diff --git a/designsystem/src/main/kotlin/com/bff/wespot/designsystem/component/list/WSMessageItem.kt b/designsystem/src/main/kotlin/com/bff/wespot/designsystem/component/list/WSMessageItem.kt index 938828e6a..81b4cc8a7 100644 --- a/designsystem/src/main/kotlin/com/bff/wespot/designsystem/component/list/WSMessageItem.kt +++ b/designsystem/src/main/kotlin/com/bff/wespot/designsystem/component/list/WSMessageItem.kt @@ -26,6 +26,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.bff.wespot.designsystem.R import com.bff.wespot.designsystem.theme.Gray100 @@ -40,6 +41,7 @@ import com.bff.wespot.designsystem.util.OrientationPreviews fun WSMessageItem( date: String, wsMessageItemType: WSMessageItemType, + schoolName: String? = null, userInfo: String? = null, itemClick: () -> Unit, optionButtonClick: () -> Unit, @@ -61,6 +63,7 @@ fun WSMessageItem( userInfo = userInfo, date = date, wsMessageItemType = wsMessageItemType, + schoolName = schoolName, ) } } @@ -88,6 +91,7 @@ private fun WSLetterItemOptionButton( @Composable private fun WSLetterItemContent( + schoolName: String?, userInfo: String?, date: String, wsMessageItemType: WSMessageItemType, @@ -121,9 +125,13 @@ private fun WSLetterItemContent( Column(modifier = Modifier.padding(top = 2.dp)) { Text( - text = wsMessageItemType.letterStatusText(), + text = schoolName?.let { + wsMessageItemType.letterStatusText() + " $schoolName" + } ?: wsMessageItemType.letterStatusText(), color = Gray100, style = StaticTypeScale.Default.body9, + maxLines = 1, + overflow = TextOverflow.Ellipsis, ) userInfo?.let { @@ -131,6 +139,8 @@ private fun WSLetterItemContent( text = userInfo, color = Gray100, style = StaticTypeScale.Default.body9, + maxLines = 1, + overflow = TextOverflow.Ellipsis, ) } } @@ -158,7 +168,6 @@ private fun WSLetterItemContent( } sealed interface WSMessageItemType { - // TODO 송신/차단/신고된 메세지는 다른 이모지 사용 @Composable fun optionIcon(): ImageVector diff --git a/feature/message/src/main/kotlin/com/bff/wespot/message/screen/MessageStorageScreen.kt b/feature/message/src/main/kotlin/com/bff/wespot/message/screen/MessageStorageScreen.kt index cce7f855e..94b3747e4 100644 --- a/feature/message/src/main/kotlin/com/bff/wespot/message/screen/MessageStorageScreen.kt +++ b/feature/message/src/main/kotlin/com/bff/wespot/message/screen/MessageStorageScreen.kt @@ -220,10 +220,11 @@ fun MessageStorageScreen( item?.let { WSMessageItem( userInfo = if (item.isBlocked.not() && item.isReported.not()) { - item.receiver.toDescription() + item.receiver.toUserInfoWithoutSchoolName() } else { null }, + schoolName = item.receiver.toShortSchoolName(), date = item.receivedAt?.toStringWithDotSeparator() ?: "", wsMessageItemType = when { item.isBlocked -> WSMessageItemType.BlockedMessage