Skip to content

Commit

Permalink
[feature/get_detail_restaurant] 식당상세화면 뷰 수정(#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed Jan 28, 2024
1 parent c8ae819 commit 9518059
Showing 1 changed file with 38 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -75,6 +76,8 @@ fun DetailRestaurantScreen(
) {
val viewState by detailRestaurantViewModel.viewState.collectAsState()

val restaurantInfo = viewState.restaurantInfo

LaunchedEffect(Unit) {
detailRestaurantViewModel.setEvent(DetailRestaurantEvent.InitDetailRestaurantScreen(restaurantId))
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -242,7 +253,7 @@ fun DetailRestaurantImage(

@Composable
fun DetailRestaurantMainInfo(

restaurantInfo : RestaurantDataEntity
) {
Column(
modifier = Modifier
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()
}
Expand All @@ -412,6 +427,7 @@ fun DetailRestaurantTabLayout(

@Composable
fun DetailRestaurantTabInfo(
restaurantInfo : RestaurantDataEntity,
modifier: Modifier = Modifier,
) {
Column(
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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))
}
Expand Down

0 comments on commit 9518059

Please sign in to comment.