package de.kif.frontend

import de.kif.frontend.views.board.initBoard
import de.kif.frontend.views.calendar.initCalendar
import de.kif.frontend.views.table.initTableLayout
import de.kif.frontend.views.initWorkGroupConstraints
import de.kif.frontend.views.overview.initOverviewMain
import de.kif.frontend.views.overview.initPostEdit
import de.kif.frontend.views.overview.initPosts
import de.westermann.kwebview.components.init
import kotlin.browser.document

fun main() = init {
    WebSocketClient()

    if (document.getElementsByClassName("calendar").length > 0) {
        initCalendar()
    }
    if (document.getElementsByClassName("table-layout").length > 0) {
        initTableLayout()
    }
    if (document.getElementsByClassName("work-group-constraints").length > 0) {
        initWorkGroupConstraints()
    }
    if (document.getElementsByClassName("overview-main").length > 0) {
        initOverviewMain()
    }
    if (document.getElementsByClassName("post").length > 0) {
        initPosts()
    }
    if (document.getElementsByClassName("post-edit-right").length > 0) {
        initPostEdit()
    }
    if (document.getElementsByClassName("board").length > 0) {
        initBoard()
    }
}
