ui: LessonSlot separator
This commit is contained in:
@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.only
|
import androidx.compose.foundation.layout.only
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.systemBars
|
import androidx.compose.foundation.layout.systemBars
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
@@ -276,20 +277,36 @@ private fun weekLabel(period: SchedulePeriod): String {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun LessonSlot(slotIndex: Int, slot: TimeSlot) {
|
private fun LessonSlot(slotIndex: Int, slot: TimeSlot) {
|
||||||
Column(Modifier.fillMaxWidth()) {
|
Column(Modifier.fillMaxWidth()) {
|
||||||
Text(
|
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||||
"${slotIndex + 1} пара · ${slot.start.format(TIME)}–${slot.end.format(TIME)}",
|
HorizontalDivider(
|
||||||
style = MaterialTheme.typography.labelMedium,
|
modifier = Modifier.width(10.dp),
|
||||||
color = MaterialTheme.colorScheme.primary
|
color = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
|
Text(
|
||||||
|
"${slotIndex + 1} пара · ${slot.start.format(TIME)}–${slot.end.format(TIME)}",
|
||||||
|
style = MaterialTheme.typography.labelMedium,
|
||||||
|
color = MaterialTheme.colorScheme.primary,
|
||||||
|
modifier = Modifier.padding(horizontal = 4.dp)
|
||||||
|
)
|
||||||
|
HorizontalDivider(color = MaterialTheme.colorScheme.primary, modifier = Modifier.weight(1f))
|
||||||
|
}
|
||||||
if (slot.lessons.isEmpty()) {
|
if (slot.lessons.isEmpty()) {
|
||||||
Text("—", style = MaterialTheme.typography.bodyMedium)
|
Text("—", style = MaterialTheme.typography.bodyMedium)
|
||||||
} else {
|
} else {
|
||||||
slot.lessons.forEach { lesson ->
|
slot.lessons.forEach { lesson ->
|
||||||
Column(Modifier.fillMaxWidth().padding(vertical = 2.dp)) {
|
Column(Modifier.fillMaxWidth().padding(vertical = 2.dp)) {
|
||||||
var any = false
|
var any = false
|
||||||
if(lesson.type != LessonType.OTHER) {
|
|
||||||
|
val meta = listOfNotNull(
|
||||||
|
if(lesson.type == LessonType.OTHER) { null } else { lesson.type.label},
|
||||||
|
lesson.subgroup,
|
||||||
|
lesson.teacher,
|
||||||
|
lesson.room
|
||||||
|
).filter { it.isNotBlank() }.joinToString(" · ")
|
||||||
|
|
||||||
|
if(meta.isNotEmpty()) {
|
||||||
Text(
|
Text(
|
||||||
lesson.type.label,
|
meta,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
@@ -305,21 +322,6 @@ private fun LessonSlot(slotIndex: Int, slot: TimeSlot) {
|
|||||||
any = true
|
any = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val meta = listOfNotNull(
|
|
||||||
lesson.subgroup,
|
|
||||||
lesson.teacher,
|
|
||||||
lesson.room
|
|
||||||
).filter { it.isNotBlank() }.joinToString(" · ")
|
|
||||||
|
|
||||||
if(meta.isNotEmpty()) {
|
|
||||||
Text(
|
|
||||||
meta,
|
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
any = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!any) {
|
if(!any) {
|
||||||
Text(
|
Text(
|
||||||
"-",
|
"-",
|
||||||
|
|||||||
Reference in New Issue
Block a user