Skip to content

Commit

Permalink
Feature #247: edit bottomsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
0se0 committed Oct 8, 2024
1 parent 8aaba0b commit a31c238
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import com.hankki.core.designsystem.component.button.StoreDetailMenuButton
import com.hankki.core.designsystem.component.button.StoreDetailReportButton
import com.hankki.core.designsystem.component.dialog.DoubleButtonDialog
import com.hankki.core.designsystem.component.dialog.ImageDoubleButtonDialog
import com.hankki.core.designsystem.component.dialog.SingleButtonDialog
import com.hankki.core.designsystem.component.layout.HankkiLoadingScreen
import com.hankki.core.designsystem.component.topappbar.HankkiTopBar
import com.hankki.core.designsystem.theme.Gray400
Expand All @@ -69,6 +68,8 @@ fun StoreDetailRoute(
onShowSnackBar: (String, Long) -> Unit,
onShowTextSnackBar: (String) -> Unit,
viewModel: StoreDetailViewModel = hiltViewModel(),
onAddMenuClick: (Long) -> Unit,
onEditMenuClick: (Long) -> Unit
) {
val tracker = LocalTracker.current

Expand Down Expand Up @@ -151,7 +152,7 @@ fun StoreDetailRoute(
onSelectIndex = { index ->
viewModel.updateSelectedIndex(index)
},
isOpenBottomSheet = storeState.isOpenBottomSheet,
isOpenBottomSheet = storeState.isOpenJogboBottomSheet,
openBottomSheet = viewModel::controlMyJogboBottomSheet,
jogboItems = storeState.jogboItems,
addNewJogbo = {
Expand All @@ -162,33 +163,22 @@ fun StoreDetailRoute(
addStoreAtJogbo = { jogboId ->
viewModel.addStoreAtJogbo(jogboId, storeId)
},
onAddMenuClicked = {
viewModel.showMenuEditDialog()
tracker.track(
type = EventType.CLICK,
name = "RestInfo_MenuEdit"
)
},
onReportClicked = {
viewModel.fetchNickname()
viewModel.showReportConfirmation()
}
},
isOpenEditMenuBottomSheet = storeState.isOpenEditMenuBottomSheet,
openEditMenuBottomSheet = viewModel::controlEditMenuBottomSheet,
onDismissEditMenuBottomSheetRequest = viewModel::controlEditMenuBottomSheet,
onAddMenuClick = { onAddMenuClick(storeId) },
onEditMenuClick = { onEditMenuClick(storeId) },
)
}

is UiState.Failure -> {}
}

when (dialogState) {
StoreDetailDialogState.MENU_EDIT -> {
SingleButtonDialog(
title = "조금만 기다려주세요",
description = "메뉴를 편집할 수 있도록 준비 중이에요:)",
buttonTitle = "확인",
onConfirmation = { viewModel.closeDialog() }
)
}

StoreDetailDialogState.REPORT_CONFIRMATION -> {
DoubleButtonDialog(
title = "정말 제보하시겠어요?",
Expand Down Expand Up @@ -246,8 +236,12 @@ fun StoreDetailScreen(
addNewJogbo: () -> Unit,
onDismissBottomSheetRequest: () -> Unit,
addStoreAtJogbo: (Long) -> Unit,
onAddMenuClicked: () -> Unit,
onReportClicked: () -> Unit,
isOpenEditMenuBottomSheet: Boolean,
openEditMenuBottomSheet: () -> Unit,
onDismissEditMenuBottomSheetRequest: () -> Unit,
onAddMenuClick: () -> Unit,
onEditMenuClick: () -> Unit
) {
val localContextResource = LocalContext.current.resources

Expand All @@ -266,6 +260,14 @@ fun StoreDetailScreen(
)
}

if (isOpenEditMenuBottomSheet) {
EditMenuBottomSheet(
onDismissRequest = onDismissEditMenuBottomSheetRequest,
onAddMenuClick = onAddMenuClick,
onEditMenuClick = onEditMenuClick
)
}

Column(
modifier = Modifier
.fillMaxSize()
Expand Down Expand Up @@ -365,7 +367,7 @@ fun StoreDetailScreen(
}
)
},
onMenuEditClick = onAddMenuClicked
onMenuEditClick = openEditMenuBottomSheet
)

Spacer(modifier = Modifier.height(50.dp))
Expand Down

0 comments on commit a31c238

Please sign in to comment.