mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-01-27 15:14:30 +00:00
92 lines
2.3 KiB
JavaScript
92 lines
2.3 KiB
JavaScript
|
var Router = require('react-router')
|
||
|
, RouteHandler = Router.RouteHandler
|
||
|
, Route = Router.Route;
|
||
|
|
||
|
var ReactBootstrap = require('react-bootstrap')
|
||
|
, Nav = ReactBootstrap.Nav
|
||
|
, ListGroup = ReactBootstrap.ListGroup;
|
||
|
|
||
|
var ReactRouterBootstrap = require('react-router-bootstrap')
|
||
|
, NavItemLink = ReactRouterBootstrap.NavItemLink
|
||
|
, ButtonLink = ReactRouterBootstrap.ButtonLink
|
||
|
, ListGroupItemLink = ReactRouterBootstrap.ListGroupItemLink;
|
||
|
|
||
|
module.exports = App = React.createClass({displayName: "App",
|
||
|
render: function() {
|
||
|
return (
|
||
|
React.createElement("div", null,
|
||
|
"NavItemLink", React.createElement("br", null),
|
||
|
React.createElement(Nav, null,
|
||
|
React.createElement(NavItemLink, {
|
||
|
to: "timeline",
|
||
|
params: { timelineUser: 'tschaul'}},
|
||
|
"Linky!"
|
||
|
)
|
||
|
),
|
||
|
React.createElement("br", null),
|
||
|
"ButtonLink", React.createElement("br", null),
|
||
|
React.createElement(ButtonLink, {
|
||
|
to: "destination",
|
||
|
params: { someparam: 'hello'}},
|
||
|
"Linky!"
|
||
|
),
|
||
|
React.createElement("br", null),
|
||
|
React.createElement(ListGroup, null,
|
||
|
React.createElement(ListGroupItemLink, {
|
||
|
to: "destination",
|
||
|
params: { someparam: 'hello'}},
|
||
|
"Linky!"
|
||
|
)
|
||
|
),
|
||
|
React.createElement(RouteHandler, {pollInterval: "60000"})
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
var routes = (
|
||
|
React.createElement(Route, {handler: App, path: "/"},
|
||
|
React.createElement(Route, {name: "timeline", path: "timeline/:timelineUser", handler: Timeline})
|
||
|
)
|
||
|
);
|
||
|
|
||
|
|
||
|
var intitializeApp = function(res){
|
||
|
|
||
|
Router.run(routes, function (Handler) {
|
||
|
React.render(React.createElement(Handler, null), document.body);
|
||
|
});
|
||
|
|
||
|
};
|
||
|
|
||
|
///////// LOAD TWISTER FROM CACHE AND INITIALIZE
|
||
|
|
||
|
Twister.init({
|
||
|
host: 'http://user:pwd@localhost:28332',
|
||
|
errorfunc: function(error){console.log(this,error)}
|
||
|
});
|
||
|
|
||
|
|
||
|
/*
|
||
|
var saveCache = function () {
|
||
|
|
||
|
localStorage.setItem("twister-cache", JSON.stringify(Twister.serializeCache()));
|
||
|
|
||
|
};
|
||
|
|
||
|
var loadCache = function () {
|
||
|
|
||
|
Twister.deserializeCache(JSON.parse(localStorage.getItem("twister-cache")));
|
||
|
|
||
|
};
|
||
|
|
||
|
var clearCache = function () {
|
||
|
|
||
|
localStorage.setItem("twister-cache", null);
|
||
|
|
||
|
};
|
||
|
*/
|
||
|
//loadCache();
|
||
|
|
||
|
Twister.loadServerAccounts(initializeApp);
|