fun main()

in ruler-frontend/src/jsMain/kotlin/com/spotify/ruler/frontend/Main.kt [29:56]


fun main() {
    require("./style.css")

    // use cdn files
//    require("bootstrap/dist/css/bootstrap.css")
//    require("bootstrap/dist/js/bootstrap.bundle.js")

    // Load and show the favicon
    val favicon = require("./favicon.svg").toString()
    val link = document.createElement("link").apply {
        setAttribute("rel", "icon")
        setAttribute("href", favicon)
    }
    document.head?.append(link)

    // Load and deserialize the report data
    val rawReport = require("report.json").toString()
    val reportData = Json.decodeFromString<AppReport>(rawReport)

    // Visualize and display the report data
    val container =
        web.dom.document.getElementById("root") ?: error("Couldn't find root container!")
    createRoot(container).render(Fragment.create {
        Report {
            report = reportData
        }
    })
}