@@ -41,6 +41,7 @@ import com.everymeal.presentation.components.EveryMealReportBottomSheetDialog
41
41
import com.everymeal.presentation.components.EveryMealRestaurantItem
42
42
import com.everymeal.presentation.components.EveryMealSortCategoryBottomSheetDialog
43
43
import com.everymeal.presentation.ui.save.SaveTopBar
44
+ import com.everymeal.presentation.ui.signup.UnivSelectContract
44
45
import com.everymeal.presentation.ui.theme.Grey2
45
46
import com.everymeal.presentation.ui.theme.Grey7
46
47
import com.everymeal.presentation.ui.theme.Main100
@@ -52,6 +53,7 @@ fun DetailListScreen(
52
53
detailListViewModel : DetailListViewModel = hiltViewModel(),
53
54
title : String ,
54
55
navigateToPreviousScreen : () -> Unit ,
56
+ onDetailRestaurantClick : (Int ) -> Unit = {}
55
57
) {
56
58
val detailListViewState by detailListViewModel.viewState.collectAsState()
57
59
@@ -61,6 +63,16 @@ fun DetailListScreen(
61
63
detailListViewModel.setEvent(DetailContract .DetailEvent .InitDetailScreen )
62
64
}
63
65
66
+ LaunchedEffect (key1 = detailListViewModel.effect) {
67
+ detailListViewModel.effect.collect { effect ->
68
+ when (effect) {
69
+ is DetailContract .DetailEffect .OnRestaurantClickEffect -> {
70
+ onDetailRestaurantClick(effect.restaurantId)
71
+ }
72
+ }
73
+ }
74
+ }
75
+
64
76
if (detailListViewState.sortBottomSheetState) {
65
77
EveryMealSortCategoryBottomSheetDialog (
66
78
detailListViewState.detailSortCategoryType.title(),
@@ -190,6 +202,9 @@ fun DetailListScreen(
190
202
item?.let {
191
203
EveryMealRestaurantItem (
192
204
restaurant = it,
205
+ onDetailClick = { restaurantIdx ->
206
+ detailListViewModel.setEvent(DetailContract .DetailEvent .OnRestaurantDetailClick (restaurantIdx))
207
+ }
193
208
)
194
209
Spacer (modifier = Modifier .padding(16 .dp))
195
210
}
@@ -275,7 +290,12 @@ fun DetailScreenChip(
275
290
@Preview
276
291
@Composable
277
292
fun PreviewDetailListScreen () {
278
- DetailListScreen (title = " 맛집" ) {
293
+ DetailListScreen (
294
+ title = " 맛집" ,
295
+ navigateToPreviousScreen = {
296
+
297
+ },
298
+ ) {
279
299
280
300
}
281
301
}
0 commit comments