From dfb07e96cee2d068f6e7dd03a9830c39410f9603 Mon Sep 17 00:00:00 2001 From: Lars Westermann Date: Thu, 13 Jun 2019 07:36:44 +0200 Subject: [PATCH] Bugfixes --- .../kotlin/de/kif/common/DateFormat.kt | 6 ++--- .../kif/frontend/views/board/BoardSchedule.kt | 5 ++-- .../resources/style/components/_board.scss | 23 ++++++++++++++++++- .../kotlin/de/kif/backend/route/Board.kt | 4 ++-- .../kotlin/de/kif/backend/route/Calendar.kt | 2 ++ 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/commonMain/kotlin/de/kif/common/DateFormat.kt b/src/commonMain/kotlin/de/kif/common/DateFormat.kt index 63de1f6..d336d8b 100644 --- a/src/commonMain/kotlin/de/kif/common/DateFormat.kt +++ b/src/commonMain/kotlin/de/kif/common/DateFormat.kt @@ -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" diff --git a/src/jsMain/kotlin/de/kif/frontend/views/board/BoardSchedule.kt b/src/jsMain/kotlin/de/kif/frontend/views/board/BoardSchedule.kt index 97d391c..2aa4f80 100644 --- a/src/jsMain/kotlin/de/kif/frontend/views/board/BoardSchedule.kt +++ b/src/jsMain/kotlin/de/kif/frontend/views/board/BoardSchedule.kt @@ -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) "---" diff --git a/src/jsMain/resources/style/components/_board.scss b/src/jsMain/resources/style/components/_board.scss index 5eb0b3f..cfea071 100644 --- a/src/jsMain/resources/style/components/_board.scss +++ b/src/jsMain/resources/style/components/_board.scss @@ -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 { diff --git a/src/jvmMain/kotlin/de/kif/backend/route/Board.kt b/src/jvmMain/kotlin/de/kif/backend/route/Board.kt index 050565d..86d7bc3 100644 --- a/src/jvmMain/kotlin/de/kif/backend/route/Board.kt +++ b/src/jvmMain/kotlin/de/kif/backend/route/Board.kt @@ -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)}" } } diff --git a/src/jvmMain/kotlin/de/kif/backend/route/Calendar.kt b/src/jvmMain/kotlin/de/kif/backend/route/Calendar.kt index e4f02de..0098a74 100644 --- a/src/jvmMain/kotlin/de/kif/backend/route/Calendar.kt +++ b/src/jvmMain/kotlin/de/kif/backend/route/Calendar.kt @@ -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 }