From 743e57395a2c6f898a72334bcce8831e5d696eae Mon Sep 17 00:00:00 2001 From: Lars Westermann Date: Sat, 8 Jun 2019 19:39:45 +0200 Subject: [PATCH] V2 von Brett her --- .gitignore | 1 - portal.toml | 3 + .../resources/style/components/_board.scss | 79 +++++------ src/jsMain/resources/style/style.scss | 1 + .../kotlin/de/kif/backend/route/Board.kt | 127 +++++++++--------- .../kotlin/de/kif/backend/route/News.kt | 2 +- src/jvmMain/resources/portal.toml | 5 +- 7 files changed, 109 insertions(+), 109 deletions(-) diff --git a/.gitignore b/.gitignore index 9981e28..58d7bc4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ data/ *.swo *.db -twitter.toml diff --git a/portal.toml b/portal.toml index f42a9d4..b8c9109 100644 --- a/portal.toml +++ b/portal.toml @@ -7,3 +7,6 @@ reference = "2019-06-06" [general] wiki_url = "https://wiki.kif.rocks/w/index.php?title=KIF470:Arbeitskreise&action=raw" + +[twitter] +timeline = "https://twitter.com/kiforbiter?ref_src=twsrc%5Etfw" diff --git a/src/jsMain/resources/style/components/_board.scss b/src/jsMain/resources/style/components/_board.scss index bff8f29..786cb30 100644 --- a/src/jsMain/resources/style/components/_board.scss +++ b/src/jsMain/resources/style/components/_board.scss @@ -28,18 +28,15 @@ padding: 0 0.4rem; &:nth-child(1) { - flex-grow: 4; - - padding-left: 0.15rem; - padding-right: 0.15rem; + flex-grow: 5; } &:nth-child(2) { - flex-grow: 3; + flex-grow: 4; } &:nth-child(3) { - flex-grow: 3; + flex-grow: 4; } } } @@ -66,59 +63,53 @@ } .board-schedule-box { - display: flex; - flex-wrap: wrap; + margin-bottom: 0.5rem; + padding: 1rem; + padding-bottom: 0.5rem; + + table { + border-collapse: collapse; + } +} + +.board-card-header { + font-family: 'Montserrat', sans-serif; + font-weight: 600; + line-height: 1.5rem; } .board-schedule { - position: relative; - flex-grow: 1; - flex-basis: 0; - min-width: 15rem; - - padding: 0.6rem; - margin: 0 0.25rem 0.5rem; + line-height: 1.3rem; + height: 2rem; &:not(:last-child) { border-bottom: solid 1px var(--table-border-color) } } -.board-schedule-bottom { - display: block; - padding-left: 1rem; - padding-right: 0.5rem; - line-height: 1rem; - clear: both; +.board-schedule-color { + width: 1.2rem; - & > span { - - &:first-child { - float: left; - } - &:last-child { - float: right; - } + span { + display: block; + background-color: var(--primary-color); + width: 0.8rem; + height: 0.8rem; + border-radius: 100%; + margin-top: 0.1rem; } } -.board-schedule-color { - background-color: var(--primary-color); - position: absolute; - top: 1.25rem; - left: 0.6rem; - width: 0.8rem; - height: 0.8rem; - border-radius: 100%; +.board-schedule-time { + width: 7rem; + color: var(--text-secondary-color) } .board-schedule-name { - display: block; - padding-left: 1rem; - line-height: 1.3rem; +} - font-family: 'Montserrat', sans-serif; - font-weight: 600; - padding-top: 0.35rem; - padding-bottom: 0.35rem; +.board-schedule-room { + width: 4rem; + text-align: right; + color: var(--text-secondary-color) } \ No newline at end of file diff --git a/src/jsMain/resources/style/style.scss b/src/jsMain/resources/style/style.scss index 66b9dbd..6279491 100644 --- a/src/jsMain/resources/style/style.scss +++ b/src/jsMain/resources/style/style.scss @@ -97,6 +97,7 @@ a { display: block; position: relative; padding-left: 2.5rem; + width: 8rem; &::after { content: ''; diff --git a/src/jvmMain/kotlin/de/kif/backend/route/Board.kt b/src/jvmMain/kotlin/de/kif/backend/route/Board.kt index dc9fdad..d43f59a 100644 --- a/src/jvmMain/kotlin/de/kif/backend/route/Board.kt +++ b/src/jvmMain/kotlin/de/kif/backend/route/Board.kt @@ -9,9 +9,7 @@ import io.ktor.routing.Route import io.ktor.routing.get import kotlinx.css.CSSBuilder import kotlinx.css.Color -import kotlinx.html.div -import kotlinx.html.span -import kotlinx.html.unsafe +import kotlinx.html.* import java.util.* fun Route.board() { @@ -26,16 +24,6 @@ fun Route.board() { respondMain(true, true) { theme -> content { - /* - div("board-header") { - div { - +"KIF 47.0" - } - div("board-header-date") { - +formatDateTime(Date().time) - } - } - */ div("board") { div("board-schedules") { attributes["data-reference"] = referenceTime.toString() @@ -44,50 +32,24 @@ fun Route.board() { +"AKs" } - div("board-schedule-box") { + div("board-card board-schedule-box") { + div("board-card-header") { + +"Running" + } + table { for ((schedule, time) in scheduleList) { - div("board-card board-schedule") { - attributes["data-id"] = schedule.id.toString() + createBoardSchedule(schedule, time) + } + } + } - span("board-schedule-color") { - attributes["style"] = CSSBuilder().apply { - val c = schedule.workGroup.track?.color - if (c != null) { - backgroundColor = Color(c.toString()) - } - }.toString() - } - span("board-schedule-name") { - +schedule.workGroup.name - } - - div("board-schedule-bottom") { - span("board-schedule-time") { - attributes["data-time"] = time.toString() - attributes["data-duration"] = schedule.workGroup.length.toString() - - - val startTime = (time % MINUTES_OF_DAY).let { - if (it < 0) it + MINUTES_OF_DAY else it - } - val sm = (startTime % 60).toString().padStart(2, '0') - val sh = (startTime / 60).toString().padStart(2, '0') - val startTimeString = "$sh:$sm" - - val endTime = ((time + schedule.workGroup.length) % MINUTES_OF_DAY).let { - if (it < 0) it + MINUTES_OF_DAY else it - } - val em = (endTime % 60).toString().padStart(2, '0') - val eh = (endTime / 60).toString().padStart(2, '0') - val endTimeString = "$eh:$em" - - +"$startTimeString - $endTimeString" - } - - span("board-schedule-room") { - +schedule.room.name - } - } + div("board-card board-schedule-box") { + div("board-card-header") { + +"Upcoming" + } + table { + for ((schedule, time) in scheduleList) { + createBoardSchedule(schedule, time) } } } @@ -108,8 +70,7 @@ fun Route.board() { } div("board-card") { unsafe { - raw( - """ + raw(""" Tweets by kiforbiter + >Twitter wall - """.trimIndent() - ) + """.trimIndent()) } } } @@ -131,3 +91,50 @@ fun Route.board() { } } } + +private fun TABLE.createBoardSchedule(schedule: Schedule, time: Int) { + tr("board-schedule") { + attributes["data-id"] = schedule.id.toString() + + td("board-schedule-color") { + span { + attributes["style"] = CSSBuilder().apply { + val c = schedule.workGroup.track?.color + if (c != null) { + backgroundColor = Color(c.toString()) + } + }.toString() + } + } + + td("board-schedule-time") { + attributes["data-time"] = time.toString() + attributes["data-duration"] = schedule.workGroup.length.toString() + + + val startTime = (time % MINUTES_OF_DAY).let { + if (it < 0) it + MINUTES_OF_DAY else it + } + val sm = (startTime % 60).toString().padStart(2, '0') + val sh = (startTime / 60).toString().padStart(2, '0') + val startTimeString = "$sh:$sm" + + val endTime = ((time + schedule.workGroup.length) % MINUTES_OF_DAY).let { + if (it < 0) it + MINUTES_OF_DAY else it + } + val em = (endTime % 60).toString().padStart(2, '0') + val eh = (endTime / 60).toString().padStart(2, '0') + val endTimeString = "$eh:$em" + + +"$startTimeString - $endTimeString" + } + + td("board-schedule-name") { + +schedule.workGroup.name + } + + td("board-schedule-room") { + +schedule.room.name + } + } +} diff --git a/src/jvmMain/kotlin/de/kif/backend/route/News.kt b/src/jvmMain/kotlin/de/kif/backend/route/News.kt index a993680..daf4367 100644 --- a/src/jvmMain/kotlin/de/kif/backend/route/News.kt +++ b/src/jvmMain/kotlin/de/kif/backend/route/News.kt @@ -105,7 +105,7 @@ fun Route.overview() { data-cards="hidden" data-lang="de" data-dnt="true" - >Tweets by kiforbiter + >Twitter wall """.trimIndent()) } diff --git a/src/jvmMain/resources/portal.toml b/src/jvmMain/resources/portal.toml index 41a88e8..a970a9d 100644 --- a/src/jvmMain/resources/portal.toml +++ b/src/jvmMain/resources/portal.toml @@ -9,7 +9,7 @@ uploads = "data/uploads" database = "data/portal.db" [schedule] -reference = "2019-03-27" +reference = "1970-01-01" [security] session_name = "SESSION" @@ -20,5 +20,4 @@ allowed_upload_extensions = "png, jpg, jpeg" wiki_url = "" [twitter] -username = "" -password = "" +timeline = ""