refactor(navigation): Improve semantic markup and logging in NavGraph
This commit is contained in:
@@ -38,6 +38,7 @@ import timber.log.Timber
|
||||
// [RELATION: Function('NavGraph') -> [CALLS] -> Function('rememberNavController')]
|
||||
// [RELATION: Function('NavGraph') -> [CALLS] -> Function('currentBackStackEntryAsState')]
|
||||
// [RELATION: Function('NavGraph') -> [CALLS] -> Function('remember')]
|
||||
// [RELATION: Function('NavGraph') -> [CALLS] -> Function('hiltViewModel')]
|
||||
// [RELATION: Function('NavGraph') -> [CREATES_INSTANCE_OF] -> Class('NavigationActions')]
|
||||
// [RELATION: Function('NavGraph') -> [CALLS] -> Function('NavHost')]
|
||||
// [RELATION: Function('NavGraph') -> [CALLS] -> Function('composable')]
|
||||
@@ -75,7 +76,7 @@ fun NavGraph(navController: NavHostController = rememberNavController()) {
|
||||
navController = navController,
|
||||
startDestination = Screen.Setup.route,
|
||||
) {
|
||||
// [COMPOSABLE_SETUP]
|
||||
// [ENTITY: Composable('Screen.Setup.route')]
|
||||
composable(route = Screen.Setup.route) {
|
||||
SetupScreen(onSetupComplete = {
|
||||
navController.navigate(Screen.Dashboard.route) {
|
||||
@@ -83,27 +84,30 @@ fun NavGraph(navController: NavHostController = rememberNavController()) {
|
||||
}
|
||||
})
|
||||
}
|
||||
// [COMPOSABLE_DASHBOARD]
|
||||
// [END_ENTITY: Composable('Screen.Setup.route')]
|
||||
// [ENTITY: Composable('Screen.Dashboard.route')]
|
||||
composable(route = Screen.Dashboard.route) {
|
||||
DashboardScreen(
|
||||
currentRoute = currentRoute,
|
||||
navigationActions = navigationActions,
|
||||
)
|
||||
}
|
||||
// [COMPOSABLE_INVENTORY_LIST]
|
||||
// [END_ENTITY: Composable('Screen.Dashboard.route')]
|
||||
// [ENTITY: Composable('Screen.InventoryList.route')]
|
||||
composable(route = Screen.InventoryList.route) { backStackEntry ->
|
||||
val viewModel: InventoryListViewModel = hiltViewModel(backStackEntry)
|
||||
InventoryListScreen(
|
||||
onItemClick = { item ->
|
||||
// TODO: Navigate to item details
|
||||
Timber.d("Item clicked: ${item.name}")
|
||||
Timber.i("[UI] Item clicked: ${item.name}")
|
||||
},
|
||||
onNavigateBack = {
|
||||
navController.popBackStack()
|
||||
}
|
||||
)
|
||||
}
|
||||
// [COMPOSABLE_ITEM_DETAILS]
|
||||
// [END_ENTITY: Composable('Screen.InventoryList.route')]
|
||||
// [ENTITY: Composable('Screen.ItemDetails.route')]
|
||||
composable(route = Screen.ItemDetails.route) { backStackEntry ->
|
||||
val viewModel: ItemDetailsViewModel = hiltViewModel(backStackEntry)
|
||||
ItemDetailsScreen(
|
||||
@@ -112,11 +116,12 @@ fun NavGraph(navController: NavHostController = rememberNavController()) {
|
||||
},
|
||||
onEditClick = { itemId ->
|
||||
// TODO: Navigate to item edit screen
|
||||
Timber.d("Edit item clicked: $itemId")
|
||||
Timber.i("[UI] Edit item clicked: $itemId")
|
||||
}
|
||||
)
|
||||
}
|
||||
// [COMPOSABLE_ITEM_EDIT]
|
||||
// [END_ENTITY: Composable('Screen.ItemDetails.route')]
|
||||
// [ENTITY: Composable('Screen.ItemEdit.route')]
|
||||
composable(route = Screen.ItemEdit.route) { backStackEntry ->
|
||||
val viewModel: ItemEditViewModel = hiltViewModel(backStackEntry)
|
||||
ItemEditScreen(
|
||||
@@ -125,7 +130,8 @@ fun NavGraph(navController: NavHostController = rememberNavController()) {
|
||||
}
|
||||
)
|
||||
}
|
||||
// [COMPOSABLE_LABELS_LIST]
|
||||
// [END_ENTITY: Composable('Screen.ItemEdit.route')]
|
||||
// [ENTITY: Composable('Screen.LabelsList.route')]
|
||||
composable(Screen.LabelsList.route) { backStackEntry ->
|
||||
val viewModel: LabelsListViewModel = hiltViewModel(backStackEntry)
|
||||
val uiState by viewModel.uiState.collectAsState()
|
||||
@@ -134,18 +140,19 @@ fun NavGraph(navController: NavHostController = rememberNavController()) {
|
||||
uiState = uiState,
|
||||
onLabelClick = { label ->
|
||||
// TODO: Implement navigation to label details screen
|
||||
Timber.d("Label clicked: ${label.name}")
|
||||
Timber.i("[UI] Label clicked: ${label.name}")
|
||||
},
|
||||
onAddClick = {
|
||||
// TODO: Implement navigation to add new label screen
|
||||
Timber.d("Add new label clicked")
|
||||
Timber.i("[UI] Add new label clicked")
|
||||
},
|
||||
onNavigateBack = {
|
||||
navController.popBackStack()
|
||||
}
|
||||
)
|
||||
}
|
||||
// [COMPOSABLE_LOCATIONS_LIST]
|
||||
// [END_ENTITY: Composable('Screen.LabelsList.route')]
|
||||
// [ENTITY: Composable('Screen.LocationsList.route')]
|
||||
composable(route = Screen.LocationsList.route) {
|
||||
LocationsListScreen(
|
||||
currentRoute = currentRoute,
|
||||
@@ -159,14 +166,16 @@ fun NavGraph(navController: NavHostController = rememberNavController()) {
|
||||
},
|
||||
)
|
||||
}
|
||||
// [COMPOSABLE_LOCATION_EDIT]
|
||||
// [END_ENTITY: Composable('Screen.LocationsList.route')]
|
||||
// [ENTITY: Composable('Screen.LocationEdit.route')]
|
||||
composable(route = Screen.LocationEdit.route) { backStackEntry ->
|
||||
val locationId = backStackEntry.arguments?.getString("locationId")
|
||||
LocationEditScreen(
|
||||
locationId = locationId,
|
||||
)
|
||||
}
|
||||
// [COMPOSABLE_SEARCH]
|
||||
// [END_ENTITY: Composable('Screen.LocationEdit.route')]
|
||||
// [ENTITY: Composable('Screen.Search.route')]
|
||||
composable(route = Screen.Search.route) { backStackEntry ->
|
||||
val viewModel: SearchViewModel = hiltViewModel(backStackEntry)
|
||||
SearchScreen(
|
||||
@@ -175,10 +184,11 @@ fun NavGraph(navController: NavHostController = rememberNavController()) {
|
||||
},
|
||||
onItemClick = { item ->
|
||||
// TODO: Navigate to item details
|
||||
Timber.d("Search result item clicked: ${item.name}")
|
||||
Timber.i("[UI] Search result item clicked: ${item.name}")
|
||||
}
|
||||
)
|
||||
}
|
||||
// [END_ENTITY: Composable('Screen.Search.route')]
|
||||
}
|
||||
}
|
||||
// [END_ENTITY: Function('NavGraph')]
|
||||
|
||||
Reference in New Issue
Block a user