#30 minor refactor

This commit is contained in:
lbarraga 2023-05-01 17:57:42 +02:00
parent f1d24087b4
commit bd48a12d52
2 changed files with 9 additions and 30 deletions

View file

@ -1,6 +1,7 @@
package be.ugent.sel.studeez.screens.timer_edit
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.tooling.preview.Preview
import be.ugent.sel.studeez.common.composable.SecondaryScreenTemplate
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
@ -9,7 +10,7 @@ import be.ugent.sel.studeez.ui.theme.StudeezTheme
data class TimerEditActions(
val getTimerInfo: () -> TimerInfo,
val saveTimer: (TimerInfo) -> Unit
val saveTimer: (TimerInfo, () -> Unit) -> Unit
)
fun getTimerEditActions(
@ -28,36 +29,18 @@ fun TimerEditRoute(
popUp: () -> Unit,
viewModel: TimerEditViewModel,
) {
TimerEditScreen(
timerEditActions = getTimerEditActions(viewModel, open),
popUp = popUp
)
}
@Composable
fun TimerEditScreen(
timerEditActions: TimerEditActions,
popUp: () -> Unit
) {
SecondaryScreenTemplate(title = "Edit Timer", popUp = { /*TODO*/ }) {
val timerEditActions = getTimerEditActions(viewModel, open)
SecondaryScreenTemplate(title = "Edit Timer", popUp = popUp) {
val timerEditScreen = timerEditActions.getTimerInfo().accept(GetTimerEditScreen())
timerEditScreen { timerInfo -> timerEditActions.saveTimer(timerInfo) }
timerEditScreen { timerInfo ->
timerEditActions.saveTimer(timerInfo, popUp)
}
}
}
//@Preview
//@Composable
//fun TimerEditScreenPreview() {
// val editEntries: List<EditEntry> = listOf(
// EditEntry("Name", "MyTimer") {},
// EditEntry("Description", "Dit is een leuke timer") {},
// EditEntry("StudyTime", "25") {}
// )
// val actions = TimerEditActions { editEntries }
// StudeezTheme { TimerEditScreen(timerEditActions = actions) {} }
//}

View file

@ -1,4 +0,0 @@
package be.ugent.sel.studeez.screens.timer_edit.editScreens
class EditScreenUIState {
}