Skip to content

Commit

Permalink
Feature #247: nickname, edit success
Browse files Browse the repository at this point in the history
  • Loading branch information
0se0 committed Oct 8, 2024
1 parent dc37a87 commit 5c6fb85
Show file tree
Hide file tree
Showing 10 changed files with 611 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,18 @@ internal class MainNavigator(
currentDestination?.hasRoute(it::class) == true
} && (currentTab?.showBottomSheet ?: true)

fun navigateToAddMenu(storeId: Long, navOptions: NavOptions? = null) {
navController.navigate("add_menu_route/$storeId", navOptions)
fun navigateToEditMenu(storeId: Long, navOptions: NavOptions? = null) {
navController.navigate("edit_menu_route/$storeId", navOptions)
}

fun navigateToEditMenu(storeId: Long, navOptions: NavOptions? = null){
navController.navigate("modify_menu_route/$storeId", navOptions)
fun navigateToEditMod(storeId: Long, menuId: Long, menuName: String, price: String) {
navController.navigate("edit_mod_route/$storeId/$menuId/$menuName/$price")
}

fun navigateToEditMod(storeId: Long, menuId: Long, menuName: String, price: String) {
navController.navigate("modify_menu_route/$storeId/$menuId/$menuName/$price")
fun navigateToEditSuccess(storeId: Long) {
navController.navigate("edit_mod_success_route/$storeId")
}

}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import com.hankki.core.designsystem.theme.HankkiTheme
import com.hankki.core.designsystem.theme.HankkijogboTheme
import com.hankki.core.designsystem.theme.Red500
import com.hankki.core.designsystem.theme.White
import com.hankki.core.designsystem.theme.hankkiTypography
import com.hankki.feature.home.navigation.Home
import com.hankki.feature.home.navigation.homeNavGraph
import com.hankki.feature.login.navigation.Login
Expand Down Expand Up @@ -293,13 +292,16 @@ internal fun MainScreen(
}
)
storeDetailNavGraph(
navController = navigator.navController,
navigateUp = navigator::navigateUpIfNotHome,
navigateToAddNewJogbo = navigator::navigateToNewJogbo,
onShowSnackBar = onShowTextSnackBarWithButton,
onShowTextSnackBar = onShowErrorSnackBar,
navigateToAddMenu = { storeId -> navigator.navigateToAddMenu(storeId) },
navigateToAddMenu = { storeId -> navigator.navigateToEditMenu(storeId) },
navigateToEditMenu = { storeId-> navigator.navigateToEditMenu(storeId) },
navigateToEditMod = { storeId, menuId, menuName, price -> navigator.navigateToEditMod(storeId, menuId, menuName, price) }
navigateToEditMod = { storeId, menuId, menuName, price -> navigator.navigateToEditMod(storeId, menuId, menuName, price) },
navigateToEditSuccess = { storeId -> navigator.navigateToEditSuccess(storeId) },
navigateToStoreDetail = { storeId -> navigator.navigateToStoreDetail(storeId) }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.hankki.core.common.extension.noRippleClickable
import com.hankki.core.common.utill.UiState
import com.hankki.core.designsystem.component.layout.BottomBlurLayout
import com.hankki.core.designsystem.component.layout.HankkiLoadingScreen
import com.hankki.core.designsystem.component.topappbar.HankkiTopBar
import com.hankki.core.designsystem.theme.Gray700
Expand Down Expand Up @@ -72,84 +73,98 @@ fun EditMenuScreen(
) {
var selectedMenu by remember { mutableStateOf<MenuItem?>(null) }

Column(
Box(
modifier = Modifier
.fillMaxSize()
) {
Column(
modifier = Modifier
.weight(0.9f)
.fillMaxSize()
) {
Spacer(modifier = Modifier.statusBarsPadding())
HankkiTopBar(
leadingIcon = {
Icon(
painter = painterResource(com.hankki.core.designsystem.R.drawable.ic_arrow_left),
contentDescription = "뒤로가기",
modifier = Modifier
.offset(x = 6.dp, y = 2.dp)
.noRippleClickable(onClick = onNavigateUp),
tint = Gray700
)
}
)
Column(
modifier = Modifier
.weight(0.9f)
) {
Spacer(modifier = Modifier.statusBarsPadding())
HankkiTopBar(
leadingIcon = {
Icon(
painter = painterResource(com.hankki.core.designsystem.R.drawable.ic_arrow_left),
contentDescription = "뒤로가기",
modifier = Modifier
.offset(x = 6.dp, y = 2.dp)
.noRippleClickable(onClick = onNavigateUp),
tint = Gray700
)
}
)

Spacer(modifier = Modifier.padding(top = 18.dp))
Text(
text = "어떤 메뉴를 편집할까요?",
style = HankkiTheme.typography.suitH2,
color = Gray900,
modifier = Modifier.padding(start = 22.dp)
)
Spacer(modifier = Modifier.padding(top = 18.dp))
Text(
text = "어떤 메뉴를 편집할까요?",
style = HankkiTheme.typography.suitH2,
color = Gray900,
modifier = Modifier.padding(start = 22.dp)
)

when (storeDetailState) {
UiState.Loading -> {
Box(
modifier = Modifier
.fillMaxSize()
.background(White)
) {
HankkiLoadingScreen(modifier = Modifier.align(Alignment.Center))
when (storeDetailState) {
UiState.Loading -> {
Box(
modifier = Modifier
.fillMaxSize()
.background(White)
) {
HankkiLoadingScreen(modifier = Modifier.align(Alignment.Center))
}
}
}

is UiState.Success -> {
menuItems.forEach { menuItem ->
MenuItemComponent(
menuItem = menuItem,
selectedMenu = selectedMenu?.name,
onMenuSelected = {
selectedMenu = menuItem
onMenuSelected(menuItem.name)
}
)
is UiState.Success -> {
menuItems.forEach { menuItem ->
MenuItemComponent(
menuItem = menuItem,
selectedMenu = selectedMenu?.name,
onMenuSelected = {
selectedMenu = menuItem
onMenuSelected(menuItem.name)
}
)
}
}
}

UiState.Failure -> {}
UiState.Failure -> {}
}
}
}

SegmentedButton(
option1 = "삭제하기",
option2 = "수정하기",
onOptionSelected = { selectedOption ->
if (selectedOption == "삭제하기") {
onDeleteMenuClick()
} else if (selectedOption == "수정하기") {
selectedMenu?.let { menu ->
onEditModClick(menu.id, menu.name, menu.price.toString())
SegmentedButton(
option1 = "삭제하기",
option2 = "수정하기",
onOptionSelected = { selectedOption ->
if (selectedOption == "삭제하기") {
onDeleteMenuClick()
} else if (selectedOption == "수정하기") {
selectedMenu?.let { menu ->
onEditModClick(menu.id, menu.name, menu.price.toString())
}
}
}
},
modifier = Modifier
.fillMaxWidth()
.weight(0.0675f)
)
Spacer(
modifier = Modifier
.padding(bottom = 15.dp)
.navigationBarsPadding()
)
},
modifier = Modifier
.fillMaxWidth()
.weight(0.0675f)
)

Spacer(
modifier = Modifier
.padding(bottom = 15.dp)
.navigationBarsPadding()
)
}

// if (selectedMenu == null) {
// BottomBlurLayout(
// imageBlur = com.hankki.core.designsystem.R.drawable.img_white_gradient_bottom_middle,
// modifier = Modifier.align(Alignment.BottomCenter)
// )
// }

}
}
Loading

0 comments on commit 5c6fb85

Please sign in to comment.