|
@@ -65,7 +65,7 @@ export default class HomeScreen extends FetchedDataSectionList {
|
65
|
65
|
id: SECTIONS_ID[0]
|
66
|
66
|
},
|
67
|
67
|
{
|
68
|
|
- title: 'News Feed',
|
|
68
|
+ title: i18n.t('homeScreen.newsFeed'),
|
69
|
69
|
data: newsData,
|
70
|
70
|
extraData: super.state,
|
71
|
71
|
keyExtractor: this.getKeyExtractor,
|
|
@@ -120,45 +120,95 @@ export default class HomeScreen extends FetchedDataSectionList {
|
120
|
120
|
getDashboardItemData(item: Object) {
|
121
|
121
|
let icon = '';
|
122
|
122
|
let title = '';
|
123
|
|
- let subtitle = '';
|
|
123
|
+ let subtitle;
|
124
|
124
|
let clickAction;
|
|
125
|
+ let isAvailable = false;
|
|
126
|
+ let color = ThemeManager.getCurrentThemeVariables().disabledTextColor;
|
125
|
127
|
switch (item['id']) {
|
126
|
128
|
case 'today_events':
|
127
|
129
|
icon = 'calendar-range';
|
128
|
|
- title = 'Today\s events';
|
129
|
|
- if (item['data'].length === 0)
|
130
|
|
- subtitle = 'Pas d\'event ajd';
|
131
|
|
- else
|
132
|
|
- subtitle = item['data'].length + ' events ajd';
|
|
130
|
+ color = ThemeManager.getCurrentThemeVariables().planningColor;
|
|
131
|
+ title = i18n.t('homeScreen.dashboard.todayEventsTitle');
|
|
132
|
+ isAvailable = item['data'].length > 0;
|
|
133
|
+ if (isAvailable) {
|
|
134
|
+ subtitle =
|
|
135
|
+ <Text>
|
|
136
|
+ <Text style={{fontWeight: "bold"}}>{item['data'].length}</Text>
|
|
137
|
+ <Text>{i18n.t('homeScreen.dashboard.todayEventsSubtitle')}</Text>
|
|
138
|
+ </Text>;
|
|
139
|
+ } else
|
|
140
|
+ subtitle = i18n.t('homeScreen.dashboard.todayEventsSubtitleNA');
|
133
|
141
|
clickAction = () => this.props.navigation.navigate('Planning');
|
134
|
142
|
break;
|
135
|
143
|
case 'proximo_articles':
|
136
|
144
|
icon = 'shopping';
|
137
|
|
- title = 'Proximo';
|
138
|
|
- subtitle = item['data'] + ' articles disponibles';
|
|
145
|
+ color = ThemeManager.getCurrentThemeVariables().proximoColor;
|
|
146
|
+ title = i18n.t('homeScreen.dashboard.proximoTitle');
|
|
147
|
+ isAvailable = parseInt(item['data']) > 0;
|
|
148
|
+ if (isAvailable) {
|
|
149
|
+ subtitle =
|
|
150
|
+ <Text>
|
|
151
|
+ <Text style={{fontWeight: "bold"}}>{item['data']}</Text>
|
|
152
|
+ <Text>{i18n.t('homeScreen.dashboard.proximoSubtitle')}</Text>
|
|
153
|
+ </Text>;
|
|
154
|
+ } else
|
|
155
|
+ subtitle = i18n.t('homeScreen.dashboard.proximoSubtitleNA');
|
139
|
156
|
clickAction = () => this.props.navigation.navigate('Proximo');
|
140
|
157
|
break;
|
141
|
158
|
case 'available_machines':
|
142
|
159
|
icon = 'washing-machine';
|
143
|
|
- title = 'Machines disponibles';
|
144
|
|
- subtitle = item['data']['dryers'] + ' dryers and ' + item['data']['washers'] + ' washers.';
|
|
160
|
+ color = ThemeManager.getCurrentThemeVariables().proxiwashColor;
|
|
161
|
+ title = i18n.t('homeScreen.dashboard.proxiwashTitle');
|
|
162
|
+ isAvailable = parseInt(item['data']['dryers']) > 0 || parseInt(item['data']['washers']) > 0;
|
|
163
|
+ if (isAvailable) {
|
|
164
|
+ subtitle =
|
|
165
|
+ <Text>
|
|
166
|
+ <Text style={{
|
|
167
|
+ fontWeight: parseInt(item['data']['dryers']) > 0 ?
|
|
168
|
+ 'bold' :
|
|
169
|
+ 'normal',
|
|
170
|
+ color: parseInt(item['data']['dryers']) > 0 ?
|
|
171
|
+ ThemeManager.getCurrentThemeVariables().textColor :
|
|
172
|
+ ThemeManager.getCurrentThemeVariables().listNoteColor
|
|
173
|
+ }}>
|
|
174
|
+ {item['data']['dryers']}
|
|
175
|
+ </Text>
|
|
176
|
+ <Text>{i18n.t('homeScreen.dashboard.proxiwashSubtitle1')}</Text>
|
|
177
|
+ <Text style={{
|
|
178
|
+ fontWeight: parseInt(item['data']['washers']) > 0 ?
|
|
179
|
+ 'bold' :
|
|
180
|
+ 'normal',
|
|
181
|
+ color: parseInt(item['data']['washers']) > 0 ?
|
|
182
|
+ ThemeManager.getCurrentThemeVariables().textColor :
|
|
183
|
+ ThemeManager.getCurrentThemeVariables().listNoteColor
|
|
184
|
+ }}>
|
|
185
|
+ {item['data']['washers']}
|
|
186
|
+ </Text>
|
|
187
|
+ <Text>{i18n.t('homeScreen.dashboard.proxiwashSubtitle2')}</Text>
|
|
188
|
+ </Text>;
|
|
189
|
+ } else
|
|
190
|
+ subtitle = i18n.t('homeScreen.dashboard.proxiwashSubtitleNA');
|
145
|
191
|
clickAction = () => this.props.navigation.navigate('Proxiwash');
|
146
|
192
|
break;
|
147
|
193
|
case 'today_menu':
|
148
|
194
|
icon = 'silverware-fork-knife';
|
149
|
|
- title = 'Menu du jour';
|
150
|
|
- if (item['data'].length === 0)
|
151
|
|
- subtitle = 'non disponible';
|
152
|
|
- else
|
153
|
|
- subtitle = 'Click here to show the menu';
|
|
195
|
+ color = ThemeManager.getCurrentThemeVariables().menuColor;
|
|
196
|
+ title = i18n.t('homeScreen.dashboard.menuTitle');
|
|
197
|
+ isAvailable = item['data'].length > 0;
|
|
198
|
+ if (isAvailable) {
|
|
199
|
+ subtitle = i18n.t('homeScreen.dashboard.menuSubtitle');
|
|
200
|
+ } else
|
|
201
|
+ subtitle = i18n.t('homeScreen.dashboard.menuSubtitleNA');
|
154
|
202
|
clickAction = () => this.props.navigation.navigate('SelfMenuScreen');
|
155
|
203
|
break;
|
156
|
204
|
}
|
157
|
205
|
return {
|
158
|
206
|
icon: icon,
|
|
207
|
+ color: color,
|
159
|
208
|
title: title,
|
160
|
209
|
subtitle: subtitle,
|
161
|
|
- clickAction: clickAction
|
|
210
|
+ clickAction: clickAction,
|
|
211
|
+ isAvailable: isAvailable
|
162
|
212
|
}
|
163
|
213
|
}
|
164
|
214
|
|
|
@@ -170,20 +220,46 @@ export default class HomeScreen extends FetchedDataSectionList {
|
170
|
220
|
<Card style={{
|
171
|
221
|
flex: 0,
|
172
|
222
|
marginLeft: 10,
|
173
|
|
- marginRight: 10
|
|
223
|
+ marginRight: 10,
|
|
224
|
+ borderRadius: 50,
|
|
225
|
+ backgroundColor: ThemeManager.getCurrentThemeVariables().cardDefaultBg
|
174
|
226
|
}}>
|
175
|
227
|
<PlatformTouchable
|
176
|
228
|
onPress={itemData['clickAction']}
|
|
229
|
+ style={{
|
|
230
|
+ zIndex: 100,
|
|
231
|
+ borderRadius: 50
|
|
232
|
+ }}
|
177
|
233
|
>
|
178
|
|
- <CardItem>
|
|
234
|
+ <CardItem style={{
|
|
235
|
+ borderRadius: 50,
|
|
236
|
+ backgroundColor: 'transparent'
|
|
237
|
+ }}>
|
179
|
238
|
<Left>
|
180
|
239
|
<CustomMaterialIcon
|
181
|
240
|
icon={itemData['icon']}
|
|
241
|
+ color={
|
|
242
|
+ itemData['isAvailable'] ?
|
|
243
|
+ itemData['color'] :
|
|
244
|
+ ThemeManager.getCurrentThemeVariables().textDisabledColor
|
|
245
|
+ }
|
182
|
246
|
fontSize={40}
|
183
|
247
|
width={40}/>
|
184
|
248
|
<Body>
|
185
|
|
- <H3>{itemData['title']}</H3>
|
186
|
|
- <Text>{itemData['subtitle']}</Text>
|
|
249
|
+ <H3 style={{
|
|
250
|
+ color: itemData['isAvailable'] ?
|
|
251
|
+ ThemeManager.getCurrentThemeVariables().textColor :
|
|
252
|
+ ThemeManager.getCurrentThemeVariables().listNoteColor
|
|
253
|
+ }}>
|
|
254
|
+ {itemData['title']}
|
|
255
|
+ </H3>
|
|
256
|
+ <Text style={{
|
|
257
|
+ color: itemData['isAvailable'] ?
|
|
258
|
+ ThemeManager.getCurrentThemeVariables().listNoteColor :
|
|
259
|
+ ThemeManager.getCurrentThemeVariables().textDisabledColor
|
|
260
|
+ }}>
|
|
261
|
+ {itemData['subtitle']}
|
|
262
|
+ </Text>
|
187
|
263
|
</Body>
|
188
|
264
|
</Left>
|
189
|
265
|
</CardItem>
|