From 5c4c05f2e98f58cf92d4d4d63ac20333bcdd51c1 Mon Sep 17 00:00:00 2001 From: Gianluca Aguzzi Date: Fri, 9 Feb 2024 12:07:20 +0100 Subject: [PATCH] fix: remove simple bar cuz it breaks the loading --- .../scafi/js/facade/simplebar/SimpleBar.scala | 52 ------------------- .../scafi/js/view/dynamic/CarouselModal.scala | 2 - .../view/dynamic/ConfigurationSection.scala | 5 +- .../scafi/js/view/dynamic/ErrorModal.scala | 4 -- 4 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 frontend/src/main/scala/it/unibo/scafi/js/facade/simplebar/SimpleBar.scala diff --git a/frontend/src/main/scala/it/unibo/scafi/js/facade/simplebar/SimpleBar.scala b/frontend/src/main/scala/it/unibo/scafi/js/facade/simplebar/SimpleBar.scala deleted file mode 100644 index 797dd786..00000000 --- a/frontend/src/main/scala/it/unibo/scafi/js/facade/simplebar/SimpleBar.scala +++ /dev/null @@ -1,52 +0,0 @@ -package it.unibo.scafi.js.facade.simplebar - -import it.unibo.scafi.js.CleanableObject -import org.scalajs.dom - -import scala.scalajs.js -import scala.scalajs.js.annotation.{JSImport, JSName} - -@js.native -@JSImport("simplebar", JSImport.Default) -class SimpleBar(element: dom.Element, config: SimpleBarConfig = new SimpleBarConfig()) extends js.Object { - def recalculate(): Unit = js.native - def unMount(): Unit = js.native -} -import it.unibo.scafi.js.facade.simplebar.SimpleBarConfig._ -class SimpleBarConfig( - val autoHide: Boolean = false, - val scrollbarMinSize: Int = 25, - val scrollbarMaxSize: Int = 0, - val classNames: BarClassName = new BarClassName(), - forceVisible: Visible = Hide, - direction: Direction = RightToLeft, - val timeout: Int = 1000, - val clickOnTrack: Boolean = true -) extends CleanableObject { - @JSName("forceVisible") val jsVisible = forceVisible.value - @JSName("direction") val jsDirection = direction.value -} - -object SimpleBarConfig { - sealed abstract class Direction(val value: String) - object RightToLeft extends Direction("rtl") - object LeftToRight extends Direction("ltr") - - sealed abstract class Visible(val value: Any) - object ForceX extends Visible("x") - object ForceY extends Visible("y") - object IsVisible extends Visible(true) - object Hide extends Visible(false) - -} - -class BarClassName( - content: String = "simplebar-content", - scrollContent: String = "simplebar-scroll-content", - scrollbar: String = "simplebar-scrollbar", - track: String = "simplebar-track" -) extends CleanableObject - -object SimpleBar { - def wrap(content: dom.Element): SimpleBar = new SimpleBar(content) -} diff --git a/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/CarouselModal.scala b/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/CarouselModal.scala index af6e2a62..32a576c3 100644 --- a/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/CarouselModal.scala +++ b/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/CarouselModal.scala @@ -1,6 +1,5 @@ package it.unibo.scafi.js.view.dynamic -import it.unibo.scafi.js.facade.simplebar.SimpleBar import it.unibo.scafi.js.utils.Tree import it.unibo.scafi.js.view.HtmlRenderable import it.unibo.scafi.js.view.dynamic.CarouselModal._ @@ -65,7 +64,6 @@ case class CarouselModal(carousel: CarouselContent, minBound: Double, innerHeigh override lazy val html: Element = innerModal.html innerModal.onClose = () => this.onClose() - SimpleBar.wrap(carouselInner) override def body: Seq[Element] = innerModal.body diff --git a/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ConfigurationSection.scala b/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ConfigurationSection.scala index 3622a318..9f11182e 100644 --- a/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ConfigurationSection.scala +++ b/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ConfigurationSection.scala @@ -3,16 +3,13 @@ package it.unibo.scafi.js.view.dynamic import it.unibo.scafi.js.controller.AggregateSystemSupport import it.unibo.scafi.js.controller.local.DeviceConfiguration.DeviceKind import it.unibo.scafi.js.controller.local._ -import it.unibo.scafi.js.facade.simplebar.SimpleBar import it.unibo.scafi.js.model.MatrixLed import it.unibo.scafi.js.model.MatrixLed.MatrixMap -import it.unibo.scafi.js.utils.GlobalStore import it.unibo.scafi.js.view.dynamic.ConfigurationSection._ import it.unibo.scafi.js.view.static.RootStyle.smallPrimaryBtnClass import org.scalajs.dom.html.{Button, Div, Select} import org.scalajs.dom.raw.MouseEvent import scalatags.JsDom.all._ -import upickle.default._ import scala.scalajs.js import scala.util.{Failure, Success, Try} @@ -47,7 +44,7 @@ class ConfigurationSection(configuration: Div, support: AggregateSystemSupport[_ selectMode.onchange = _ => init(getModeFromSelect(selectMode)) loadButton.onclick = _ => load(getModeFromSelect(selectMode)) configuration.appendChild(container) - SimpleBar.wrap(configuration) + container.style = "height: 90%; overflow-x: scroll" sensors.foreach(sensor => sensor.closeButton.onclick = onRemoveSensor(sensor)) diff --git a/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ErrorModal.scala b/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ErrorModal.scala index aceed66c..725dd79e 100644 --- a/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ErrorModal.scala +++ b/frontend/src/main/scala/it/unibo/scafi/js/view/dynamic/ErrorModal.scala @@ -1,23 +1,19 @@ package it.unibo.scafi.js.view.dynamic -import it.unibo.scafi.js.facade.simplebar.SimpleBar import org.scalajs.dom.html.Element import scalatags.JsDom.all._ object ErrorModal extends Modal { private val text = pre(cls := "overflow-auto text-light", style := "max-height : 50vh").render // init the page - private var bar: SimpleBar = null override val title: Element = h4(cls := "modal-tile", "Error!").render override val body: Seq[Element] = Seq(text) override val footer: Seq[Element] = Seq.empty override def minBound: Double = 0 def showError(error: String): Unit = { text.innerHTML = error - bar = SimpleBar.wrap(text) // with hide, the simple bar has some problem... with rewrapping it seems to work this.toggle() } this.appendOnRoot() // put in the page.. onClose = () => { - bar.unMount() this.hide() } }