diff --git a/packages/base-components/lib/common/Flash.jsx b/packages/base-components/lib/common/Flash.jsx
index 05db2c736..45d345a0b 100644
--- a/packages/base-components/lib/common/Flash.jsx
+++ b/packages/base-components/lib/common/Flash.jsx
@@ -1,11 +1,14 @@
+import React, { PropTypes, Component } from 'react';
+
import Core from "meteor/nova:core";
+
const Messages = Core.Messages;
-const Flash = React.createClass({
+class Flash extends Component{
componentDidMount() {
Messages.markAsSeen(this.props.message._id);
- },
+ }
render() {
return (
@@ -14,6 +17,6 @@ const Flash = React.createClass({
)
}
-});
+}
module.exports = Flash;
\ No newline at end of file
diff --git a/packages/base-components/lib/common/Header.jsx b/packages/base-components/lib/common/Header.jsx
index f70294061..c91739b96 100644
--- a/packages/base-components/lib/common/Header.jsx
+++ b/packages/base-components/lib/common/Header.jsx
@@ -1,7 +1,7 @@
import NoSSR from 'react-no-ssr';
-const Header = props => {
+const Header = ({currentUser}) => {
({Logo, ListContainer, CategoriesList, FlashContainer, ModalButton, NewDocContainer, CanCreatePost} = Telescope.components);
@@ -21,9 +21,9 @@ const Header = props => {
Please log in.
; - } else if (Users.can.post(this.props.user)) { - return this.props.children; - } else { - returnSorry, you do not have permissions to post at this time
; - } +const CanCreatePost = ({user, children}) => { + if (!user){ + returnPlease log in.
; + } else if (Users.can.post(user)) { + return children; + } else { + returnSorry, you do not have permissions to post at this time
; } +}; -}); +CanCreatePost.propTypes = { + user: React.PropTypes.object +} module.exports = CanCreatePost; \ No newline at end of file diff --git a/packages/base-components/lib/permissions/CanEditPost.jsx b/packages/base-components/lib/permissions/CanEditPost.jsx index bd462fe4d..6283a1513 100644 --- a/packages/base-components/lib/permissions/CanEditPost.jsx +++ b/packages/base-components/lib/permissions/CanEditPost.jsx @@ -1,20 +1,16 @@ -const CanEditPost = React.createClass({ - - propTypes: { - user: React.PropTypes.object, - post: React.PropTypes.object - }, - - render() { - if (Users.can.edit(this.props.user, this.props.post)) { - return this.props.children; - } else if (!this.props.user){ - returnPlease log in.
; - } else { - returnSorry, you do not have permissions to edit this post at this time
; - } +const CanEditPost = ({user, post, children}) => { + if (Users.can.edit(user, post)) { + return children; + } else if (!user){ + returnPlease log in.
; + } else { + returnSorry, you do not have permissions to edit this post at this time
; } +}; -}); +CanEditPost.propTypes = { + user: React.PropTypes.object, + post: React.PropTypes.object +} module.exports = CanEditPost; \ No newline at end of file diff --git a/packages/base-components/lib/permissions/CanEditUser.jsx b/packages/base-components/lib/permissions/CanEditUser.jsx index 1da303871..10deb7286 100644 --- a/packages/base-components/lib/permissions/CanEditUser.jsx +++ b/packages/base-components/lib/permissions/CanEditUser.jsx @@ -1,20 +1,16 @@ -const CanEditUser = React.createClass({ - - propTypes: { - user: React.PropTypes.object, - userToEdit: React.PropTypes.object - }, - - render() { - if (!this.props.user){ - returnPlease log in.
; - } else if (Users.can.edit(this.props.user, this.props.userToEdit)) { - return this.props.children; - } else { - returnSorry, you do not have permissions to edit this user at this time
; - } +const CanEditUser = ({user, userToEdit, children}) => { + if (!user){ + returnPlease log in.
; + } else if (Users.can.edit(user, userToEdit)) { + return children; + } else { + returnSorry, you do not have permissions to edit this user at this time
; } +}; -}); +CanEditUser.propTypes = { + user: React.PropTypes.object, + userToEdit: React.PropTypes.object +} module.exports = CanEditUser; \ No newline at end of file diff --git a/packages/base-components/lib/permissions/CanView.jsx b/packages/base-components/lib/permissions/CanView.jsx index 8d63a591e..d0d8d40fd 100644 --- a/packages/base-components/lib/permissions/CanView.jsx +++ b/packages/base-components/lib/permissions/CanView.jsx @@ -1,19 +1,15 @@ -const CanView = React.createClass({ - - propTypes: { - user: React.PropTypes.object - }, - - render() { - if (Users.can.view(this.props.user)) { - return this.props.children; - } else if (!this.props.user){ - returnPlease log in.
; - } else { - returnSorry, you do not have permissions to post at this time
; - } +const CanView = ({user, children}) => { + if (Users.can.view(user)) { + return children; + } else if (!user){ + returnPlease log in.
; + } else { + returnSorry, you do not have permissions to post at this time
; } +}; -}); +CanView.propTypes = { + user: React.PropTypes.object +} module.exports = CanView; \ No newline at end of file diff --git a/packages/base-components/lib/permissions/CanViewPost.jsx b/packages/base-components/lib/permissions/CanViewPost.jsx index 6fd72457d..acb9c2c92 100644 --- a/packages/base-components/lib/permissions/CanViewPost.jsx +++ b/packages/base-components/lib/permissions/CanViewPost.jsx @@ -1,20 +1,16 @@ -const CanViewPost = React.createClass({ - - propTypes: { - user: React.PropTypes.object, - post: React.PropTypes.object - }, - - render() { - if (Users.can.viewPost(this.props.user, this.props.document)) { - return this.props.children; - } else if (!this.props.user){ - returnPlease log in.
; - } else { - returnSorry, you do not have permissions to post at this time
; - } +const CanViewPost = ({user, post, children}) => { + if (Users.can.viewPost(this.props.user, this.props.document)) { + return this.props.children; + } else if (!this.props.user){ + returnPlease log in.
; + } else { + returnSorry, you do not have permissions to post at this time
; } +}; -}); +CanViewPost.propTypes = { + user: React.PropTypes.object, + post: React.PropTypes.object +} module.exports = CanViewPost; \ No newline at end of file diff --git a/packages/base-components/lib/posts/Post.jsx b/packages/base-components/lib/posts/Post.jsx index 78f30f643..1959fdd84 100644 --- a/packages/base-components/lib/posts/Post.jsx +++ b/packages/base-components/lib/posts/Post.jsx @@ -1,8 +1,8 @@ -const Post = (props) => { +const Post = ({document}) => { ({ListContainer, CommentList, CommentNew, PostCategories, SocialShare} = Telescope.components); - const post = props.document; + const post = document; const htmlBody = {__html: post.htmlBody}; return ( diff --git a/packages/base-components/lib/posts/list/PostCategories.jsx b/packages/base-components/lib/posts/list/PostCategories.jsx index d81a316be..0be56ef99 100644 --- a/packages/base-components/lib/posts/list/PostCategories.jsx +++ b/packages/base-components/lib/posts/list/PostCategories.jsx @@ -1,9 +1,9 @@ -const PostCategories = props => { +const PostCategories = ({categories}) => { return (Profile for {Users.getDisplayName(user)}
+ ) +} - render() { - - const user = this.props.document; - - return ( -Profile for {Users.getDisplayName(user)}
- ) - } -}); +UsersSingle.propTypes = { + document: React.PropTypes.object.isRequired, + currentUser: React.PropTypes.object.isRequired +} module.exports = UsersSingle; \ No newline at end of file diff --git a/packages/nova-core/lib/components/ModalButton.jsx b/packages/nova-core/lib/components/ModalButton.jsx index 22a124762..3075fe48d 100644 --- a/packages/nova-core/lib/components/ModalButton.jsx +++ b/packages/nova-core/lib/components/ModalButton.jsx @@ -1,3 +1,5 @@ +import React, { PropTypes, Component } from 'react'; + import Modal from 'react-modal'; const customStyles = { @@ -11,29 +13,29 @@ const customStyles = { } }; -const ModalButton = React.createClass({ +class ModalButton extends Component { - propTypes: { - label: React.PropTypes.string.isRequired, - className: React.PropTypes.string - }, + constructor() { + super(); + this.openModal = this.openModal.bind(this); + this.closeModal = this.closeModal.bind(this); + this.state = { + modalIsOpen: false + }; + } - getInitialState: function() { - return { modalIsOpen: false }; - }, - - openModal: function(event) { + openModal(event) { event.preventDefault(); this.setState({modalIsOpen: true}); - }, + } - closeModal: function() { + closeModal(event) { + event.preventDefault(); this.setState({modalIsOpen: false}); - }, + } render() { - // ({PostNewContainer} = Telescope.components); const Component = this.props.component; // see http://stackoverflow.com/a/32371612/649299 @@ -69,7 +71,12 @@ const ModalButton = React.createClass({