Skip to content
Open
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 @@ -77,10 +77,14 @@ fun TimeLetterBlockItem(
verticalAlignment = Alignment.CenterVertically,
) {
val receiverText =
letter.receiverIds
.mapNotNull { receiverNameMap[it] }
.joinToString(", ")
.ifEmpty { "${letter.receiverIds.size}명" }
if (letter.receiverIds.isEmpty()) {
"수신자 정보 없음"
} else {
letter.receiverIds
.mapNotNull { receiverNameMap[it] }
.joinToString(", ")
.ifEmpty { "${letter.receiverIds.size}명" }
}
Text(
text = "수신인 $receiverText",
style = AfternoteDesign.typography.footnoteCaption,
Expand All @@ -92,7 +96,7 @@ fun TimeLetterBlockItem(
style = AfternoteDesign.typography.footnoteCaption,
color = AfternoteDesign.colors.gray6,
)
Spacer(modifier = Modifier.width(43.dp))
Spacer(modifier = Modifier.width(19.dp))
Box {
Image(
painterResource(com.afternote.feature.timeletter.presentation.R.drawable.setting),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
Expand All @@ -31,6 +32,7 @@ import androidx.compose.ui.unit.dp
import coil3.compose.AsyncImage
import com.afternote.core.ui.theme.AfternoteDesign
import com.afternote.feature.timeletter.domain.model.TimeLetter
import com.afternote.feature.timeletter.domain.model.TimeLetterBlock
import com.afternote.feature.timeletter.domain.model.TimeLetterBlockType
import com.afternote.feature.timeletter.domain.model.TimeLetterStatus

Expand All @@ -44,25 +46,36 @@ fun TimeLetterListItem(
) {
var showMenu by remember { mutableStateOf(false) }

Row(modifier = modifier) {
Row(
modifier =
modifier
.border(
width = 1.dp,
color = AfternoteDesign.colors.gray4,
shape = RoundedCornerShape(size = 6.dp),
).padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Column(
modifier =
Modifier
.border(
width = 1.dp,
color = AfternoteDesign.colors.gray4,
shape = RoundedCornerShape(size = 6.dp),
).fillMaxWidth()
.padding(vertical = 19.dp, horizontal = 15.dp),
.weight(1f)
.padding(vertical = 19.dp),
) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = "수신인 ${
letter.receiverIds.mapNotNull { receiverNameMap[it] }.joinToString(", ")
.ifEmpty { "${letter.receiverIds.size}명" }
if (letter.receiverIds.isEmpty()) {
"수신자 정보 없음"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TimeLetterBlockItem.kt 81행과 같은 분기가 그대로 복사돼 있습니다. 문구 규칙이 다시 바뀌면 한쪽만 고쳐지기 쉬우니 TimeLetter.receiverLabel(receiverNameMap) 같은 함수 하나로 모아 두 곳에서 부르면 좋겠습니다. 이 김에 하드코딩된 수신자 정보 없음 도 strings.xml 로 옮기면 다른 화면 문구와 맞습니다.

} else {
letter.receiverIds
.mapNotNull { receiverNameMap[it] }
.joinToString(", ")
.ifEmpty { "${letter.receiverIds.size}명" }
}
}",
style = AfternoteDesign.typography.footnoteCaption,
color = AfternoteDesign.colors.gray6,
Expand All @@ -73,7 +86,7 @@ fun TimeLetterListItem(
style = AfternoteDesign.typography.footnoteCaption,
color = AfternoteDesign.colors.gray6,
)
Spacer(modifier = Modifier.width(43.dp))
Spacer(modifier = Modifier.width(15.dp))
Box {
Image(
painterResource(com.afternote.feature.timeletter.presentation.R.drawable.setting),
Expand Down Expand Up @@ -122,11 +135,17 @@ fun TimeLetterListItem(
}
val thumbUrl = letter.blocks.firstOrNull { it.blockType == TimeLetterBlockType.IMAGE }?.url
if (thumbUrl != null) {
Spacer(modifier = Modifier.width(3.dp))
AsyncImage(
model = thumbUrl,
model =
if (LocalInspectionMode.current) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preview 에서 Coil 이 URL 을 못 그리는 걸 피하려는 분기로 보입니다. 동작은 맞지만 프로덕션 컴포저블에 미리보기 전용 분기가 들어가는 셈이라, 썸네일 model 을 인자로 받게 하거나(Preview 에서 drawable 을 넘김) Coil 의 LocalAsyncImagePreviewHandler 를 Preview 쪽에만 두는 방법도 고려해 주세요. 필수는 아닙니다.

com.afternote.feature.timeletter.presentation.R.drawable.container
} else {
thumbUrl
},
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.size(60.dp),
modifier = Modifier.size(80.dp),
)
}
}
Expand All @@ -148,3 +167,31 @@ private fun TimeLetterItemPreview() {
),
)
}

@Preview(showBackground = true)
@Composable
private fun TimeLetterItemWithImagePreview() {
TimeLetterListItem(
letter =
TimeLetter(
id = 1L,
title = "미래의 나에게",
sendAt = "2026-12-31T00:00:00",
deliveredAt = null,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop 에서 TimeLetter.deliveredAt 이 제거돼(e95a771) 이 인자가 컴파일 오류입니다. 이 줄을 지우고 develop 을 다시 병합하면 CI 가 풀립니다. 같은 파일의 기존 TimeLetterItemPreview 쪽 deliveredAt 은 develop 이 이미 지웠으니 병합 때 develop 쪽을 따르면 됩니다.

status = TimeLetterStatus.SCHEDULED,
blocks =
listOf(
TimeLetterBlock(
id = 1L,
blockType = TimeLetterBlockType.IMAGE,
blockOrder = 1,
textContent = null,
url = "preview-image",
mimeType = "image/png",
),
),
receiverIds = listOf(1L),
),
receiverNameMap = mapOf(1L to "박경민"),
)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading