You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
package outwatchapp
|
|
|
|
import cats.effect.ExitCode
|
|
import monix.bio._
|
|
import org.scalajs.dom.raw.Element
|
|
import sttp.client.impl.monix.FetchMonixBackend
|
|
import org.scalajs.dom.document
|
|
import scala.scalajs.js.annotation.JSImport
|
|
import scalajs.js
|
|
import outwatch.router.AppRouter
|
|
|
|
@JSImport("bootstrap/dist/css/bootstrap.min.css", JSImport.Namespace)
|
|
@js.native
|
|
object BootstrapBundleCss extends js.Object
|
|
@JSImport("bootstrap", JSImport.Namespace)
|
|
@js.native
|
|
object BootstrapBundleJs extends js.Object
|
|
|
|
@JSImport(
|
|
"blk-design-system/assets/css/blk-design-system.min.css",
|
|
JSImport.Namespace
|
|
)
|
|
@js.native
|
|
object BlkDesignSys extends js.Object
|
|
|
|
object OutwatchApp extends BIOApp {
|
|
|
|
def app(el: Element, router: AppRouter[Task, Page]) = for {
|
|
store <- router.store
|
|
backend = FetchMonixBackend()
|
|
} yield new MainApp(el)(backend, store)
|
|
|
|
def run(args: List[String]): UIO[ExitCode] = {
|
|
BootstrapBundleCss
|
|
BootstrapBundleJs
|
|
BlkDesignSys
|
|
val el = document.createElement("div")
|
|
el.setAttribute("id", "#app")
|
|
document.body.appendChild(el)
|
|
|
|
val router = Router.router
|
|
|
|
app(el, router)
|
|
.flatMap(_.run)
|
|
.onErrorHandle(ex => UIO(ex.printStackTrace()))
|
|
.as(ExitCode.Success)
|
|
}
|
|
}
|