This commit is contained in:
Lars Westermann 2019-06-13 07:36:44 +02:00
parent 664f9c1777
commit dfb07e96ce
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
5 changed files with 32 additions and 8 deletions

View file

@ -23,7 +23,7 @@ fun formatTime(unix: Long, timezone: Long) =
.withLocale(KlockLocale.german)
.format(DateTimeTz.utc(DateTime(unix), TimezoneOffset(timezone.toDouble())))
fun formatTimeDiff(time: Long, now: Long): String {
fun formatTimeDiff(time: Long, now: Long, timezone: Long): String {
var dt = (time - now) / 1000
val seconds = dt % 60
@ -44,11 +44,11 @@ fun formatTimeDiff(time: Long, now: Long): String {
hours > 1L -> {
val nowHour = DateFormat("HH")
.withLocale(KlockLocale.german)
.format(now).toIntOrNull() ?: 0
.format(DateTimeTz.utc(DateTime(time), TimezoneOffset(timezone.toDouble()))).toIntOrNull() ?: 0
val ht = DateFormat("HH:mm")
.withLocale(KlockLocale.german)
.format(time)
.format(DateTimeTz.utc(DateTime(time), TimezoneOffset(timezone.toDouble())))
if ((ht.substringBefore(":").toIntOrNull() ?: 0) < nowHour) {
"morgen"

View file

@ -2,6 +2,7 @@ package de.kif.frontend.views.board
import de.kif.common.formatTimeDiff
import de.kif.common.model.Schedule
import de.kif.frontend.timezoneOffset
import de.kif.frontend.views.overview.getByClassOrCreate
import de.westermann.kobserve.event.EventHandler
import de.westermann.kwebview.View
@ -35,8 +36,8 @@ class BoardSchedule(
fun updateTime(now: Long) {
timeView.textContent = when {
startTime >= now -> "Start ${formatTimeDiff(startTime, now)}"
endTime >= now -> "Ende ${formatTimeDiff(endTime, now)}"
startTime >= now -> "Start ${formatTimeDiff(startTime, now, timezoneOffset)}"
endTime >= now -> "Ende ${formatTimeDiff(endTime, now, timezoneOffset)}"
else -> {
onRemove.emit(Unit)
"---"

View file

@ -196,7 +196,7 @@
.calendar-row {
width: 100% !important;
height: 0.7rem !important;
height: 0.6rem !important;
}
.calendar-cell {
@ -210,6 +210,27 @@
.calendar-entry::after {
content: none;
}
.calendar-header {
.calendar-cell {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.calendar-body {
.calendar-entry-name {
line-height: 1.2rem;
padding-top: 0.5rem;
white-space: normal;
}
}
}
.board-header-date {

View file

@ -134,9 +134,9 @@ fun Route.board() {
attributes["data-end-time"] = endTime.toString()
if (startTime >= nowLocale) {
+"Start ${formatTimeDiff(startTime, nowLocale)}"
+"Start ${formatTimeDiff(startTime, nowLocale, Configuration.Schedule.offset)}"
} else {
+"Ende ${formatTimeDiff(endTime, nowLocale)}"
+"Ende ${formatTimeDiff(endTime, nowLocale, Configuration.Schedule.offset)}"
}
}

View file

@ -59,6 +59,8 @@ private fun DIV.calendarEntry(schedule: Schedule, diff: Int, currentTime: Int) {
val finished = (diff < 0 || diff == 0 && schedule.time + schedule.workGroup.length < currentTime)
attributes["data-finished"] = finished.toString()
title = schedule.workGroup.name
span("calendar-entry-name") {
+schedule.workGroup.name
}