Skip to content

Commit

Permalink
[FEATURE]#155 : 받은 쪽지 학교 이름 위치 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Sep 8, 2024
1 parent e8a174d commit fe31e4c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -61,6 +63,7 @@ fun WSMessageItem(
userInfo = userInfo,
date = date,
wsMessageItemType = wsMessageItemType,
schoolName = schoolName,
)
}
}
Expand Down Expand Up @@ -88,6 +91,7 @@ private fun WSLetterItemOptionButton(

@Composable
private fun WSLetterItemContent(
schoolName: String?,
userInfo: String?,
date: String,
wsMessageItemType: WSMessageItemType,
Expand Down Expand Up @@ -121,16 +125,22 @@ 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 {
Text(
text = userInfo,
color = Gray100,
style = StaticTypeScale.Default.body9,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
Expand Down Expand Up @@ -158,7 +168,6 @@ private fun WSLetterItemContent(
}

sealed interface WSMessageItemType {
// TODO 송신/차단/신고된 메세지는 다른 이모지 사용
@Composable
fun optionIcon(): ImageVector

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe31e4c

Please sign in to comment.