diff --git a/native-base-theme/variables/platform.js b/native-base-theme/variables/platform.js index 20bb3f9..5e2e13d 100644 --- a/native-base-theme/variables/platform.js +++ b/native-base-theme/variables/platform.js @@ -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), diff --git a/native-base-theme/variables/platformDark.js b/native-base-theme/variables/platformDark.js index 3b8291e..80cf361 100644 --- a/native-base-theme/variables/platformDark.js +++ b/native-base-theme/variables/platformDark.js @@ -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, diff --git a/screens/HomeScreen.js b/screens/HomeScreen.js index 1a13a40..88bc9af 100644 --- a/screens/HomeScreen.js +++ b/screens/HomeScreen.js @@ -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 = + + {item['data'].length} + {i18n.t('homeScreen.dashboard.todayEventsSubtitle')} + ; + } 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 = + + {item['data']} + {i18n.t('homeScreen.dashboard.proximoSubtitle')} + ; + } 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 = + + 0 ? + 'bold' : + 'normal', + color: parseInt(item['data']['dryers']) > 0 ? + ThemeManager.getCurrentThemeVariables().textColor : + ThemeManager.getCurrentThemeVariables().listNoteColor + }}> + {item['data']['dryers']} + + {i18n.t('homeScreen.dashboard.proxiwashSubtitle1')} + 0 ? + 'bold' : + 'normal', + color: parseInt(item['data']['washers']) > 0 ? + ThemeManager.getCurrentThemeVariables().textColor : + ThemeManager.getCurrentThemeVariables().listNoteColor + }}> + {item['data']['washers']} + + {i18n.t('homeScreen.dashboard.proxiwashSubtitle2')} + ; + } 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 { - + -

{itemData['title']}

- {itemData['subtitle']} +

+ {itemData['title']} +

+ + {itemData['subtitle']} +
diff --git a/screens/Proximo/ProximoMainScreen.js b/screens/Proximo/ProximoMainScreen.js index c91dca4..de8ec2f 100644 --- a/screens/Proximo/ProximoMainScreen.js +++ b/screens/Proximo/ProximoMainScreen.js @@ -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) { diff --git a/screens/SelfMenuScreen.js b/screens/SelfMenuScreen.js index 7c7060b..b628b4d 100644 --- a/screens/SelfMenuScreen.js +++ b/screens/SelfMenuScreen.js @@ -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, } ); } diff --git a/translations/en.json b/translations/en.json index 321bc6c..671781b 100644 --- a/translations/en.json +++ b/translations/en.json @@ -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",