Cleanup show current tab
This commit is contained in:
parent
d268fcd389
commit
27526151b0
7 changed files with 38 additions and 57 deletions
|
@ -23,6 +23,7 @@ import be.ugent.sel.studeez.resources
|
|||
fun HomeRoute(
|
||||
open: (String) -> Unit,
|
||||
openAndPopUp: (String, String) -> Unit,
|
||||
getCurrentScreen: () -> String?,
|
||||
viewModel: HomeViewModel,
|
||||
drawerViewModel: DrawerViewModel,
|
||||
navBarViewModel: NavigationBarViewModel,
|
||||
|
@ -30,7 +31,7 @@ fun HomeRoute(
|
|||
HomeScreen(
|
||||
onStartSessionClick = { viewModel.onStartSessionClick(open) },
|
||||
drawerActions = getDrawerActions(drawerViewModel, open, openAndPopUp),
|
||||
navigationBarActions = getNavigationBarActions(navBarViewModel, open),
|
||||
navigationBarActions = getNavigationBarActions(navBarViewModel, open, getCurrentScreen),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -45,7 +46,7 @@ fun HomeScreen(
|
|||
title = resources().getString(R.string.home),
|
||||
drawerActions = drawerActions,
|
||||
navigationBarActions = navigationBarActions,
|
||||
action = { FriendsAction() }
|
||||
barAction = { FriendsAction() }
|
||||
) {
|
||||
BasicButton(R.string.start_session, Modifier.basicButton()) {
|
||||
onStartSessionClick()
|
||||
|
|
|
@ -4,22 +4,17 @@ import androidx.compose.material.Icon
|
|||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Edit
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import be.ugent.sel.studeez.R
|
||||
import be.ugent.sel.studeez.common.composable.Headline
|
||||
import be.ugent.sel.studeez.common.composable.PrimaryScreenTemplate
|
||||
import be.ugent.sel.studeez.resources
|
||||
import be.ugent.sel.studeez.common.composable.drawer.DrawerActions
|
||||
import be.ugent.sel.studeez.common.composable.drawer.getDrawerActions
|
||||
import be.ugent.sel.studeez.common.composable.navbar.NavigationBarActions
|
||||
import be.ugent.sel.studeez.common.composable.navbar.getNavigationBarActions
|
||||
import be.ugent.sel.studeez.resources
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import be.ugent.sel.studeez.R.string as AppText
|
||||
|
||||
|
@ -42,12 +37,13 @@ fun getProfileActions(
|
|||
fun ProfileRoute(
|
||||
open: (String) -> Unit,
|
||||
openAndPopUp: (String, String) -> Unit,
|
||||
getCurrentScreen: () -> String?,
|
||||
viewModel: ProfileViewModel,
|
||||
) {
|
||||
ProfileScreen(
|
||||
profileActions = getProfileActions(viewModel, open),
|
||||
drawerActions = getDrawerActions(hiltViewModel(), open, openAndPopUp),
|
||||
navigationBarActions = getNavigationBarActions(hiltViewModel(), open),
|
||||
navigationBarActions = getNavigationBarActions(hiltViewModel(), open, getCurrentScreen),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -65,7 +61,7 @@ fun ProfileScreen(
|
|||
title = resources().getString(AppText.profile),
|
||||
drawerActions = drawerActions,
|
||||
navigationBarActions = navigationBarActions,
|
||||
action = { EditAction(onClick = profileActions.onEditProfileClick) }
|
||||
barAction = { EditAction(onClick = profileActions.onEditProfileClick) }
|
||||
) {
|
||||
Headline(text = (username ?: resources().getString(R.string.no_username)))
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ fun getTimerSelectionActions(
|
|||
fun TimerSelectionRoute(
|
||||
open: (String) -> Unit,
|
||||
openAndPopUp: (String, String) -> Unit,
|
||||
getCurrentScreen: () -> String?,
|
||||
viewModel: TimerSelectionViewModel,
|
||||
drawerViewModel: DrawerViewModel,
|
||||
navBarViewModel: NavigationBarViewModel,
|
||||
|
@ -48,7 +49,7 @@ fun TimerSelectionRoute(
|
|||
TimerSelectionScreen(
|
||||
timerSelectionActions = getTimerSelectionActions(viewModel, open),
|
||||
drawerActions = getDrawerActions(drawerViewModel, open, openAndPopUp),
|
||||
navigationBarActions = getNavigationBarActions(navBarViewModel, open),
|
||||
navigationBarActions = getNavigationBarActions(navBarViewModel, open, getCurrentScreen),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue