Improved dashboard display
This commit is contained in:
parent
f806152370
commit
158973c74d
6 changed files with 135 additions and 27 deletions
|
@ -243,7 +243,7 @@ export default {
|
|||
|
||||
// Text
|
||||
textColor: "#000",
|
||||
textDisabledColor: "#d9e1e8",
|
||||
textDisabledColor: "#c1c1c1",
|
||||
inverseTextColor: "#fff",
|
||||
noteFontSize: 14,
|
||||
get defaultTextColor() {
|
||||
|
@ -273,6 +273,13 @@ export default {
|
|||
proxiwashBrokenColor: "rgba(162,162,162,0.31)",
|
||||
proxiwashErrorColor: "rgba(204,7,0,0.31)",
|
||||
|
||||
// Screens
|
||||
planningColor: '#d9b10a',
|
||||
proximoColor: '#ec5904',
|
||||
proxiwashColor: '#1fa5ee',
|
||||
menuColor: '#e91314',
|
||||
|
||||
|
||||
// Other
|
||||
borderRadiusBase: platform === "ios" ? 5 : 2,
|
||||
borderWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
|
||||
|
|
|
@ -244,7 +244,7 @@ export default {
|
|||
|
||||
// Text
|
||||
textColor: "#ebebeb",
|
||||
textDisabledColor: "#3b3f42",
|
||||
textDisabledColor: "#5b5b5b",
|
||||
inverseTextColor: "#000",
|
||||
noteFontSize: 14,
|
||||
get defaultTextColor() {
|
||||
|
@ -274,6 +274,11 @@ export default {
|
|||
proxiwashBrokenColor: "#000000",
|
||||
proxiwashErrorColor: "rgba(213,8,0,0.57)",
|
||||
|
||||
// Screens
|
||||
planningColor: '#d99e09',
|
||||
proximoColor: '#ec5904',
|
||||
proxiwashColor: '#1fa5ee',
|
||||
menuColor: '#b81213',
|
||||
|
||||
// Other
|
||||
borderRadiusBase: platform === "ios" ? 5 : 2,
|
||||
|
|
|
@ -65,7 +65,7 @@ export default class HomeScreen extends FetchedDataSectionList {
|
|||
id: SECTIONS_ID[0]
|
||||
},
|
||||
{
|
||||
title: 'News Feed',
|
||||
title: i18n.t('homeScreen.newsFeed'),
|
||||
data: newsData,
|
||||
extraData: super.state,
|
||||
keyExtractor: this.getKeyExtractor,
|
||||
|
@ -120,45 +120,95 @@ export default class HomeScreen extends FetchedDataSectionList {
|
|||
getDashboardItemData(item: Object) {
|
||||
let icon = '';
|
||||
let title = '';
|
||||
let subtitle = '';
|
||||
let subtitle;
|
||||
let clickAction;
|
||||
let isAvailable = false;
|
||||
let color = ThemeManager.getCurrentThemeVariables().disabledTextColor;
|
||||
switch (item['id']) {
|
||||
case 'today_events':
|
||||
icon = 'calendar-range';
|
||||
title = 'Today\s events';
|
||||
if (item['data'].length === 0)
|
||||
subtitle = 'Pas d\'event ajd';
|
||||
else
|
||||
subtitle = item['data'].length + ' events ajd';
|
||||
color = ThemeManager.getCurrentThemeVariables().planningColor;
|
||||
title = i18n.t('homeScreen.dashboard.todayEventsTitle');
|
||||
isAvailable = item['data'].length > 0;
|
||||
if (isAvailable) {
|
||||
subtitle =
|
||||
<Text>
|
||||
<Text style={{fontWeight: "bold"}}>{item['data'].length}</Text>
|
||||
<Text>{i18n.t('homeScreen.dashboard.todayEventsSubtitle')}</Text>
|
||||
</Text>;
|
||||
} else
|
||||
subtitle = i18n.t('homeScreen.dashboard.todayEventsSubtitleNA');
|
||||
clickAction = () => this.props.navigation.navigate('Planning');
|
||||
break;
|
||||
case 'proximo_articles':
|
||||
icon = 'shopping';
|
||||
title = 'Proximo';
|
||||
subtitle = item['data'] + ' articles disponibles';
|
||||
color = ThemeManager.getCurrentThemeVariables().proximoColor;
|
||||
title = i18n.t('homeScreen.dashboard.proximoTitle');
|
||||
isAvailable = parseInt(item['data']) > 0;
|
||||
if (isAvailable) {
|
||||
subtitle =
|
||||
<Text>
|
||||
<Text style={{fontWeight: "bold"}}>{item['data']}</Text>
|
||||
<Text>{i18n.t('homeScreen.dashboard.proximoSubtitle')}</Text>
|
||||
</Text>;
|
||||
} else
|
||||
subtitle = i18n.t('homeScreen.dashboard.proximoSubtitleNA');
|
||||
clickAction = () => this.props.navigation.navigate('Proximo');
|
||||
break;
|
||||
case 'available_machines':
|
||||
icon = 'washing-machine';
|
||||
title = 'Machines disponibles';
|
||||
subtitle = item['data']['dryers'] + ' dryers and ' + item['data']['washers'] + ' washers.';
|
||||
color = ThemeManager.getCurrentThemeVariables().proxiwashColor;
|
||||
title = i18n.t('homeScreen.dashboard.proxiwashTitle');
|
||||
isAvailable = parseInt(item['data']['dryers']) > 0 || parseInt(item['data']['washers']) > 0;
|
||||
if (isAvailable) {
|
||||
subtitle =
|
||||
<Text>
|
||||
<Text style={{
|
||||
fontWeight: parseInt(item['data']['dryers']) > 0 ?
|
||||
'bold' :
|
||||
'normal',
|
||||
color: parseInt(item['data']['dryers']) > 0 ?
|
||||
ThemeManager.getCurrentThemeVariables().textColor :
|
||||
ThemeManager.getCurrentThemeVariables().listNoteColor
|
||||
}}>
|
||||
{item['data']['dryers']}
|
||||
</Text>
|
||||
<Text>{i18n.t('homeScreen.dashboard.proxiwashSubtitle1')}</Text>
|
||||
<Text style={{
|
||||
fontWeight: parseInt(item['data']['washers']) > 0 ?
|
||||
'bold' :
|
||||
'normal',
|
||||
color: parseInt(item['data']['washers']) > 0 ?
|
||||
ThemeManager.getCurrentThemeVariables().textColor :
|
||||
ThemeManager.getCurrentThemeVariables().listNoteColor
|
||||
}}>
|
||||
{item['data']['washers']}
|
||||
</Text>
|
||||
<Text>{i18n.t('homeScreen.dashboard.proxiwashSubtitle2')}</Text>
|
||||
</Text>;
|
||||
} else
|
||||
subtitle = i18n.t('homeScreen.dashboard.proxiwashSubtitleNA');
|
||||
clickAction = () => this.props.navigation.navigate('Proxiwash');
|
||||
break;
|
||||
case 'today_menu':
|
||||
icon = 'silverware-fork-knife';
|
||||
title = 'Menu du jour';
|
||||
if (item['data'].length === 0)
|
||||
subtitle = 'non disponible';
|
||||
else
|
||||
subtitle = 'Click here to show the menu';
|
||||
color = ThemeManager.getCurrentThemeVariables().menuColor;
|
||||
title = i18n.t('homeScreen.dashboard.menuTitle');
|
||||
isAvailable = item['data'].length > 0;
|
||||
if (isAvailable) {
|
||||
subtitle = i18n.t('homeScreen.dashboard.menuSubtitle');
|
||||
} else
|
||||
subtitle = i18n.t('homeScreen.dashboard.menuSubtitleNA');
|
||||
clickAction = () => this.props.navigation.navigate('SelfMenuScreen');
|
||||
break;
|
||||
}
|
||||
return {
|
||||
icon: icon,
|
||||
color: color,
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
clickAction: clickAction
|
||||
clickAction: clickAction,
|
||||
isAvailable: isAvailable
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,20 +220,46 @@ export default class HomeScreen extends FetchedDataSectionList {
|
|||
<Card style={{
|
||||
flex: 0,
|
||||
marginLeft: 10,
|
||||
marginRight: 10
|
||||
marginRight: 10,
|
||||
borderRadius: 50,
|
||||
backgroundColor: ThemeManager.getCurrentThemeVariables().cardDefaultBg
|
||||
}}>
|
||||
<PlatformTouchable
|
||||
onPress={itemData['clickAction']}
|
||||
style={{
|
||||
zIndex: 100,
|
||||
borderRadius: 50
|
||||
}}
|
||||
>
|
||||
<CardItem>
|
||||
<CardItem style={{
|
||||
borderRadius: 50,
|
||||
backgroundColor: 'transparent'
|
||||
}}>
|
||||
<Left>
|
||||
<CustomMaterialIcon
|
||||
icon={itemData['icon']}
|
||||
color={
|
||||
itemData['isAvailable'] ?
|
||||
itemData['color'] :
|
||||
ThemeManager.getCurrentThemeVariables().textDisabledColor
|
||||
}
|
||||
fontSize={40}
|
||||
width={40}/>
|
||||
<Body>
|
||||
<H3>{itemData['title']}</H3>
|
||||
<Text>{itemData['subtitle']}</Text>
|
||||
<H3 style={{
|
||||
color: itemData['isAvailable'] ?
|
||||
ThemeManager.getCurrentThemeVariables().textColor :
|
||||
ThemeManager.getCurrentThemeVariables().listNoteColor
|
||||
}}>
|
||||
{itemData['title']}
|
||||
</H3>
|
||||
<Text style={{
|
||||
color: itemData['isAvailable'] ?
|
||||
ThemeManager.getCurrentThemeVariables().listNoteColor :
|
||||
ThemeManager.getCurrentThemeVariables().textDisabledColor
|
||||
}}>
|
||||
{itemData['subtitle']}
|
||||
</Text>
|
||||
</Body>
|
||||
</Left>
|
||||
</CardItem>
|
||||
|
|
|
@ -31,7 +31,7 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
|
|||
}
|
||||
|
||||
getKeyExtractor(item: Object) {
|
||||
return item !== undefined ? item.type : undefined;
|
||||
return item !== undefined ? item.type['id'] : undefined;
|
||||
}
|
||||
|
||||
createDataset(fetchedData: Object) {
|
||||
|
|
|
@ -53,7 +53,7 @@ export default class SelfMenuScreen extends FetchedDataSectionList {
|
|||
}
|
||||
|
||||
getKeyExtractor(item: Object) {
|
||||
return item !== undefined ? item.name : undefined;
|
||||
return item !== undefined ? item['date'] + '_' + item['name'] : undefined;
|
||||
}
|
||||
|
||||
hasBackButton() {
|
||||
|
@ -79,12 +79,16 @@ export default class SelfMenuScreen extends FetchedDataSectionList {
|
|||
}
|
||||
// fetched data is an array here
|
||||
for (let i = 0; i < fetchedData.length; i++) {
|
||||
// Add the date to the item to allow creation of unique list id
|
||||
for (let item of fetchedData[i].meal[0].foodcategory) {
|
||||
item['date'] = fetchedData[i]['date'];
|
||||
}
|
||||
result.push(
|
||||
{
|
||||
title: this.getFormattedDate(fetchedData[i].date),
|
||||
data: fetchedData[i].meal[0].foodcategory,
|
||||
extraData: super.state,
|
||||
keyExtractor: this.getKeyExtractor
|
||||
keyExtractor: this.getKeyExtractor,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,23 @@
|
|||
},
|
||||
"homeScreen": {
|
||||
"listUpdated": "List updated!",
|
||||
"listUpdateFail": "Error while updating list"
|
||||
"listUpdateFail": "Error while updating list",
|
||||
"newsFeed": "Campus News",
|
||||
"dashboard": {
|
||||
"todayEventsTitle": "Today's events",
|
||||
"todayEventsSubtitleNA": "No events today",
|
||||
"todayEventsSubtitle": " events today",
|
||||
"proximoTitle": "Proximo",
|
||||
"proximoSubtitleNA": "No articles available",
|
||||
"proximoSubtitle": " articles available",
|
||||
"proxiwashTitle": "Available machines",
|
||||
"proxiwashSubtitleNA": "No machines available",
|
||||
"proxiwashSubtitle1": " dryers and ",
|
||||
"proxiwashSubtitle2": " washers",
|
||||
"menuTitle": "Today's menu",
|
||||
"menuSubtitleNA": "No menu available",
|
||||
"menuSubtitle": "Click here to see the menu"
|
||||
}
|
||||
},
|
||||
"planningScreen": {
|
||||
"wipTitle": "WORK IN PROGRESS",
|
||||
|
|
Loading…
Reference in a new issue