urbit/web/mark-dashboard/main.js

30 lines
852 B
JavaScript
Raw Normal View History

2016-11-17 02:05:24 +03:00
TreeActions = window.tree.actions
d = React.DOM
2016-11-17 02:05:24 +03:00
TreeActions.registerComponent("mark-dashboard", React.createClass({
render: function(){
return d.ul({},
!this.state.data ? "loading..." :
2017-02-14 01:58:55 +03:00
_(this.state.data)
.map(function(result,mark){return {result:result, mark:mark}})
.sortBy('mark')
.map(function(x){
return d.li({key:x.mark},"%"+x.mark, " ",
(!/\n/.test(x.result) ? d.code({},x.result) : d.pre({},d.code({},x.result)))
)})
.value()
)},
2016-11-17 02:05:24 +03:00
getInitialState: function(){ return {data:null}},
componentDidMount: function(){
$this = this
2016-11-17 02:05:24 +03:00
urb.bind("/scry/x/main",
{appl:"mark-dashboard"},
function(err, dat){
urb.drop("/scry/x/main", {appl:"mark-dashboard"})
$this.setState({data:dat.data})
}
)
}
}))