22
33var React = require ( 'react' )
44var ReactFireMixin = require ( 'reactfire' )
5- var Router = require ( 'react-router' )
5+ var { Navigation } = require ( 'react-router' )
66
77var CommentThreadStore = require ( './stores/CommentThreadStore' )
88var HNService = require ( './services/HNService' )
@@ -15,33 +15,31 @@ var CommentMixin = require('./mixins/CommentMixin')
1515var cx = require ( './utils/buildClassName' )
1616var setTitle = require ( './utils/setTitle' )
1717
18- var Navigation = Router . Navigation
19-
2018var PermalinkedComment = React . createClass ( {
2119 mixins : [ CommentMixin , ReactFireMixin , Navigation ] ,
2220
23- getDefaultProps : function ( ) {
21+ getDefaultProps ( ) {
2422 return {
2523 level : 0
2624 }
2725 } ,
2826
29- getInitialState : function ( ) {
27+ getInitialState ( ) {
3028 return {
3129 comment : UpdatesStore . getComment ( this . props . params . id ) || { }
3230 , parent : { type : 'comment' }
3331 , op : { }
3432 }
3533 } ,
3634
37- componentWillMount : function ( ) {
35+ componentWillMount ( ) {
3836 this . bindAsObject ( HNService . itemRef ( this . props . params . id ) , 'comment' )
3937 if ( this . state . comment . id ) {
4038 this . commentLoaded ( this . state . comment )
4139 }
4240 } ,
4341
44- componentWillReceiveProps : function ( nextProps ) {
42+ componentWillReceiveProps ( nextProps ) {
4543 if ( nextProps . params . id != this . props . params . id ) {
4644 var comment = UpdatesStore . getComment ( nextProps . params . id )
4745 if ( comment ) {
@@ -53,7 +51,7 @@ var PermalinkedComment = React.createClass({
5351 }
5452 } ,
5553
56- componentWillUpdate : function ( nextProps , nextState ) {
54+ componentWillUpdate ( nextProps , nextState ) {
5755 if ( this . state . comment . id != nextState . comment . id ) {
5856 if ( ! nextState . comment . deleted ) {
5957 // Redirect to the appropriate route if a Comment "parent" link had a
@@ -69,15 +67,15 @@ var PermalinkedComment = React.createClass({
6967 }
7068 } ,
7169
72- commentLoaded : function ( comment ) {
70+ commentLoaded ( comment ) {
7371 this . setTitle ( comment )
7472 if ( ! comment . deleted ) {
7573 this . threadStore = new CommentThreadStore ( comment , this . handleCommentsChanged )
7674 this . fetchAncestors ( comment )
7775 }
7876 } ,
7977
80- setTitle : function ( comment ) {
78+ setTitle ( comment ) {
8179 if ( comment . deleted ) {
8280 return setTitle ( 'Deleted comment' )
8381 }
@@ -88,14 +86,14 @@ var PermalinkedComment = React.createClass({
8886 setTitle ( title )
8987 } ,
9088
91- handleCommentsChanged : function ( payload ) {
89+ handleCommentsChanged ( payload ) {
9290 // We're only interested in re-rendering to update collapsed display
9391 if ( payload . type == 'collapse' ) {
9492 this . forceUpdate ( )
9593 }
9694 } ,
9795
98- render : function ( ) {
96+ render ( ) {
9997 var comment = this . state . comment
10098 // Render a placeholder while we're waiting for the comment to load
10199 if ( ! comment . id ) { return this . renderCommentLoading ( comment ) }
0 commit comments