diff --git a/components/DashboardItem.js b/components/DashboardItem.js index 780400d..c4840fe 100644 --- a/components/DashboardItem.js +++ b/components/DashboardItem.js @@ -140,8 +140,8 @@ export default class DashboardItem extends React.Component { this.props.color : ThemeManager.getCurrentThemeVariables().textDisabledColor } - fontSize={this.props.isSquare ? 60 : 40} - width={this.props.isSquare ? 60 : 40}/> + fontSize={this.props.isSquare ? 50 : 40} + width={this.props.isSquare ? 50 : 40}/> ); } diff --git a/native-base-theme/variables/platform.js b/native-base-theme/variables/platform.js index 8cdaf83..e8d3062 100644 --- a/native-base-theme/variables/platform.js +++ b/native-base-theme/variables/platform.js @@ -278,6 +278,7 @@ export default { proximoColor: '#ec5904', proxiwashColor: '#1fa5ee', menuColor: '#e91314', + tutorinsaColor: '#f93943', // Other diff --git a/native-base-theme/variables/platformDark.js b/native-base-theme/variables/platformDark.js index 1be2df6..9b70b1c 100644 --- a/native-base-theme/variables/platformDark.js +++ b/native-base-theme/variables/platformDark.js @@ -138,7 +138,7 @@ export default { // Footer footerHeight: 55, - footerDefaultBg: platform === "ios" ? "#F8F8F8" : "#be1522", + footerDefaultBg: platform === "ios" ? "#333333" : "#be1522", footerPaddingBottom: 0, // FooterTab @@ -279,6 +279,7 @@ export default { proximoColor: '#ec5904', proxiwashColor: '#1fa5ee', menuColor: '#b81213', + tutorinsaColor: '#f93943', // Other borderRadiusBase: platform === "ios" ? 5 : 2, diff --git a/screens/HomeScreen.js b/screens/HomeScreen.js index 01f618f..b4f1144 100644 --- a/screens/HomeScreen.js +++ b/screens/HomeScreen.js @@ -9,7 +9,7 @@ import FetchedDataSectionList from "../components/FetchedDataSectionList"; import Autolink from 'react-native-autolink'; import ThemeManager from "../utils/ThemeManager"; import DashboardItem from "../components/DashboardItem"; -// import DATA from "../dashboard_data.json"; +import DATA from "../dashboard_data.json"; const ICON_AMICALE = require('../assets/amicale.png'); @@ -39,7 +39,7 @@ function openWebLink(link) { export default class HomeScreen extends FetchedDataSectionList { constructor() { - super(DATA_URL, REFRESH_TIME); + super('DATA_URL', REFRESH_TIME); } getHeaderTranslation() { @@ -55,7 +55,7 @@ export default class HomeScreen extends FetchedDataSectionList { } createDataset(fetchedData: Object) { - // fetchedData = DATA; + fetchedData = DATA; let newsData = []; let dashboardData = []; if (fetchedData['news_feed'] !== undefined) @@ -83,7 +83,7 @@ export default class HomeScreen extends FetchedDataSectionList { generateDashboardDataset(dashboardData: Object) { let dataset = [ { - id: 'top', + id: 'event', content: undefined }, { @@ -92,7 +92,7 @@ export default class HomeScreen extends FetchedDataSectionList { }, { id: 'bottom', - content: undefined + content: [{}, {}] }, ]; @@ -101,15 +101,19 @@ export default class HomeScreen extends FetchedDataSectionList { case 'today_events': dataset[0]['content'] = value; break; - case 'proximo_articles': + case 'available_machines': dataset[1]['content'][0] = {id: key, data: value}; break; - case 'today_menu': + case 'available_tutorials': dataset[1]['content'][1] = {id: key, data: value}; break; - case 'available_machines': - dataset[2]['content'] = value; + case 'proximo_articles': + dataset[2]['content'][0] = {id: key, data: value}; break; + case 'today_menu': + dataset[2]['content'][1] = {id: key, data: value}; + break; + } } return dataset @@ -147,12 +151,12 @@ export default class HomeScreen extends FetchedDataSectionList { getDashboardItem(item: Object) { let content = item['content']; - if (item['id'] === 'top') + if (item['id'] === 'event') return this.getDashboardEventItem(content); else if (item['id'] === 'middle') return this.getDashboardMiddleItem(content); else - return this.getDashboardProxiwashItem(content); + return this.getDashboardBottomItem(content); } /** @@ -325,7 +329,7 @@ export default class HomeScreen extends FetchedDataSectionList { } - getDashboardMiddleItem(content: Object) { + getDashboardBottomItem(content: Array) { let proximoData = content[0]['data']; let menuData = content[1]['data']; let proximoIcon = 'shopping'; @@ -366,15 +370,6 @@ export default class HomeScreen extends FetchedDataSectionList { marginLeft: 10, marginRight: 10, }}> - proximoClickAction()} - title={proximoTitle} - isAvailable={isProximoAvailable} - isSquareLeft={true}/> menuClickAction()} title={menuTitle} - isAvailable={isMenuAvailable}/> - {/*{this.getSquareDashboardItem(isProximoAvailable, proximoIcon, proximoColor, proximoTitle, proximoSubtitle, proximoClickAction, true)}*/} - {/*{this.getSquareDashboardItem(isMenuAvailable, menuIcon, menuColor, menuTitle, menuSubtitle, menuClickAction, false)}*/} + isAvailable={isMenuAvailable} + isSquareLeft={true}/> + proximoClickAction()} + title={proximoTitle} + isAvailable={isProximoAvailable}/> ); } + getDashboardMiddleItem(content: Array) { + let proxiwashData = content[0]['data']; + let tutorinsaData = content[1]['data']; - getDashboardProxiwashItem(content: Object) { - let icon = 'washing-machine'; - let color = ThemeManager.getCurrentThemeVariables().proxiwashColor; - let title = i18n.t('homeScreen.dashboard.proxiwashTitle'); - let isAvailable = parseInt(content['dryers']) > 0 || parseInt(content['washers']) > 0; - let subtitle; - let dryerColor = parseInt(content['dryers']) > 0 ? + let proxiwashIcon = 'washing-machine'; + let proxiwashColor = ThemeManager.getCurrentThemeVariables().proxiwashColor; + let proxiwashTitle = i18n.t('homeScreen.dashboard.proxiwashTitle'); + let proxiwashIsAvailable = parseInt(proxiwashData['dryers']) > 0 || parseInt(proxiwashData['washers']) > 0; + let proxiwashSubtitle; + let dryerColor = parseInt(proxiwashData['dryers']) > 0 ? ThemeManager.getCurrentThemeVariables().textColor : ThemeManager.getCurrentThemeVariables().listNoteColor; - let washerColor = parseInt(content['washers']) > 0 ? + let washerColor = parseInt(proxiwashData['washers']) > 0 ? ThemeManager.getCurrentThemeVariables().textColor : ThemeManager.getCurrentThemeVariables().listNoteColor; - let availableDryers = content['dryers']; - let availableWashers = content['washers']; - if (isAvailable) { - subtitle = + let availableDryers = proxiwashData['dryers']; + let availableWashers = proxiwashData['washers']; + if (proxiwashIsAvailable) { + proxiwashSubtitle = + + 0 ? + 'bold' : + 'normal', + color: dryerColor + }}> + {availableDryers} + + + { + availableDryers > 1 ? + i18n.t('homeScreen.dashboard.proxiwashSubtitle1Plural') : + i18n.t('homeScreen.dashboard.proxiwashSubtitle1') + } + + {"\n"} + 0 ? + 'bold' : + 'normal', + color: washerColor + }}> + {availableWashers} + + + { + availableWashers > 1 ? + i18n.t('homeScreen.dashboard.proxiwashSubtitle2Plural') : + i18n.t('homeScreen.dashboard.proxiwashSubtitle2') + } + + ; + } else + proxiwashSubtitle = i18n.t('homeScreen.dashboard.proxiwashSubtitleNA'); + let proxiwashClickAction = () => this.props.navigation.navigate('Proxiwash'); + + let tutorinsaIcon = 'school'; + let tutorinsaColor = ThemeManager.getCurrentThemeVariables().tutorinsaColor; + let tutorinsaTitle = 'Tutor\'INSA'; + let tutorinsaIsAvailable = tutorinsaData > 0; + let tutorinsaSubtitle; + if (tutorinsaIsAvailable) { + tutorinsaSubtitle = - 0 ? - 'bold' : - 'normal', - color: dryerColor - }}> - {availableDryers} - + {tutorinsaData} { - availableDryers > 1 ? - i18n.t('homeScreen.dashboard.proxiwashSubtitle1Plural') : - i18n.t('homeScreen.dashboard.proxiwashSubtitle1') - } - - 0 ? - 'bold' : - 'normal', - color: washerColor - }}> - {availableWashers} - - - { - availableWashers > 1 ? - i18n.t('homeScreen.dashboard.proxiwashSubtitle2Plural') : - i18n.t('homeScreen.dashboard.proxiwashSubtitle2') + tutorinsaData > 1 ? + i18n.t('homeScreen.dashboard.tutorinsaSubtitlePlural') : + i18n.t('homeScreen.dashboard.tutorinsaSubtitle') } ; } else - subtitle = i18n.t('homeScreen.dashboard.proxiwashSubtitleNA'); - let clickAction = () => this.props.navigation.navigate('Proxiwash'); + tutorinsaSubtitle = i18n.t('homeScreen.dashboard.tutorinsaSubtitleNA'); + let tutorinsaClickAction = () => this.props.navigation.navigate('TutorInsaScreen'); + return ( - clickAction()} - title={title} - isAvailable={isAvailable}/> + + proxiwashClickAction()} + title={proxiwashTitle} + isAvailable={proxiwashIsAvailable} + isSquareLeft={true}/> + tutorinsaClickAction()} + title={tutorinsaTitle} + isAvailable={tutorinsaIsAvailable}/> + ); } diff --git a/translations/en.json b/translations/en.json index 3fd8c98..a4cf9ea 100644 --- a/translations/en.json +++ b/translations/en.json @@ -80,10 +80,13 @@ "proximoSubtitleNA": "No articles available", "proximoSubtitle": " article available", "proximoSubtitlePlural": " articles available", + "tutorinsaSubtitleNA": "No tutorial available", + "tutorinsaSubtitle": " tutorial available", + "tutorinsaSubtitlePlural": " tutorials available", "proxiwashTitle": "Available machines", "proxiwashSubtitleNA": "No machines available", - "proxiwashSubtitle1": " dryer and ", - "proxiwashSubtitle1Plural": " dryers and ", + "proxiwashSubtitle1": " dryer", + "proxiwashSubtitle1Plural": " dryers", "proxiwashSubtitle2": " washer", "proxiwashSubtitle2Plural": " washers", "menuTitle": "Today's menu", diff --git a/translations/fr.json b/translations/fr.json index 20fbc49..77e9395 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -80,12 +80,15 @@ "proximoSubtitleNA": "pas d'article en vente", "proximoSubtitle": " article disponible", "proximoSubtitlePlural": " articles disponibles", + "tutorinsaSubtitleNA": "Aucun tutorat disponible", + "tutorinsaSubtitle": " tutorat disponible", + "tutorinsaSubtitlePlural": " tutorats disponibles", "proxiwashTitle": "Machines disponibles", "proxiwashSubtitleNA": "Pas de machine disponible", - "proxiwashSubtitle1": " sèches linges et ", - "proxiwashSubtitle1Plural": " sèche linge et ", - "proxiwashSubtitle2": " laves linges", - "proxiwashSubtitle2Plural": " lave linge", + "proxiwashSubtitle1": " sèche-linge", + "proxiwashSubtitle1Plural": " sèche-linges", + "proxiwashSubtitle2": " lave-linge", + "proxiwashSubtitle2Plural": " lave-linges", "menuTitle": "Menu d'aujourd'hui", "menuSubtitleNA": "Pas de menu disponible", "menuSubtitle": "Cliquez ici pour voir le menu" @@ -127,10 +130,10 @@ "paymentMethodsDescription" : "Espèce ou Lydia" }, "proxiwashScreen": { - "dryer": "Sèche Linge", - "dryers": "Sèche Linges", - "washer": "Lave Linge", - "washers": "Lave Linges", + "dryer": "Sèche-Linge", + "dryers": "Sèche-Linges", + "washer": "Lave-Linge", + "washers": "Lave-Linges", "min": "min", "listUpdated": "Etat des machines mis à jour", "listUpdateFail": "Erreur lors de la mise à jour del'état des machines",