Skip to content

Commit

Permalink
refactor(navbar): rename routes
Browse files Browse the repository at this point in the history
SUITEDEV-36595

Co-authored-by: davidSchuppa <[email protected]>
Co-authored-by: megamegax <[email protected]>
Co-authored-by: matusekma <[email protected]>
  • Loading branch information
4 people committed Sep 13, 2024
1 parent e4cd20e commit fd791a7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.emarsys.sample.ui.component.navbar
package com.emarsys.sample.main.navigation


import androidx.compose.material.BottomNavigation
Expand All @@ -12,17 +12,16 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import androidx.navigation.compose.currentBackStackEntryAsState
import com.emarsys.sample.main.navigation.NavigationbarItem
import com.emarsys.sample.ui.style.rowWithMaxWidth

@Composable
fun BottomNavigationBar(navController: NavController) {
val navItems = listOf(
NavigationbarItem.BottomDashBoard,
NavigationbarItem.BottomMobileEngage,
NavigationbarItem.BottomInbox,
NavigationbarItem.BottomPredict,
NavigationbarItem.BottomInApp
NavigationBarItem.BottomDashBoard,
NavigationBarItem.BottomMobileEngage,
NavigationBarItem.BottomInbox,
NavigationBarItem.BottomPredict,
NavigationBarItem.BottomInApp
)
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry?.destination?.route
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.emarsys.sample.main.navigation

import com.emarsys.sample.R

sealed class NavigationBarItem(var route: String, var icon: Int, var title: String) {
data object BottomDashBoard : NavigationBarItem("dashboard", R.drawable.ic_settings, "Dashboard")
data object BottomMobileEngage : NavigationBarItem("mobile-engage", R.drawable.mobile_engage_logo_icon, "Mobile Engage")
data object BottomInbox : NavigationBarItem("inbox", R.drawable.inbox_mailbox_icon, "Inbox")
data object BottomPredict : NavigationBarItem("predict", R.drawable.predict_scarab_icon, "Predict")
data object BottomInApp : NavigationBarItem("inapp", R.drawable.mobile_engage_logo_icon, "InApp")
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class NavigationControllerProvider(private val mainViewModel: MainViewModel) {
@Composable
fun provide(): NavHostController {
val navHostController = rememberNavController()
NavHost(navHostController, startDestination = "bottom-dashboard") {
composable("bottom-dashboard") { mainViewModel.detailScreen.value = mainViewModel.dashBoardScreen }
composable("bottom-mobile-engage") { mainViewModel.detailScreen.value = mainViewModel.mobileEngageScreen }
composable("bottom-inbox") { mainViewModel.detailScreen.value = mainViewModel.inboxScreen }
composable("bottom-predict") { mainViewModel.detailScreen.value = mainViewModel.predictScreen }
composable("bottom-inapp") { mainViewModel.detailScreen.value = mainViewModel.inAppScreen }
NavHost(navHostController, startDestination = "dashboard") {
composable("dashboard") { mainViewModel.detailScreen.value = mainViewModel.dashBoardScreen }
composable("mobile-engage") { mainViewModel.detailScreen.value = mainViewModel.mobileEngageScreen }
composable("inbox") { mainViewModel.detailScreen.value = mainViewModel.inboxScreen }
composable("predict") { mainViewModel.detailScreen.value = mainViewModel.predictScreen }
composable("inapp") { mainViewModel.detailScreen.value = mainViewModel.inAppScreen }
}
return navHostController
}
Expand Down

This file was deleted.

0 comments on commit fd791a7

Please sign in to comment.