@@ -3,7 +3,7 @@ import _ from 'lodash';
3
3
import { Card , Alert , ButtonGroup , Button , Spinner } from 'elemental' ;
4
4
import VolunteerForm from './VolunteerForm' ;
5
5
import LoginLinkForm from './LoginLinkForm' ;
6
- import Missions from './Missions ' ;
6
+ import Mission from './Mission ' ;
7
7
import * as http from '../lib/http' ;
8
8
9
9
export default React . createClass ( {
@@ -42,6 +42,20 @@ export default React.createClass({
42
42
this . setState ( { isEditing : ! this . state . isEditing } ) ;
43
43
} ,
44
44
45
+ renderMissions ( ) {
46
+ if ( ! this . state . missions ) return null ;
47
+
48
+ if ( ! this . state . missions . length ) {
49
+ return < p > You're not on any missions yet.</ p > ;
50
+ }
51
+
52
+ return (
53
+ < div >
54
+ { this . state . missions . map ( mission => < Mission key = { mission . id } mission = { mission } /> ) }
55
+ </ div >
56
+ ) ;
57
+ } ,
58
+
45
59
render ( ) {
46
60
if ( this . state . error ) {
47
61
return (
@@ -76,12 +90,11 @@ export default React.createClass({
76
90
{ ! this . state . hasVisitedBefore && ! this . state . isEditing &&
77
91
< Alert type = "info" > < strong > Welcome!</ strong > To edit your personal information, click on “< strong > Change Data</ strong > ” ↗</ Alert >
78
92
}
79
- < Card >
80
- { this . state . isEditing
81
- ? < VolunteerForm volunteer = { this . state . volunteer } onChange = { this . setVolunteer } />
82
- : < Missions missions = { this . state . missions } />
83
- }
84
- </ Card >
93
+
94
+ { this . state . isEditing
95
+ ? < VolunteerForm volunteer = { this . state . volunteer } onChange = { this . setVolunteer } />
96
+ : this . renderMissions ( )
97
+ }
85
98
</ div >
86
99
) ;
87
100
} ,
0 commit comments