Skip to content

Gives TreeLog a GUI, the ScalaJS ReactTreeView

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

oranda/treelog-scalajs

Repository files navigation

TreeLog-ScalaJS

This project brings together two other projects: the excellent TreeLog from Lance and Channing Walton, and the pretty ReactTreeView component from Chandra Sekhar Kode in the scalajs-react-components project.

TreeLog is a way of displaying a program's log in a tree structure instead of the hopelessly verbose sequential format we are usually cursed with. It is based on the Scalaz Writer monad. Although it is oriented towards algorithms with pure functions (like mathematical computations), it can annotate tree nodes with messages for side-effects. Read more about it at typelevel.

ReactTreeView is the UI part: this component supports expanding nodes, highlighting, and other nice features. It existed first as a normal ReactJS component, then was adapted into ScalaJS, meaning you can write your tree in Scala and it will be converted automatically into JavaScript. See the screenshot lower down to see what it looks like.

Implementation

So, two tree projects: a match made in heaven? All TreeLog-ScalaJS really needs to do is transform a scalaz.Tree into a UI TreeItem. The main code is in com.oranda.treelogui. There is some code here and in demo.components that is copied from the scalajs-react-components demo. The code in the treelog package is copied straight from the TreeLog project.

Running

  1. Clone this project (or download and unzip).
  2. In the project's root, from the command-line run sbt fastOptJS. This will do all the Scala compilation and ScalaJS transpilation.
  3. In your browser navigate to the project's index.html on the filesystem. (There is no need to run a server.) You should see:

Running the tests

  1. Download PhantomJS. This can run JavaScript outside a browser.
  2. Make sure the phantomjs executable is in your PATH environment variable.
  3. In this project's root, from the command-line run sbt test.

License

Licensed under

About

Gives TreeLog a GUI, the ScalaJS ReactTreeView

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published