Skip to content
Merged
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 @@ -2,6 +2,7 @@ package com.afternote.feature.mindrecord.presentation.screen.sender

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
Expand All @@ -25,12 +26,14 @@ import com.afternote.core.ui.asString
import com.afternote.core.ui.theme.AfternoteDesign
import com.afternote.core.ui.theme.AfternoteTheme
import com.afternote.feature.mindrecord.presentation.component.DailyCalendar
import com.afternote.feature.mindrecord.presentation.component.DailyQuestionBanner
import com.afternote.feature.mindrecord.presentation.component.DailyQuestionListCard
import com.afternote.feature.mindrecord.presentation.component.MindRecordEmptyState
import com.afternote.feature.mindrecord.presentation.model.DailyQuestion
import com.afternote.feature.mindrecord.presentation.model.MindRecordCategoryUi
import com.afternote.feature.mindrecord.presentation.viewmodel.DailyQuestionListUiState
import com.afternote.feature.mindrecord.presentation.viewmodel.DailyQuestionListViewModel
import com.afternote.feature.mindrecord.presentation.viewmodel.TodayQuestionUi
import java.time.YearMonth

@Composable
Expand All @@ -54,6 +57,7 @@ fun DailyQuestionAnswerListScreen(
DailyQuestionListContent(
modifier = modifier,
isListView = isListView,
todayQuestion = state.todayQuestion,
answers = state.answers,
onDelete = viewModel::delete,
)
Expand All @@ -66,20 +70,43 @@ private fun DailyQuestionListContent(
isListView: Boolean,
answers: List<DailyQuestion>,
modifier: Modifier = Modifier,
todayQuestion: TodayQuestionUi? = null,
onDelete: (Long) -> Unit = {},
) {
var yearMonth by remember { mutableStateOf(YearMonth.now()) }
val onYearMonthChanged: (YearMonth) -> Unit = { yearMonth = it }
var questionExpanded by remember { mutableStateOf(true) }

// 답변이 0건이어도 오늘의 추천 질문은 보여야 한다 — 종전에는 빈 상태가 화면 전체를
// 대체해 이 영역까지 함께 사라졌다 (#592).
if (isListView && answers.isEmpty()) {
MindRecordEmptyState(modifier = modifier)
Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
TodayRecommendedQuestion(
todayQuestion = todayQuestion,
expanded = questionExpanded,
onToggle = { questionExpanded = !questionExpanded },
)
MindRecordEmptyState()
}
return
}

LazyColumn(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
// Figma 2671:15631 — 답변 목록 위의 "오늘의 추천 질문" 영역.
item {

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.

[normal] today 없는 사용자에게 유령 간격 8dp가 생깁니다.

이 item {} 은 무조건 등록되고 null 이면 아무것도 emit 하지 않는데, LazyColumn 의 spacedBy(8.dp)(:99)는 높이 0인 item 에도 간격을 적용합니다. getToday() 만 실패한 사용자의 목록·캘린더 뷰가 develop 대비 8dp 내려앉습니다. todayQuestion != null 일 때만 item 을 등록해 주세요.

TodayRecommendedQuestion(
todayQuestion = todayQuestion,
expanded = questionExpanded,
onToggle = { questionExpanded = !questionExpanded },
)
}

// Figma 2671:16704 — 캘린더 형은 캘린더 아래에 카드 리스트가 바로 이어짐 (gap 24)
if (!isListView) {
val answeredDays =
Expand Down Expand Up @@ -146,3 +173,25 @@ private fun DailyQuestionAnswerListScreenPreviewTrue() {
)
}
}

/**
* 목록 상단의 "오늘의 추천 질문".
*
* 조회가 실패하면 `todayQuestion` 이 `null` 이라 영역을 그리지 않는다 — 목록 자체는
* 정상이므로 보조 영역 하나 때문에 화면을 오류로 바꾸지 않는다. 실패를 어떻게 알릴지는
* 시안이 정의하지 않아 표현을 새로 만들지 않았다 (#592).
*/
@Composable
private fun TodayRecommendedQuestion(
todayQuestion: TodayQuestionUi?,
expanded: Boolean,
onToggle: () -> Unit,
) {
if (todayQuestion == null) return
DailyQuestionBanner(
questionText = todayQuestion.content,
expanded = expanded,
onToggle = onToggle,
dayNumber = todayQuestion.day,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ sealed interface DailyQuestionListUiState {

data class TodayQuestionUi(
val questionId: Long,
/** "Day N" 배너 표기용 — 서비스 시작일 기준 몇 번째 질문인지. */
val day: Int,
val content: String,
val isAnswered: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class DailyQuestionListViewModel
phase.today?.let {
TodayQuestionUi(
questionId = it.questionId,
day = it.day,
content = it.content,
isAnswered = it.isAnswered,
)
Expand Down
Loading