diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarComposable.kt b/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarComposable.kt index 61964eb..fb4b2a3 100644 --- a/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarComposable.kt +++ b/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarComposable.kt @@ -1,4 +1,4 @@ -package be.ugent.sel.studeez.common.composable +package be.ugent.sel.studeez.screens.navbar import androidx.compose.material.BottomNavigation import androidx.compose.material.BottomNavigationItem @@ -12,10 +12,14 @@ import androidx.compose.material.icons.outlined.DateRange import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel import be.ugent.sel.studeez.ui.theme.StudeezTheme @Composable -fun NavigationBar() { +fun NavigationBar( + popUpAndOpen: (String, String) -> Unit, + viewModel: NavigationBarViewModel = hiltViewModel() +) { // TODO Pass functions and new screens. // TODO Pass which screen is selected. // TODO Disabled -> HIGH/MEDIUM_EMPHASIS if the page is implemented @@ -26,14 +30,14 @@ fun NavigationBar() { icon = { Icon(imageVector = Icons.Default.List, "Home") }, label = { Text(text = "Home") }, selected = false, // TODO - onClick = { /* TODO */ } + onClick = { viewModel.onHomeClick(popUpAndOpen) } ) BottomNavigationItem( icon = { Icon(imageVector = Icons.Default.Check, "Tasks") }, label = { Text(text = "Tasks") }, selected = false, // TODO - onClick = { /* TODO */ } + onClick = { viewModel.onTasksClick(popUpAndOpen) } ) // Hack to space the entries in the navigation bar, make space for fab @@ -43,21 +47,21 @@ fun NavigationBar() { icon = { Icon(imageVector = Icons.Outlined.DateRange, "Sessions") }, label = { Text(text = "Sessions") }, selected = false, // TODO - onClick = { /* TODO */ } + onClick = { viewModel.onSessionsClick(popUpAndOpen) } ) BottomNavigationItem( icon = { Icon(imageVector = Icons.Default.Person, "Profile") }, label = { Text(text = "Profile") }, selected = false, // TODO - onClick = { /* TODO */ } + onClick = { viewModel.onProfileClick(popUpAndOpen) } ) } } -@Preview(showBackground = true) -@Composable -fun NavigationBarPreview() { - StudeezTheme { NavigationBar() } -} \ No newline at end of file +//@Preview(showBackground = true) +//@Composable +//fun NavigationBarPreview() { +// StudeezTheme { NavigationBar() } +//} \ No newline at end of file