feat: 统一 RecordItem 展示逻辑,与首页保持一致

This commit is contained in:
yovinchen 2024-12-05 11:56:43 +08:00
parent abf529117f
commit 96d5fab40c

View File

@ -22,7 +22,6 @@ fun RecordItem(
members: List<Member> = emptyList() members: List<Member> = emptyList()
) { ) {
var showDeleteDialog by remember { mutableStateOf(false) } var showDeleteDialog by remember { mutableStateOf(false) }
// val dateFormat = remember { SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()) }
val timeFormat = remember { SimpleDateFormat("HH:mm", Locale.getDefault()) } val timeFormat = remember { SimpleDateFormat("HH:mm", Locale.getDefault()) }
val member = members.find { it.id == record.memberId } val member = members.find { it.id == record.memberId }
@ -49,18 +48,12 @@ fun RecordItem(
style = MaterialTheme.typography.bodyLarge style = MaterialTheme.typography.bodyLarge
) )
// 第二行:日期和时间 | 成员 | 详情 // 第二行:时间 | 成员 | 详情
Text( Text(
text = buildString { text = buildString {
// append(dateFormat.format(record.date))
// append(" ")
append(timeFormat.format(record.date)) append(timeFormat.format(record.date))
// if (member != null && member.name != "自己") { append(" | ")
append(" | ") append(member?.name ?: "自己")
if (member != null) {
append(member.name)
}
// }
if (record.description.isNotEmpty()) { if (record.description.isNotEmpty()) {
append(" | ") append(" | ")
append(record.description) append(record.description)