File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 11var React = require ( 'react' ) ;
22var Reflux = require ( 'reflux' ) ;
3+ var _ = require ( 'underscore' ) ;
34var Loading = require ( 'reloading' ) ;
45
56var Actions = require ( '../actions/actions' ) ;
@@ -15,7 +16,7 @@ var Notifications = React.createClass({
1516
1617 getInitialState : function ( ) {
1718 return {
18- notifications : [ ] ,
19+ notifications : { } ,
1920 loading : true
2021 } ;
2122 } ,
@@ -31,10 +32,19 @@ var Notifications = React.createClass({
3132 render : function ( ) {
3233 var notifications ;
3334
34- if ( this . state . notifications . length > 0 ) {
35+ if ( ! _ . isEmpty ( this . state . notifications ) ) {
3536 notifications = (
36- this . state . notifications . map ( function ( object , i ) {
37- return < SingleNotification key = { object . id } notification = { object } /> ;
37+ _ . map ( this . state . notifications , function ( repo , i ) {
38+ return (
39+ < div key = { i } >
40+ < h4 > { i } </ h4 >
41+ { repo . map ( function ( as , df ) {
42+ return (
43+ < SingleNotification notification = { as } /> )
44+ )
45+ } ) }
46+ </ div >
47+ ) ;
3848 } )
3949 ) ;
4050 } else {
Original file line number Diff line number Diff line change @@ -40,8 +40,12 @@ var NotificationsStore = Reflux.createStore({
4040 } ,
4141
4242 onGetNotificationsCompleted : function ( notifications ) {
43- this . _notifications = notifications ;
44- this . trigger ( this . _notifications ) ;
43+ var groupedNotifications = _ . groupBy ( notifications , function ( object ) {
44+ return object . repository . name ;
45+ } ) ;
46+
47+ this . _notifications = groupedNotifications ;
48+ this . trigger ( groupedNotifications ) ;
4549 } ,
4650
4751 onGetNotificationsFailed : function ( error ) {
You can’t perform that action at this time.
0 commit comments