Skip to content

Commit

Permalink
Remove leftovers related to horizontal stickiness
Browse files Browse the repository at this point in the history
  • Loading branch information
v6ak committed Oct 22, 2023
1 parent 4f6d6a9 commit 3f479fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
8 changes: 1 addition & 7 deletions client/src/main/scala/com/v6ak/zbdb/App.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ object App {
dom.console.log("startTime", startTime.toString)
dom.console.log("endTime", endTime.toString)
dom.console.log("fileName", fileName)
val params = dom.window.location.search.drop(1).split("&").map{paramString =>
paramString.split("=", 2) match {
case Array(name, value) => (name, value)
case Array(name) => (name, "")
}
}.toMap
val resultsFuture = dom.fetch(fileName).flatMap(_.text())
val allYearsLinksFuture = dom.fetch("../../statistiky/years.json").flatMap(_.json()).map{ ay =>
Some(ay.asInstanceOf[js.Dictionary[String]].toIndexedSeq.sorted)
Expand All @@ -61,7 +55,7 @@ object App {
val year = body.getAttribute("data-year")
allYearsLinksFuture onComplete {
case Success(yearLinksOption) =>
Renderer.initialize(participantTable, errors, content, plots, params.contains("horizontalStickyness"), year, yearLinksOption)
Renderer.initialize(participantTable, errors, content, plots, year, yearLinksOption)
case Failure(exception) =>
exception.printStackTrace()
dom.window.alert("Jste svědkem/svědkyní chyby, která neměla nastat!")
Expand Down
20 changes: 17 additions & 3 deletions client/src/main/scala/com/v6ak/zbdb/Renderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,28 @@ object Renderer{

private val FirstBadge = div(cls := "badge bg-success first-badge")("1.")

def initialize(participantTable: ParticipantTable, processingErrors: Seq[(Seq[String], Throwable)], content: Node, plots: Seq[(String, String)], enableHorizontalStickyness: Boolean, year: String, yearLinksOption: Option[Seq[(String, String)]]) = {
val r = new Renderer(participantTable, processingErrors, content, plots, enableHorizontalStickyness, year, yearLinksOption)
def initialize(
participantTable: ParticipantTable,
processingErrors: Seq[(Seq[String], Throwable)],
content: Node,
plots: Seq[(String, String)],
year: String,
yearLinksOption: Option[Seq[(String, String)]],
): Renderer = {
val r = new Renderer(participantTable, processingErrors, content, plots, year, yearLinksOption)
r.initialize()
r
}
}

final class Renderer private(participantTable: ParticipantTable, processingErrors: Seq[(Seq[String], Throwable)], content: Node, additionalPlots: Seq[(String, String)], enableHorizontalStickyness: Boolean, year: String, yearLinksOption: Option[Seq[(String, String)]]) {
final class Renderer private(
participantTable: ParticipantTable,
processingErrors: Seq[(Seq[String], Throwable)],
content: Node,
additionalPlots: Seq[(String, String)],
year: String,
yearLinksOption: Option[Seq[(String, String)]],
) {

private val plotRenderer = new PlotRenderer(participantTable)
private val timeLineRenderer = new TimeLineRenderer(participantTable, plotRenderer)
Expand Down

0 comments on commit 3f479fd

Please sign in to comment.