@@ -15,31 +15,60 @@ class EachChoice extends Component {
15
15
this . timer = setInterval ( ( ) => {
16
16
this . setState ( { id : this . state . count , count : this . state . count + 1 } ) ;
17
17
console . log ( "interval count: " , this . state . count ) ;
18
- } , 5000 ) ;
18
+ } , 20000 ) ;
19
19
}
20
20
21
21
shouldComponentUpdate ( nextProps , nextState ) {
22
22
console . log ( nextProps , nextState ) ;
23
23
if ( this . state . count === this . props . trial_choices . length ) {
24
- console . log ( "wronggg SHOUDL STOP TIME" ) ;
24
+ console . log ( "wronggg SHOULD STOP TIME" ) ;
25
25
clearInterval ( this . timer ) ;
26
26
}
27
27
return true ;
28
28
}
29
-
29
+ letterChosen = letter =>
30
+ this . props . displayedAssets . filter ( ( data , i ) => {
31
+ if ( this . props . displayedAssets [ i ] . letter === letter ) {
32
+ return this . props . displayedAssets [ i ] ;
33
+ }
34
+ } ) ;
30
35
render ( ) {
31
- console . log ( this . props . trial_choices . length ) ;
36
+ const id = this . props . match . params . trialId ;
32
37
if ( this . props . trial_choices . length === 0 ) return < h3 > Loading...</ h3 > ;
33
38
return (
34
39
< div >
35
- { this . props . trial_choices . length > this . state . count ? (
40
+ { this . props . trial_choices . length >= this . state . count ? (
36
41
< div >
37
- < p > { this . props . trial_choices [ this . state . id ] . Choices_left } </ p >
38
- < p > { this . props . trial_choices [ this . state . id ] . Choices_right } </ p >
39
- hello
42
+ < Link
43
+ to = { `/binary_trial/${ id } /reward/${
44
+ this . props . trial_choices [ this . state . id ] . Choices_left
45
+ } `}
46
+ >
47
+ < img
48
+ src = {
49
+ this . letterChosen (
50
+ this . props . trial_choices [ this . state . id ] . Choices_left
51
+ ) [ 0 ] . fractals
52
+ }
53
+ />
54
+ </ Link >
55
+ < span > +</ span >
56
+ < Link
57
+ to = { `/binary_trial/${ id } /reward/${
58
+ this . props . trial_choices [ this . state . id ] . Choices_right
59
+ } `}
60
+ >
61
+ < img
62
+ src = {
63
+ this . letterChosen (
64
+ this . props . trial_choices [ this . state . id ] . Choices_right
65
+ ) [ 0 ] . fractals
66
+ }
67
+ />
68
+ </ Link >
40
69
</ div >
41
70
) : (
42
- < div > Done! </ div >
71
+ < div > done </ div >
43
72
) }
44
73
</ div >
45
74
) ;
0 commit comments