#74 feed now had dates
This commit is contained in:
parent
f3a8c93a3e
commit
ac1bfe4d49
1 changed files with 19 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
||||||
package be.ugent.sel.studeez.screens.home
|
package be.ugent.sel.studeez.screens.home
|
||||||
|
|
||||||
|
import android.icu.text.DateFormat
|
||||||
|
import android.icu.text.SimpleDateFormat
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
@ -21,24 +23,37 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import be.ugent.sel.studeez.R
|
import be.ugent.sel.studeez.R
|
||||||
import be.ugent.sel.studeez.common.composable.StealthButton
|
import be.ugent.sel.studeez.common.composable.StealthButton
|
||||||
import be.ugent.sel.studeez.data.local.models.FeedEntry
|
import be.ugent.sel.studeez.data.local.models.FeedEntry
|
||||||
import be.ugent.sel.studeez.data.local.models.task.Subject
|
import be.ugent.sel.studeez.data.local.models.task.Subject
|
||||||
import be.ugent.sel.studeez.data.local.models.timer_functional.HoursMinutesSeconds
|
import be.ugent.sel.studeez.data.local.models.timer_functional.HoursMinutesSeconds
|
||||||
|
import com.google.type.Date
|
||||||
|
import java.time.temporal.TemporalField
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Feed(
|
fun Feed(
|
||||||
open: (String) -> Unit,
|
open: (String) -> Unit,
|
||||||
viewModel: FeedViewModel = hiltViewModel()
|
viewModel: FeedViewModel = hiltViewModel()
|
||||||
) {
|
) {
|
||||||
val feedEntries = viewModel.getFeedEntries().collectAsState(initial = emptyList())
|
val feedEntries = viewModel.getFeedEntries().collectAsState(initial = emptyMap())
|
||||||
|
|
||||||
LazyColumn {
|
LazyColumn {
|
||||||
items(feedEntries.value) {feedEntry ->
|
|
||||||
FeedEntryCard(feedEntry = feedEntry) {
|
items(feedEntries.value.toList()) {(date, feedEntries) ->
|
||||||
viewModel.continueWithTask(open, feedEntry.subjectId, feedEntry.taskId)
|
Text(
|
||||||
|
text = date,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 20.sp,
|
||||||
|
modifier = Modifier.padding(horizontal = 10.dp)
|
||||||
|
)
|
||||||
|
feedEntries.forEach { feedEntry ->
|
||||||
|
FeedEntryCard(feedEntry = feedEntry) {
|
||||||
|
viewModel.continueWithTask(open, feedEntry.subjectId, feedEntry.taskId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue