Skip to content

Commit 79713e2

Browse files
committed
Refactor: 추천루틴화면 리디자인 반영
1 parent 0d18c1c commit 79713e2

1 file changed

Lines changed: 42 additions & 30 deletions

File tree

presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineScreen.kt

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ import androidx.compose.foundation.layout.statusBarsPadding
1616
import androidx.compose.foundation.lazy.LazyColumn
1717
import androidx.compose.foundation.lazy.LazyRow
1818
import androidx.compose.foundation.lazy.items
19+
import androidx.compose.foundation.lazy.rememberLazyListState
1920
import androidx.compose.material3.Text
2021
import androidx.compose.runtime.Composable
22+
import androidx.compose.runtime.LaunchedEffect
2123
import androidx.compose.runtime.getValue
2224
import androidx.compose.ui.Alignment
2325
import androidx.compose.ui.Modifier
@@ -79,10 +81,18 @@ private fun RecommendRoutineScreen(
7981
onRecommendRoutineByEmotionClick: () -> Unit,
8082
onRegisterRoutineClick: (String) -> Unit,
8183
) {
84+
val listState = rememberLazyListState()
85+
86+
LaunchedEffect(uiState.selectedCategory) {
87+
if (listState.firstVisibleItemIndex > 0 || listState.firstVisibleItemScrollOffset > 0) {
88+
listState.animateScrollToItem(0)
89+
}
90+
}
91+
8292
Column(
8393
modifier = Modifier
8494
.fillMaxSize()
85-
.background(BitnagilTheme.colors.white)
95+
.background(BitnagilTheme.colors.coolGray99)
8696
.statusBarsPadding(),
8797
) {
8898
BitnagilTopBar(title = "추천 루틴")
@@ -107,7 +117,16 @@ private fun RecommendRoutineScreen(
107117
}
108118
}
109119

110-
Spacer(modifier = Modifier.height(18.dp))
120+
if (uiState.shouldShowEmotionButton) {
121+
Spacer(modifier = Modifier.height(20.dp))
122+
123+
EmotionRecommendRoutineButton(
124+
onClick = onRecommendRoutineByEmotionClick,
125+
modifier = Modifier.padding(horizontal = 16.dp),
126+
)
127+
}
128+
129+
Spacer(modifier = Modifier.height(20.dp))
111130

112131
Row(
113132
verticalAlignment = Alignment.CenterVertically,
@@ -118,9 +137,9 @@ private fun RecommendRoutineScreen(
118137
.padding(start = 16.dp),
119138
) {
120139
Text(
121-
text = "루틴 목록",
122-
color = BitnagilTheme.colors.coolGray10,
123-
style = BitnagilTheme.typography.body1SemiBold,
140+
text = "추천 루틴리스트",
141+
color = BitnagilTheme.colors.coolGray60,
142+
style = BitnagilTheme.typography.body2SemiBold,
124143
modifier = Modifier.weight(1f),
125144
)
126145

@@ -132,15 +151,15 @@ private fun RecommendRoutineScreen(
132151
.clickableWithoutRipple { onShowDifficultyBottomSheet() },
133152
) {
134153
Text(
135-
text = uiState.selectedRecommendLevel?.displayName ?: "난이도 선택",
136-
color = BitnagilTheme.colors.coolGray60,
154+
text = "난이도 ${uiState.selectedRecommendLevel?.toKoreanLevel() ?: "선택"}",
155+
color = BitnagilTheme.colors.coolGray40,
137156
style = BitnagilTheme.typography.body2Medium,
138157
modifier = Modifier.padding(start = 10.dp),
139158
)
140159

141160
BitnagilIcon(
142161
id = R.drawable.ic_down_arrow,
143-
tint = BitnagilTheme.colors.coolGray60,
162+
tint = BitnagilTheme.colors.coolGray40,
144163
modifier = Modifier
145164
.padding(end = 13.dp)
146165
.size(16.dp),
@@ -150,29 +169,22 @@ private fun RecommendRoutineScreen(
150169

151170
Spacer(modifier = Modifier.height(12.dp))
152171

153-
Column(
154-
modifier = Modifier.padding(horizontal = 16.dp),
172+
LazyColumn(
173+
state = listState,
174+
verticalArrangement = Arrangement.spacedBy(12.dp),
175+
contentPadding = PaddingValues(bottom = 12.dp),
176+
modifier = Modifier
177+
.fillMaxSize()
178+
.padding(horizontal = 16.dp),
155179
) {
156-
LazyColumn(
157-
verticalArrangement = Arrangement.spacedBy(12.dp),
158-
) {
159-
if (uiState.isDefaultCategory && uiState.emotionMarbleType == null) {
160-
item {
161-
EmotionRecommendRoutineButton(
162-
onClick = onRecommendRoutineByEmotionClick,
163-
)
164-
}
165-
}
166-
items(
167-
items = uiState.currentRoutines,
168-
key = { "${it.id}_${it.name}" },
169-
) { routine ->
170-
RecommendRoutineItem(
171-
routineName = routine.name,
172-
routineDescription = routine.description,
173-
onAddRoutineClick = { onRegisterRoutineClick(routine.id.toString()) },
174-
)
175-
}
180+
items(
181+
items = uiState.currentRoutines,
182+
key = { it.id },
183+
) { routine ->
184+
RecommendRoutineItem(
185+
routine = routine,
186+
onAddRoutineClick = { onRegisterRoutineClick(routine.id.toString()) },
187+
)
176188
}
177189
}
178190
}

0 commit comments

Comments
 (0)