How can I use Material UI in Scala JS? - material-ui

My team works with Scala.js and I wanna use Material-UI. But those two's code types look very different. Most of the examples in Material-UI seem to be based on regular Javascript.
I've tried to search about that, but the information is very limited, so I couldn't get any useful information. Is there anyone using Material-UI with Scala.js?

When using most JS libraries from Scala.js, you need what is called a "facade" -- a strongly-typed Scala wrapper that describes how to use the weakly-typed JavaScript library.
There appear to be several Material UI facades, but most of them look a bit half-baked. I'd guess that the most mature is the one in Chandu's scalajs-react-components project -- in general, Chandu has done more with React in Scala.js than most folks. The general top-level page for the project can be found here.

Related

Playframework twirl (scala templates) guides

Good day all
note: Play! Framework newbie here.
I am trying to familairze myself using scala templates for a project, but cannot quite seem to get it right, nor do the examples found online always work correctly.
Problem:
I have to have searched for small solutions for a problem, and frequently encounter syntactical errors or the like.
I decided to search for some comprehensive guide to building Scala templates used as views, but found only fragments and pieces of code that may help.
Documentation Provided:
Play Scala Documentation
Play provided examples:
Examples in Java and Scala
Variables:
Declaring variables
Declaring Variable 2
Displaying Data:
Displaying data using functions
Display Items in alternating rows table with indicies
Using blocks
Displaying Block Scala variables in html see the use of { and }
Passing Data / Objects:
Passing objects between views and controllers
Further Reading:
Play Google Groups thread
Question:
note: I am asking this only since I have no idea how to proceed
Is there any comprehensive guide for building Scala templates. Documented to such a degree as one would find for Play! Framework?
TL;DR Where did you learn / discover how to create simple to complex Play! Scala templates?
Here you have pack of examples and Play seed projects:
https://playframework.com/download#examples
You should look for a blogposts about play templates:
http://mariussoutier.com/blog/2012/04/27/play-framework-2-0-templates-part-1-parameters/
You should read play documentation. It isn't perfect, but very helpful.
https://www.playframework.com/documentation/2.6.x/ScalaTemplates
I would say the templates are somehow intuitive. You write html and when you want to do some scala you should start the expression with an #.
When I find myself struggling with the syntax I just google "scala play twirl map" if I want to know the syntax for the .map (twirl is the real name of the template engine)
Besides that, the documentation under https://www.playframework.com/documentation/2.6.x/ScalaTemplates should be the best resource

How to adapt code among view types?

I am trying to use a sap.m.List Control in a application, however, I am struggling to find examples of how to implement this control in a JavaScript View. I am aware that the "Explored" app has code examples to implement the controls in XML views; However, I would like to know how to adapt those examples to HTML, JSON and JavaScript views. What an expert UI5 Developer does when he needs to adapt a control from a XML View to another type of view? Do we have any guidelines? Thanks in advance!
Regarding the guidelines you`ll find at least a quick introduction on js-views in the demokit documentation here.
I created a pretty simple example for the sap.m.List in javascript here although I am aware that it is not part of a view, but it should give you a first impression.
If you are looking for more js examples have a look here. For the older sap.ui.commons controls all samples are created with javascript.

GWT IndexedDB available or any update on this?

is there any update on GWT IndexedDB?
Here are two projects of GWT IndexedDB but i dont know if this is usefull because these two projects seem to be dead?!
http://code.google.com/p/indexeddb-gwt/
http://code.google.com/p/gwt-indexeddb/
IS it possible to use GWT IndexedDB by JSNI? Has anybody experience with it?
Would like to learn and to use IndexedDB but dont know because iam using only GWT and not JavaScript.
Please help!
You can use any pure javascript/browser functaonlity from GWT using JSNI.
If youu look at the above linked Indexdb gwt libraries they do just that. They define JSO Overlay wrappers for the corresponding javascript objects. (see here as an example).
Alternatively you could also look into the Elemental library. I am not 100% sure but it might contain wrappers for IndexDB.
So you have 4 choices:
Manually call the indexdb javascript functons using JSNI.
Write your own wrapper using JSO and JSNI
Use on of the indexdb GWT wrappers
Use Elemental library.
I used java Maps (TreeMap) package to emulate indexedDB searching functions and GWT built-in html5 storage wrapper to store data offline in browser.

Proper designer-first reall world app example in Scala Lift

Trying to learn lift, and i'm looking for a somehow bigger example than HelloWorld (something like spring pet-clinic).
Especially i'm looking at advanced templating in designer friendly manner (as less code in snippets as possible).
I tried to look at example Lift apps https://github.com/lift/examples
But they heavily mix html in their snippets https://github.com/lift/examples/blob/master/nuggets/skittr/src/main/scala/com/skittr/snippet/UserMgt.scala
So can anyone link me to a source of real world app that uses designer-friendly templating?
Hmmm. My hobbie project partially corresponds to what you ask, I think.) https://github.com/vn971/roboCup
It's not all good, I started it when only learning Scala and I see now that it has poor decision choises in some places. But, for example, you can see code-free templates here:
https://github.com/vn971/roboCup/blob/master/src/main/webapp/swiss.html
Ajax bindings can be seen here:
https://github.com/vn971/roboCup/blob/master/src/main/webapp/admin.html
It unfortunately uses html in the code somewhere, too. It's also very little, uses actors (both lift's and akka), has no database at all (only the state of the tournament matters and it's not persisted).
try lift in action book , there is a build of a big web app almost step by step and the project is also on github so you can download it also from there

Is there any Wicket-like web framework to use with Scala (besides lift)?

I want to start a project using the Scala language. While searching for web frameworks I've found Lift. However, it is not what I was looking for: a web framework that has complete separation of HTML and code. Lift does have some nice features (and a learning curve) but we need to have complete separation of HTML and code. I was hoping to find something like Wicket, Tapestry or Barracuda for the Scala language.
Although it is nice to be able to reuse html templates, it is more important to us to have the HTML templates work as a "static application" mockup. In Tapestry we can just put links in the static templates and use that to have static navigation and a sort of prototype of the application.
So, do you know of any other web framework that is easy to work with the Scala language?
Thanks,
Luis
Here it is I can understand why you might want it pure Scala, but you haven't stated that's necessary, and with the techniques defined within the blog post, and there is another blog which also helps, you should be able to get it close enough to what you desire.
Tapestry 5 has many similarities with Wicket and works very well with Scala. I haven't tried it myself, but Francois Armand has being doing it for some time and he's writing about in in his blog.
Try Context. It is a component based framework written in Java but I have used it with Scala without much difficulties.
Context uses XSL as templating language which forces a sharp separation between logical presentation (DOM-tree) and actual presentation (HTML/CSS/JS).
You can even, with little effort, create prototypes and mocked views by faking the DOM-tree and trying invidual components in different combinations.