Skip to content

Commit

Permalink
Display version info in right most panel
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrikandersen committed Jan 14, 2025
1 parent 35bd3e8 commit 784a135
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
33 changes: 33 additions & 0 deletions playground/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
application
kotlin("jvm")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.palantir.git-version") version "3.0.0"
}

application {
Expand Down Expand Up @@ -55,3 +56,35 @@ tasks.named("shadowJar") {
dependsOn(":shadowJar")
}

val gitVersion: groovy.lang.Closure<*> by extra
version = gitVersion.call()

val generatedDir = layout.buildDirectory.dir("generated/version")

tasks.register("generateVersionFile") {
val versionCode = gitVersion.call().toString()
val outputDir = generatedDir.get().asFile
inputs.property("gitVersion", versionCode)
outputs.dir(outputDir)
doLast {
val file = outputDir.resolve("Version.kt")
file.parentFile.mkdirs()
file.writeText(
"""
object Version {
const val GIT_VERSION = "$versionCode"
}
""".trimIndent()
)
}
}

sourceSets {
main {
java.srcDir(generatedDir)
}
}

tasks.named("compileKotlin") {
dependsOn("generateVersionFile")
}
28 changes: 18 additions & 10 deletions playground/src/main/kotlin/PlaygroundApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import io.ktor.server.routing.get
import io.ktor.server.routing.post
import io.ktor.server.routing.routing
import kotlinx.html.a
import kotlinx.html.classes
import kotlinx.html.div
import kotlinx.html.h3
import kotlinx.html.p
Expand Down Expand Up @@ -73,17 +74,24 @@ fun main() {
},
// third column
{
h3 {
style = "margin-top: 0;"
+"Happy with what you see?"
}
p {
+"Embed Fabrikt in your project and start generating code from OpenAPI specs today!"
}
p {
a(href = "https://github.com/cjbooms/fabrikt", target = "_blank") {
+"Fabrikt on GitHub"
classes = classes + "flex flex-column justify-between"
div {
h3 {
style = "margin-top: 0;"
+"Happy with what you see?"
}
p {
+"Embed Fabrikt in your project and start generating code from OpenAPI specs today!"
}
p {
a(href = "https://github.com/cjbooms/fabrikt", target = "_blank") {
+"Fabrikt on GitHub"
}
}
}
div {
style = "color: #999;"
+"Fabrikt version: ${Version.GIT_VERSION}"
}
}
)
Expand Down
3 changes: 2 additions & 1 deletion playground/src/main/kotlin/views/layout/ColumnPanel.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package views.layout

import kotlinx.html.DIV
import kotlinx.html.FlowContent
import kotlinx.html.div
import kotlinx.html.style

fun FlowContent.columnPanel(flexSizes: List<Double> = listOf(), vararg content: FlowContent.() -> Unit) {
fun FlowContent.columnPanel(flexSizes: List<Double> = listOf(), vararg content: DIV.() -> Unit) {
div {
style = "display: flex; flex-direction: row; height: 100vh; overflow: hidden; position: fixed; width: 100%;"
content.forEachIndexed { index, it ->
Expand Down

0 comments on commit 784a135

Please sign in to comment.