TimerSelection is now secondary
This commit is contained in:
		
							parent
							
								
									e898b6753d
								
							
						
					
					
						commit
						18a055c599
					
				
					 2 changed files with 8 additions and 14 deletions
				
			
		|  | @ -159,6 +159,7 @@ fun StudeezNavGraph( | ||||||
|             TimerSelectionRoute( |             TimerSelectionRoute( | ||||||
|                 open, |                 open, | ||||||
|                 openAndPopUp, |                 openAndPopUp, | ||||||
|  |                 goBack, | ||||||
|                 getCurrentScreen, |                 getCurrentScreen, | ||||||
|                 viewModel = hiltViewModel(), |                 viewModel = hiltViewModel(), | ||||||
|                 drawerViewModel = drawerViewModel, |                 drawerViewModel = drawerViewModel, | ||||||
|  |  | ||||||
|  | @ -8,15 +8,11 @@ import androidx.compose.runtime.collectAsState | ||||||
| import androidx.compose.ui.tooling.preview.Preview | import androidx.compose.ui.tooling.preview.Preview | ||||||
| import androidx.compose.ui.unit.dp | import androidx.compose.ui.unit.dp | ||||||
| import be.ugent.sel.studeez.R | import be.ugent.sel.studeez.R | ||||||
| import be.ugent.sel.studeez.common.composable.PrimaryScreenTemplate | import be.ugent.sel.studeez.common.composable.SecondaryScreenTemplate | ||||||
| import be.ugent.sel.studeez.common.composable.StealthButton | import be.ugent.sel.studeez.common.composable.StealthButton | ||||||
| import be.ugent.sel.studeez.common.composable.TimerEntry | import be.ugent.sel.studeez.common.composable.TimerEntry | ||||||
| import be.ugent.sel.studeez.common.composable.drawer.DrawerActions |  | ||||||
| import be.ugent.sel.studeez.common.composable.drawer.DrawerViewModel | import be.ugent.sel.studeez.common.composable.drawer.DrawerViewModel | ||||||
| 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.NavigationBarViewModel | import be.ugent.sel.studeez.common.composable.navbar.NavigationBarViewModel | ||||||
| import be.ugent.sel.studeez.common.composable.navbar.getNavigationBarActions |  | ||||||
| import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo | import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo | ||||||
| import be.ugent.sel.studeez.resources | import be.ugent.sel.studeez.resources | ||||||
| import kotlinx.coroutines.flow.Flow | import kotlinx.coroutines.flow.Flow | ||||||
|  | @ -41,6 +37,7 @@ fun getTimerSelectionActions( | ||||||
| fun TimerSelectionRoute( | fun TimerSelectionRoute( | ||||||
|     open: (String) -> Unit, |     open: (String) -> Unit, | ||||||
|     openAndPopUp: (String, String) -> Unit, |     openAndPopUp: (String, String) -> Unit, | ||||||
|  |     popUp: () -> Unit, | ||||||
|     getCurrentScreen: () -> String?, |     getCurrentScreen: () -> String?, | ||||||
|     viewModel: TimerSelectionViewModel, |     viewModel: TimerSelectionViewModel, | ||||||
|     drawerViewModel: DrawerViewModel, |     drawerViewModel: DrawerViewModel, | ||||||
|  | @ -48,22 +45,19 @@ fun TimerSelectionRoute( | ||||||
| ) { | ) { | ||||||
|     TimerSelectionScreen( |     TimerSelectionScreen( | ||||||
|         timerSelectionActions = getTimerSelectionActions(viewModel, open), |         timerSelectionActions = getTimerSelectionActions(viewModel, open), | ||||||
|         drawerActions = getDrawerActions(drawerViewModel, open, openAndPopUp), |         popUp = popUp | ||||||
|         navigationBarActions = getNavigationBarActions(navBarViewModel, open, getCurrentScreen), |  | ||||||
|     ) |     ) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @Composable | @Composable | ||||||
| fun TimerSelectionScreen( | fun TimerSelectionScreen( | ||||||
|     timerSelectionActions: TimerSelectionActions, |     timerSelectionActions: TimerSelectionActions, | ||||||
|     drawerActions: DrawerActions, |     popUp: () -> Unit | ||||||
|     navigationBarActions: NavigationBarActions, |  | ||||||
| ) { | ) { | ||||||
|     val timers = timerSelectionActions.getAllTimers().collectAsState(initial = emptyList()) |     val timers = timerSelectionActions.getAllTimers().collectAsState(initial = emptyList()) | ||||||
|     PrimaryScreenTemplate( |     SecondaryScreenTemplate( | ||||||
|         title = resources().getString(R.string.timers), |         title = resources().getString(R.string.timers), | ||||||
|         drawerActions = drawerActions, |         popUp = popUp | ||||||
|         navigationBarActions = navigationBarActions, |  | ||||||
|     ) { |     ) { | ||||||
|         LazyColumn(verticalArrangement = Arrangement.spacedBy(7.dp)) { |         LazyColumn(verticalArrangement = Arrangement.spacedBy(7.dp)) { | ||||||
|             // All timers |             // All timers | ||||||
|  | @ -86,7 +80,6 @@ fun TimerSelectionScreen( | ||||||
| fun TimerSelectionPreview() { | fun TimerSelectionPreview() { | ||||||
|     TimerSelectionScreen( |     TimerSelectionScreen( | ||||||
|         timerSelectionActions = TimerSelectionActions({ flowOf() }, {}), |         timerSelectionActions = TimerSelectionActions({ flowOf() }, {}), | ||||||
|         drawerActions = DrawerActions({}, {}, {}, {}, {}), |         popUp = {} | ||||||
|         navigationBarActions = NavigationBarActions({ false }, {}, {}, {}, {}), |  | ||||||
|     ) |     ) | ||||||
| } | } | ||||||
		Reference in a new issue