var DomainStore = require('./stores').Domains; var React = require('react'); var ReactMiniRouter = require('react-mini-router'); var DomainList = require('./ui/DomainList'); var RecordList = require('./ui/RecordList'); var Settings = require('./ui/Settings'); var Details = require('./ui/Details'); var App = React.createClass({ mixins: [ReactMiniRouter.RouterMixin], routes: { '/': 'home', '/:domain': 'domain', '/:domain/:tab': 'tab' }, render: function() { return this.renderCurrentRoute(); }, main: function(domain, tab) { var title; var content = []; if(domain) { title = domain; content.push( ); var store = DomainStore.find(domain); if(store) { if(tab == 'settings') { DomainStore.loadSettings(domain); content.push(); } else if (tab == 'details') { content.push(
); } else { DomainStore.loadRecords(domain); content.push(); } } } else { title = "CloudFlare WebUI"; content.push(

Select a domain from the sidebar

); } return (

{title}

{content}
); }, home: function() { return this.main(); }, domain: function(domain) { return this.main(domain); }, tab: function(domain, tab) { return this.main(domain, tab); } }); module.exports = App;