From e72196812e07c321f6453927dd70a33fba2bd3d3 Mon Sep 17 00:00:00 2001 From: keplyx Date: Thu, 30 Jan 2020 18:58:23 +0100 Subject: [PATCH] Moved about screen in sidemenu, fixed warnings --- components/Sidebar.js | 15 +- screens/About/AboutDependenciesScreen.js | 34 ++-- screens/About/AboutScreen.js | 196 ++++++++++++++--------- screens/SettingsScreen.js | 15 +- translations/en.json | 5 +- translations/fr.json | 5 +- 6 files changed, 155 insertions(+), 115 deletions(-) diff --git a/components/Sidebar.js b/components/Sidebar.js index cb744fa..f4acf73 100644 --- a/components/Sidebar.js +++ b/components/Sidebar.js @@ -65,15 +65,15 @@ export default class SideBar extends React.Component { route: "TutorInsaScreen", icon: "school", }, - { - name: "Mails BlueMind", - route: "BlueMindScreen", - icon: "email", - }, { name: i18n.t('sidenav.divider2'), route: "Divider2" }, + { + name: i18n.t('screens.bluemind'), + route: "BlueMindScreen", + icon: "email", + }, { name: i18n.t('screens.availableRooms'), route: "AvailableRoomScreen", @@ -93,6 +93,11 @@ export default class SideBar extends React.Component { route: "SettingsScreen", icon: "settings", }, + { + name: i18n.t('screens.about'), + route: "AboutScreen", + icon: "information", + }, ]; } diff --git a/screens/About/AboutDependenciesScreen.js b/screens/About/AboutDependenciesScreen.js index 1178152..93f5435 100644 --- a/screens/About/AboutDependenciesScreen.js +++ b/screens/About/AboutDependenciesScreen.js @@ -31,24 +31,22 @@ export default class AboutDependenciesScreen extends React.Component { return ( - - item.name} - style={{minHeight: 300, width: '100%'}} - renderItem={({item}) => - - - - {item.name} - - - {item.version.replace('^', '')} - - - } - /> - + item.name} + style={{minHeight: 300, width: '100%'}} + renderItem={({item}) => + + + + {item.name} + + + {item.version.replace('^', '')} + + + } + /> ); } diff --git a/screens/About/AboutScreen.js b/screens/About/AboutScreen.js index ee5457b..6ffafb8 100644 --- a/screens/About/AboutScreen.js +++ b/screens/About/AboutScreen.js @@ -185,6 +185,107 @@ export default class AboutScreen extends React.Component { }, ]; + dataOrder: Array = [ + { + id: 'app', + }, + { + id: 'team', + }, + { + id: 'techno', + }, + ]; + + getAppCard() { + return ( + + + + + +

{appJson.expo.name}

+ + v.{appJson.expo.version} + + +
+
+ item.icon} + listKey={(item) => "app"} + renderItem={({item}) => + this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) + } + /> +
+ ); + } + + getTeamCard() { + return ( + + + + + +

{i18n.t('aboutScreen.team')}

+ +
+
+ + {i18n.t('aboutScreen.author')} + + item.icon} + listKey={(item) => "team1"} + renderItem={({item}) => + this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) + } + /> + + {i18n.t('aboutScreen.additionalDev')} + + item.icon} + listKey={(item) => "team2"} + renderItem={({item}) => + this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) + } + /> +
+ ); + } + + getTechnoCard() { + return ( + + + {i18n.t('aboutScreen.technologies')} + + item.icon} + listKey={(item) => "techno"} + renderItem={({item}) => + this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) + } + /> + + ); + } + /** * Get a clickable card item to be rendered inside a card. * @@ -284,86 +385,33 @@ export default class AboutScreen extends React.Component { } } + getMainCard(item: Object) { + switch (item.id) { + case 'app': + return this.getAppCard(); + case 'team': + return this.getTeamCard(); + case 'techno': + return this.getTechnoCard(); + } + return ; + } + render() { const nav = this.props.navigation; return ( {this.getBugReportModal()} - - - - - - -

{appJson.expo.name}

- - v.{appJson.expo.version} - - -
-
- item.icon} - renderItem={({item}) => - this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) - } - /> -
- - - - - - -

{i18n.t('aboutScreen.team')}

- -
-
- - {i18n.t('aboutScreen.author')} - - item.icon} - renderItem={({item}) => - this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) - } - /> - - {i18n.t('aboutScreen.additionalDev')} - - item.icon} - renderItem={({item}) => - this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) - } - /> -
- - - - {i18n.t('aboutScreen.technologies')} - - item.icon} - renderItem={({item}) => - this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug) - } - /> - -
+ item.id} + renderItem={({item}) => + this.getMainCard(item) + } + />
); } diff --git a/screens/SettingsScreen.js b/screens/SettingsScreen.js index 89e9a12..c92d722 100644 --- a/screens/SettingsScreen.js +++ b/screens/SettingsScreen.js @@ -212,24 +212,11 @@ export default class SettingsScreen extends React.Component { ); } - getRightButton() { - return ( - this.props.navigation.navigate('AboutScreen')}> - - - ); - } - render() { const nav = this.props.navigation; return ( - + diff --git a/translations/en.json b/translations/en.json index e9413df..0f22092 100644 --- a/translations/en.json +++ b/translations/en.json @@ -7,12 +7,13 @@ "menuSelf": "RU Menu", "settings": "Settings", "availableRooms": "Available rooms", + "bluemind": "INSA Mails", "about": "About", "debug": "Debug" }, "sidenav": { - "divider1": "Nice websites", - "divider2": "Useful services", + "divider1": "Useful websites", + "divider2": "Services", "divider3": "Personalisation" }, "intro": { diff --git a/translations/fr.json b/translations/fr.json index ca0c0ea..21abadb 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -7,12 +7,13 @@ "menuSelf": "Menu du RU", "settings": "Paramètres", "availableRooms": "Salles dispo", + "bluemind": "Mails INSA", "about": "À Propos", "debug": "Debug" }, "sidenav": { - "divider1": "Sites bien", - "divider2": "Services utiles", + "divider1": "Sites utiles", + "divider2": "Services", "divider3": "Personnalisation" }, "intro": {