@@ -4,19 +4,18 @@ const ContestImage = require('./Contest/ContestImage');
4
4
const ContestDuration = require ( './Contest/ContestDuration' ) ;
5
5
const HideContestButton = require ( './Contest/HideContestButton' ) ;
6
6
const AddToCalendarButton = require ( './Contest/AddToCalendarButton' ) ;
7
- const Hide = require ( '../hide' ) ;
8
7
9
8
const Contest = React . createClass ( {
10
9
getInitialState ( ) {
11
10
return {
12
11
isSelected : false ,
13
12
visible : true ,
14
- archived : Hide . isHidden ( this . props . details ) ,
13
+ archived : this . props . contest . isHidden ( ) ,
15
14
} ;
16
15
} ,
17
16
onClickContestTitle ( ) {
18
17
ga ( 'send' , 'event' , 'Open Contest' ) ;
19
- chrome . tabs . create ( { url : this . props . details . url } ) ;
18
+ chrome . tabs . create ( { url : this . props . contest . url } ) ;
20
19
} ,
21
20
onMouseEnterHandler ( ) {
22
21
this . setState ( {
@@ -35,21 +34,21 @@ const Contest = React.createClass({
35
34
} ) ;
36
35
}
37
36
} ,
38
- archive ( ) {
37
+ hide ( ) {
39
38
ga ( 'send' , 'event' , 'Hide' ) ;
40
- Hide . hideContest ( this . props . details ) ;
39
+ this . props . contest . hide ( ) ;
41
40
this . setState ( { visible : false , archived : true } ) ;
42
41
} ,
43
- unArchive ( ) {
42
+ show ( ) {
44
43
ga ( 'send' , 'event' , 'Unhide' ) ;
45
- Hide . showContest ( this . props . details ) ;
44
+ this . props . contest . show ( ) ;
46
45
this . setState ( { visible : false , archived : false } ) ;
47
46
} ,
48
- hide ( ) {
47
+ toggleVisiblity ( ) {
49
48
if ( this . state . archived ) {
50
- this . unArchive ( ) ;
49
+ this . hide ( ) ;
51
50
} else {
52
- this . archive ( ) ;
51
+ this . show ( ) ;
53
52
}
54
53
} ,
55
54
render ( ) {
@@ -59,17 +58,35 @@ const Contest = React.createClass({
59
58
60
59
return (
61
60
< a >
62
- < li onMouseMove = { this . onMouseMoveHandler } onMouseEnter = { this . onMouseEnterHandler } onMouseLeave = { this . onMouseLeaveHandler } >
63
- < ContestImage platform = { this . props . details . Platform } />
61
+ < li
62
+ onMouseMove = { this . onMouseMoveHandler }
63
+ onMouseEnter = { this . onMouseEnterHandler }
64
+ onMouseLeave = { this . onMouseLeaveHandler }
65
+ >
66
+ < ContestImage platform = { this . props . contest . Platform } />
64
67
< div className = "details-container" >
68
+
65
69
< h2 className = "contest-title" onClick = { this . onClickContestTitle } >
66
- { this . props . details . Name }
70
+ { this . props . contest . Name }
67
71
</ h2 >
68
- < HideContestButton visible = { this . state . isSelected } details = { this . props . details } hideHandler = { this . hide } />
69
- < AddToCalendarButton visible = { this . state . isSelected } type = { this . props . type } details = { this . props . details } />
72
+
73
+ < HideContestButton
74
+ visible = { this . state . isSelected }
75
+ contest = { this . props . contest }
76
+ hideHandler = { this . toggleVisiblity }
77
+ />
78
+
79
+ < AddToCalendarButton
80
+ visible = { this . state . isSelected }
81
+ type = { this . props . type }
82
+ contest = { this . props . contest }
83
+ />
84
+
70
85
< br />
71
- < ContestTime type = { this . props . type } details = { this . props . details } />
72
- < ContestDuration type = { this . props . type } details = { this . props . details } />
86
+
87
+ < ContestTime type = { this . props . type } contest = { this . props . contest } />
88
+
89
+ < ContestDuration type = { this . props . type } contest = { this . props . contest } />
73
90
{ ' ' }
74
91
< br />
75
92
</ div >
0 commit comments