@@ -8,146 +8,81 @@ import { connect } from 'react-redux'
88import { getEventById } from '../../actions/eventAction'
99// import { getProjectById } from '../../actions/projectAction'
1010import { getPostById } from '../../actions/postAction'
11- import PostPopup from './Popups/PostPopup' ;
12- import EventPopup from './Popups/EventPopup' ;
11+ import LeftNav from '../dashboard/Community/LeftNav'
12+ import OrgProfile from '../dashboard/Community/components/OrgProfile' ;
13+ import OrgPermission from '../dashboard/Community/components/OrgPermission' ;
14+ import OrgSettings from '../dashboard/Community/components/OrgSettings' ;
15+ import OrgAuth from '../dashboard/Community/components/OrgAuth' ;
16+ import OrgMaintenance from '../dashboard/Community/components/OrgMaintenance' ;
17+ import Users from './Users' ;
18+ import ActivityTimeline from './ActivityTimeline' ;
1319
1420class Activity extends Component {
1521 constructor ( props ) {
1622 super ( props ) ;
1723 this . state = {
1824 org : true ,
19- showEvent : false ,
20- showPost : false ,
21- showProject : false ,
22- eventId : '' ,
23- postId : ''
24- }
25+ option : {
26+ profile : false ,
27+ settings : false ,
28+ permission : false ,
29+ authentication : false ,
30+ maintenance : false ,
31+ activity : true ,
32+ details : true
33+ } ,
34+ } ;
2535 }
2636
27- showPopup = ( modalType , id ) => {
28- console . log ( 'type ' , modalType , this . state )
29-
30- if ( Boolean ( modalType === "Event" ) ) {
31- // CHANGE HARD CODED DATA TO ID
32- this . props . getEventById ( "5ef76594201b3f2dec2acf20" ) ;
33- this . setState ( {
34- showEvent : true ,
35- eventId : '5ef76594201b3f2dec2acf20'
36- } )
37- }
38-
39- if ( Boolean ( modalType === "Project" ) ) {
40- // CHANGE HARD CODED DATA TO ID
41- this . props . history . push ( `/5efca0d9081c631ed098944b/proj-info` )
42- }
37+ changeOption = ( name ) => {
38+ const keys = Object . keys ( this . state . option ) ;
39+ let item = keys . filter ( ( k ) => k === name ) ;
40+ console . log ( "changeOption items " , item ) ;
41+ this . setState ( { option : { profile : false } } ) ;
42+ this . setState ( { option : { [ name ] : true } } ) ;
43+ this . setState ( { view : name } ) ;
44+ } ;
4345
44- if ( Boolean ( modalType === "Post" ) ) {
45- // CHANGE HARD CODED DATA TO ID
46- this . props . getPostById ( "5efd836db08e9e369050cca1" ) ;
47- this . setState ( {
48- showEvent : false ,
49- showPost : true ,
50- postId : "5efd836db08e9e369050cca1" ,
51- } ) ;
52- }
53- }
54-
55- handleClose = ( ) => {
56- this . setState ( {
57- showEvent : false ,
58- showPost : false
59- } )
46+ componentDidMount ( ) {
47+ this . setState ( { view : 'details' } )
6048 }
6149
6250 render ( ) {
63- const { showEvent, showPost, eventId, postId } = this . state
64- const activity = [
65- {
66- type : 'Post' ,
67- text : "User X created a post!" ,
68- } ,
69- {
70- type : 'Project' ,
71- text : "User X created a Project!" ,
72- } ,
73- {
74- type : 'Event' ,
75- text : "User X created an Event!" ,
76- } ,
77- {
78- type : 'Comment' ,
79- text : "User X commented on GSOC !" ,
80- } ,
81- {
82- type : 'Post' ,
83- text : "User X created a post!" ,
84- } ,
85- {
86- type : 'Event' ,
87- text : "User X created an Event!" ,
88- } ,
89- {
90- type : 'Comment' ,
91- text : "User X commented on GSOC !" ,
92- } ,
93- {
94- type : 'Post' ,
95- text : "User X created a post!" ,
96- } ,
97- {
98- type : 'Event' ,
99- text : "User X created an Event!" ,
100- } ,
101- {
102- type : 'Comment' ,
103- text : "User X commented on GSOC !" ,
104- } ,
105- {
106- type : 'Post' ,
107- text : "User X created a post!" ,
108- } ,
109- {
110- type : 'Event' ,
111- text : "User X created an Event!" ,
112- } ,
113- {
114- type : 'Comment' ,
115- text : "User X commented on GSOC !" ,
116- } ,
117- ] ;
51+ const { view } = this . state
11852
11953 return (
12054 < div className = "overall_container" >
12155 < div className = "main_navigation" >
122- < Navigation orgSettings = { this . state . org } />
56+ < Navigation orgSettings = { this . state . org } user = { this . props . user } />
12357 </ div >
124- < div className = "user_activity_view " >
58+ < div className = "org_settings_view " >
12559 < div className = "main_section" >
126- < div className = "timelines__container" >
127- < p className = "activity__header" > User activity</ p >
128- < Timeline mode = "alternate" >
129- { activity . map ( ( act , index ) => (
130- < Timeline . Item
131- key = { index }
132- onClick = { this . showPopup . bind ( this , act . type , index ) }
133- >
134- < p className = "activity__link" > { act . text } </ p >
135- </ Timeline . Item >
136- ) ) }
137- </ Timeline >
60+ < div className = "left_nav" >
61+ < p className = "header_text" > Community Settings</ p >
62+ < LeftNav
63+ data = { {
64+ option : this . state . option ,
65+ changeOption : this . changeOption . bind ( this ) ,
66+ } }
67+ />
68+ </ div >
69+ < div className = "right_section" >
70+ { view === "profile" ? < OrgProfile /> : null }
71+ { view === "permission" ? < OrgPermission /> : null }
72+ { view === "settings" ? < OrgSettings /> : null }
73+ { view === "authentication" ? < OrgAuth /> : null }
74+ { view === "maintenance" ? < OrgMaintenance /> : null }
75+ { view === "activity" ? (
76+ < Users
77+ handleOption = { { changeOption : this . changeOption . bind ( this ) } }
78+ />
79+ ) : null }
80+ { view === "details" ? (
81+ < ActivityTimeline />
82+ ) : null }
13883 </ div >
13984 </ div >
14085 </ div >
141- < EventPopup
142- show = { showEvent }
143- onHide = { this . handleClose }
144- eventId = { eventId }
145- />
146- < PostPopup
147- show = { showPost }
148- onHide = { this . handleClose }
149- postId = { postId }
150- />
15186 </ div >
15287 ) ;
15388 }
0 commit comments