nutella_framework 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/framework_components/roomcast-bot/roomcast_bot.rb +42 -1
- data/framework_components/roomcast-teacher-controls/dist/app.js +95 -12
- data/framework_components/roomcast-teacher-controls/dist/main.css +2 -2
- data/framework_components/roomcast-teacher-controls/package.json +0 -0
- data/framework_components/roomcast-teacher-controls/src/app/components/ActivitiesGrid.js +2 -2
- data/framework_components/roomcast-teacher-controls/src/app/components/ActivityCard.js +39 -7
- data/framework_components/roomcast-teacher-controls/src/app/components/main.js +52 -1
- data/framework_components/roomcast-teacher-controls/src/less/main.less +1 -1
- metadata +2 -2
File without changes
|
@@ -50,7 +50,6 @@ var ActivitiesGrid = React.createClass({
|
|
50
50
|
var cardStyle = {
|
51
51
|
width: this._cardSize[0],
|
52
52
|
height: this._cardSize[1],
|
53
|
-
//position: 'absolute',
|
54
53
|
flexBasis: this._cardSize[0]
|
55
54
|
};
|
56
55
|
|
@@ -58,11 +57,12 @@ var ActivitiesGrid = React.createClass({
|
|
58
57
|
if(this.props.configs.hasOwnProperty(c)) {
|
59
58
|
cards.push(
|
60
59
|
<ActivityCard
|
60
|
+
key={c}
|
61
61
|
configId={c}
|
62
62
|
configName={this.props.configs[c].name}
|
63
63
|
currentConfigId={this.props.currentConfig}
|
64
64
|
cardStyle={cardStyle}
|
65
|
-
/>
|
65
|
+
timer={this.props.timer} />
|
66
66
|
);
|
67
67
|
}
|
68
68
|
}
|
@@ -49,6 +49,8 @@ var ActivityCard = React.createClass({
|
|
49
49
|
height: cardHeight
|
50
50
|
});
|
51
51
|
|
52
|
+
var stroke = this.state.isSelected ? 'white' : null;
|
53
|
+
|
52
54
|
svg.append('circle')
|
53
55
|
.attr({
|
54
56
|
cx: cardWidth / 2,
|
@@ -56,7 +58,8 @@ var ActivityCard = React.createClass({
|
|
56
58
|
r: '0px'
|
57
59
|
})
|
58
60
|
.style({
|
59
|
-
fill: this._colorSelected
|
61
|
+
fill: this._colorSelected,
|
62
|
+
stroke: stroke
|
60
63
|
})
|
61
64
|
.transition()
|
62
65
|
.call(publishAfterTransition)
|
@@ -95,6 +98,24 @@ var ActivityCard = React.createClass({
|
|
95
98
|
}
|
96
99
|
},
|
97
100
|
|
101
|
+
formatTimer: function(ms) {
|
102
|
+
var x = ms / 1000;
|
103
|
+
var seconds = Math.floor(x % 60);
|
104
|
+
x /= 60;
|
105
|
+
var minutes = Math.floor(x % 60);
|
106
|
+
x /= 60;
|
107
|
+
var hours = Math.floor(x % 24);
|
108
|
+
x /= 24;
|
109
|
+
var days = Math.floor(x);
|
110
|
+
|
111
|
+
var timer;
|
112
|
+
timer = seconds + ' sec';
|
113
|
+
timer = minutes != 0 ? minutes + " min " + timer : timer;
|
114
|
+
timer = hours != 0 ? hours + " hrs " + timer : timer;
|
115
|
+
timer = days != 0 ? days + " days " + timer : timer;
|
116
|
+
return timer;
|
117
|
+
},
|
118
|
+
|
98
119
|
render: function () {
|
99
120
|
|
100
121
|
var selectedCardStyle = {
|
@@ -105,18 +126,30 @@ var ActivityCard = React.createClass({
|
|
105
126
|
// Copy
|
106
127
|
var cardStyle = {};
|
107
128
|
for(var p_ in this.props.cardStyle) {
|
108
|
-
|
129
|
+
if(this.props.cardStyle.hasOwnProperty(p_)) {
|
130
|
+
cardStyle[p_] = this.props.cardStyle[p_];
|
131
|
+
}
|
109
132
|
}
|
133
|
+
var spanStyle = {};
|
110
134
|
|
111
135
|
var className='activity-card';
|
136
|
+
var timer = null;
|
112
137
|
|
113
138
|
// Add properties if selected
|
114
139
|
if(this.state.isSelected) {
|
115
140
|
className += ' activity-card-selected';
|
116
141
|
for(var p in selectedCardStyle) {
|
117
|
-
|
142
|
+
if(selectedCardStyle.hasOwnProperty(p)) {
|
143
|
+
cardStyle[p] = selectedCardStyle[p];
|
144
|
+
}
|
118
145
|
}
|
119
|
-
|
146
|
+
timer = this.formatTimer(this.props.timer);
|
147
|
+
spanStyle = {
|
148
|
+
width: this.props.cardStyle.width,
|
149
|
+
textAlign: 'center',
|
150
|
+
fontWeight: '400',
|
151
|
+
fontSize: '2.6em',
|
152
|
+
marginBottom: '20px'};
|
120
153
|
}
|
121
154
|
|
122
155
|
return (
|
@@ -127,12 +160,11 @@ var ActivityCard = React.createClass({
|
|
127
160
|
|
128
161
|
<div className='card-name'>
|
129
162
|
|
130
|
-
<span
|
163
|
+
<span style={spanStyle} >{this.props.configName}</span>
|
164
|
+
<span>{timer}</span>
|
131
165
|
|
132
166
|
</div>
|
133
167
|
|
134
|
-
|
135
|
-
|
136
168
|
</Paper>);
|
137
169
|
}
|
138
170
|
|
@@ -28,6 +28,17 @@ var Main = React.createClass({
|
|
28
28
|
self.setCurrentConfig(message);
|
29
29
|
});
|
30
30
|
|
31
|
+
// Get current selected config
|
32
|
+
nutella.net.request('launchTime/retrieve', '', function (time) {
|
33
|
+
self.setTimer(time, self.updateTimer);
|
34
|
+
|
35
|
+
// Subscribe for future changes
|
36
|
+
nutella.net.subscribe('launchTime/updated', function (time, from) {
|
37
|
+
self.setTimer(time, self.updateTimer);
|
38
|
+
});
|
39
|
+
|
40
|
+
});
|
41
|
+
|
31
42
|
});
|
32
43
|
|
33
44
|
});
|
@@ -36,6 +47,7 @@ var Main = React.createClass({
|
|
36
47
|
getInitialState: function () {
|
37
48
|
return {
|
38
49
|
currentConfig: '1',
|
50
|
+
timer: null,
|
39
51
|
configs: []
|
40
52
|
}
|
41
53
|
},
|
@@ -52,6 +64,44 @@ var Main = React.createClass({
|
|
52
64
|
});
|
53
65
|
},
|
54
66
|
|
67
|
+
/**
|
68
|
+
* Computes duration from absolute times and stores in state.
|
69
|
+
* @param time
|
70
|
+
*/
|
71
|
+
setTimer: function(time) {
|
72
|
+
var self = this;
|
73
|
+
|
74
|
+
var callback = function() {
|
75
|
+
window.clearInterval(self._timeoutId);
|
76
|
+
var action = function() {
|
77
|
+
self.updateTimer(self.state.timer + 1000);
|
78
|
+
};
|
79
|
+
self._timeoutId = setInterval(action, 1000);
|
80
|
+
};
|
81
|
+
|
82
|
+
var now = new Date().getTime();
|
83
|
+
var then = new Date(time).getTime();
|
84
|
+
var duration = now - then;
|
85
|
+
if(duration < 100) {
|
86
|
+
duration = 0;
|
87
|
+
}
|
88
|
+
if(callback) {
|
89
|
+
this.setState({
|
90
|
+
timer: duration
|
91
|
+
}, callback);
|
92
|
+
} else {
|
93
|
+
this.setState({
|
94
|
+
timer: duration
|
95
|
+
});
|
96
|
+
}
|
97
|
+
},
|
98
|
+
|
99
|
+
updateTimer: function(t) {
|
100
|
+
this.setState({
|
101
|
+
timer: t
|
102
|
+
});
|
103
|
+
},
|
104
|
+
|
55
105
|
render: function () {
|
56
106
|
|
57
107
|
return (
|
@@ -60,7 +110,8 @@ var Main = React.createClass({
|
|
60
110
|
|
61
111
|
<ActivitiesGrid
|
62
112
|
configs={this.state.configs}
|
63
|
-
currentConfig={this.state.currentConfig}
|
113
|
+
currentConfig={this.state.currentConfig}
|
114
|
+
timer={this.state.timer} />
|
64
115
|
|
65
116
|
<Footer />
|
66
117
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nutella_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Gnoli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|