From 9518059bd212e956cd5739311bb40320af55150d Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Sun, 28 Jan 2024 22:02:51 +0900 Subject: [PATCH] =?UTF-8?q?[feature/get=5Fdetail=5Frestaurant]=20=EC=8B=9D?= =?UTF-8?q?=EB=8B=B9=EC=83=81=EC=84=B8=ED=99=94=EB=A9=B4=20=EB=B7=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95(#91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/restaurant/DetailRestaurantScreen.kt | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/restaurant/DetailRestaurantScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/restaurant/DetailRestaurantScreen.kt index 0f172cd1..1d012fb7 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/restaurant/DetailRestaurantScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/restaurant/DetailRestaurantScreen.kt @@ -49,6 +49,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel +import com.everymeal.domain.model.restaurant.RestaurantDataEntity import com.everymeal.presentation.R import com.everymeal.presentation.base.LoadState import com.everymeal.presentation.components.EveryMealDialog @@ -75,6 +76,8 @@ fun DetailRestaurantScreen( ) { val viewState by detailRestaurantViewModel.viewState.collectAsState() + val restaurantInfo = viewState.restaurantInfo + LaunchedEffect(Unit) { detailRestaurantViewModel.setEvent(DetailRestaurantEvent.InitDetailRestaurantScreen(restaurantId)) } @@ -120,14 +123,22 @@ fun DetailRestaurantScreen( LazyColumn( modifier = Modifier.padding(innerPadding), ) { - item { - DetailRestaurantImage() + // Todo Test 필요 + if(!restaurantInfo.images.isNullOrEmpty()) { + item { + DetailRestaurantImage() + } } item { - DetailRestaurantMainInfo() + DetailRestaurantMainInfo( + restaurantInfo = restaurantInfo + ) } item { - DetailRestaurantTabLayout(detailRestaurantViewModel) + DetailRestaurantTabLayout( + restaurantInfo = restaurantInfo, + viewModel = detailRestaurantViewModel + ) } } if (viewState.isFabClicked) { @@ -242,7 +253,7 @@ fun DetailRestaurantImage( @Composable fun DetailRestaurantMainInfo( - + restaurantInfo : RestaurantDataEntity ) { Column( modifier = Modifier @@ -256,14 +267,14 @@ fun DetailRestaurantMainInfo( .clip(RoundedCornerShape(4.dp)) .background(color = Gray300) .padding(vertical = 3.dp, horizontal = 6.dp), - text = "술집", + text = restaurantInfo.categoryDetail, color = Gray600, fontSize = 12.sp, style = EveryMealTypo.labelSmall, ) Text( modifier = Modifier.padding(top = 6.dp), - text = "스타벅스 서울대 입구점", + text = restaurantInfo.name, color = Color.Black, fontSize = 22.sp, style = EveryMealTypo.titleMedium, @@ -278,14 +289,14 @@ fun DetailRestaurantMainInfo( ) Text( modifier = Modifier.padding(start = 2.dp), - text = "5.0", + text = restaurantInfo.grade.toString(), color = Gray700, fontSize = 12.sp, fontWeight = FontWeight.Medium, ) Text( modifier = Modifier.padding(start = 2.dp), - text = "(100)", + text = "(${restaurantInfo.reviewCount})", color = Gray700, fontSize = 12.sp, fontWeight = FontWeight.Medium, @@ -319,7 +330,7 @@ fun DetailRestaurantMainInfo( ) Text( modifier = Modifier.padding(start = 4.dp), - text = "89", + text = restaurantInfo.recommendedCount.toString(), color = Gray500, fontSize = 15.sp, style = EveryMealTypo.displaySmall @@ -354,11 +365,12 @@ fun DetailRestaurantMainInfo( @OptIn(ExperimentalFoundationApi::class) @Composable fun DetailRestaurantTabLayout( + restaurantInfo : RestaurantDataEntity, viewModel : DetailRestaurantViewModel ) { val viewState by viewModel.viewState.collectAsState() - val pages = listOf("정보", "사진", "리뷰(0)") + val pages = listOf("정보", "사진", "리뷰(${restaurantInfo.reviewCount})") val coroutineScope = rememberCoroutineScope() @@ -403,7 +415,10 @@ fun DetailRestaurantTabLayout( HorizontalPager(state = pagerState) { page -> when (page) { - 0 -> DetailRestaurantTabInfo(Modifier.padding(horizontal = 20.dp)) + 0 -> DetailRestaurantTabInfo( + restaurantInfo = restaurantInfo, + modifier = Modifier.padding(horizontal = 20.dp) + ) 1 -> DetailRestaurantTabImage() 2 -> DetailRestaurantReview() } @@ -412,6 +427,7 @@ fun DetailRestaurantTabLayout( @Composable fun DetailRestaurantTabInfo( + restaurantInfo : RestaurantDataEntity, modifier: Modifier = Modifier, ) { Column( @@ -428,7 +444,7 @@ fun DetailRestaurantTabInfo( ) Text( modifier = Modifier.padding(start = 4.dp), - text = "서울특별시 관악구 관악로 1", + text = restaurantInfo.address, color = Gray800, fontSize = 14.sp, style = EveryMealTypo.bodySmall @@ -444,7 +460,7 @@ fun DetailRestaurantTabInfo( ) Text( modifier = Modifier.padding(start = 4.dp), - text = "1533-2233", + text = restaurantInfo.phoneNumber, color = Gray800, fontSize = 14.sp, style = EveryMealTypo.bodySmall @@ -458,13 +474,14 @@ fun DetailRestaurantTabInfo( imageVector = ImageVector.vectorResource(R.drawable.icon_link_mono), contentDescription = "link", ) - Text( - modifier = Modifier.padding(start = 4.dp), - text = "카카오맵 이동하기", - color = Gray800, - fontSize = 14.sp, - style = EveryMealTypo.bodySmall - ) +// Version2 KakaoMap +// Text( +// modifier = Modifier.padding(start = 4.dp), +// text = "카카오맵 이동하기", +// color = Gray800, +// fontSize = 14.sp, +// style = EveryMealTypo.bodySmall +// ) } Spacer(modifier = Modifier.padding(18.dp)) }