Skip to content

Instantly share code, notes, and snippets.

@natew
Last active August 29, 2015 14:18
Show Gist options
  • Save natew/9ed2fdedbe70fe8f7280 to your computer and use it in GitHub Desktop.
Save natew/9ed2fdedbe70fe8f7280 to your computer and use it in GitHub Desktop.
/* WEBPACK VAR INJECTION */(function(module) {/* REACT HOT LOADER */ if (true) { (function () { var ReactHotAPI = __webpack_require__(233), RootInstanceProvider = __webpack_require__(230), ReactMount = __webpack_require__(7), React = __webpack_require__(2); module.makeHot = module.hot.data ? module.hot.data.makeHot : ReactHotAPI(function () { return RootInstanceProvider.getRootInstances(ReactMount); }, React); })(); } (function () {
'use strict';
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (descriptor.value) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior = __webpack_require__(84);
var _Logo = __webpack_require__(129);
var Logo = _interopRequire(_Logo);
var _Navigation = __webpack_require__(131);
var Navigation = _interopRequire(_Navigation);
var _TasksList = __webpack_require__(133);
var TasksList = _interopRequire(_TasksList);
var _Profile = __webpack_require__(121);
var Profile = _interopRequire(_Profile);
var _Intro = __webpack_require__(119);
var Intro = _interopRequire(_Intro);
var _Bg = __webpack_require__(128);
var Bg = _interopRequire(_Bg);
var _AddButton = __webpack_require__(127);
var AddButton = _interopRequire(_AddButton);
var _default = (function (_React$Page) {
var _class = function _default(props) {
_classCallCheck(this, _class);
_get(Object.getPrototypeOf(_class.prototype), 'constructor', this).call(this, props);
this.state = {
behavior: _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.NestedViewListBehavior,
tab: 'active'
};
};
_inherits(_class, _React$Page);
_createClass(_class, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.tasksListen(this.props);
if (this.context.router.getCurrentPathname().match(/create/)) this.setState({ behavior: _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.DrawerViewListBehavior });
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
this.tasksListen(nextProps);
}
}, {
key: 'tasksListen',
value: function tasksListen(props) {
if (this.state.isListening) {
return;
}if (props.user.get('completedIntro')) {
this.context.actions.tasksListen();
this.setState({ isListening: true });
}
}
}, {
key: 'handleAdd',
value: function handleAdd() {
this.setState({
behavior: _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.DrawerViewListBehavior
});
this.context.router.transitionTo('/tasks/create');
}
}, {
key: 'handleView',
value: function handleView(id) {
this.setState({
behavior: _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.NestedViewListBehavior
});
this.context.router.transitionTo('/tasks/' + id);
}
}, {
key: 'render',
value: function render() {
var _this = this;
var tab = this.state.tab;
var _props = this.props;
var tasksActive = _props.tasksActive;
var tasksCompleted = _props.tasksCompleted;
var tasksLastMessage = _props.tasksLastMessage;
var user = _props.user;
var tasks = tab === 'active' ? tasksActive : tasksCompleted;
var id = this.context.router.getCurrentParams().id;
var Child = this.childRouteHandler({ id: id });
var completedIntro = user.get('completedIntro');
var afterView = _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(
'div',
null,
_React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(Navigation, {
tab: tab,
onChange: function (tab) {
return _this.setState({ tab: tab });
}
}),
_React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(AddButton, { handleAdd: this.handleAdd }),
!completedIntro && _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(Bg, null)
);
return _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(
_React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.ViewList,
_extends({}, this.state.behavior, this.routedViewListProps()),
_React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(
_React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.View,
{
plain: true,
title: _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(Logo, null),
styles: styles.view,
after: afterView,
offsetBottom: 49,
titleBarProps: {
height: 52,
midWidth: 85
} },
!completedIntro && _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(Intro, null),
completedIntro && tab.match(/active|completed/) && _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(TasksList, {
tab: tab,
tasks: tasks,
lastMessages: tasksLastMessage,
handleView: this.handleView
}),
tab === 'profile' && _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(Profile, null)
),
Child && _React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.createElement(
_React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.Store,
{ fetch: { task: ['tasks', id], messages: ['messages', id] } },
Child
)
);
}
}]);
return _class;
})(_React$Store$ViewList$View$DrawerViewListBehavior$NestedViewListBehavior.React.Page);
module.exports = _default;
var styles = {
view: {
inner: {
background: 'transparent'
}
}
};
/* REACT HOT LOADER */ })(); if (true) { (function () { module.hot.dispose(function (data) { data.makeHot = module.makeHot; }); if (module.exports && module.makeHot) { var makeExportsHot = __webpack_require__(231), foundReactClasses = false; if (makeExportsHot(module, __webpack_require__(2))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "Tasks.jsx" + ": " + err.message); } }); } } })(); }
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(184)(module)))
/*****************
** WEBPACK FOOTER
** ./app/components/Tasks.jsx
** module id = 123
** module chunks = 0
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment