From b27864858bc04f0396200e6811fed3bb0bc07cae Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Mon, 21 Sep 2020 17:15:58 +0200 Subject: [PATCH] Move constant data in constants file --- src/constants/ProxiwashConstants.js | 22 ++++++++++++++ src/screens/Proxiwash/ProxiwashAboutScreen.js | 30 ++----------------- src/screens/Proxiwash/ProxiwashScreen.js | 5 ++-- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/constants/ProxiwashConstants.js b/src/constants/ProxiwashConstants.js index 809936a..011dd44 100644 --- a/src/constants/ProxiwashConstants.js +++ b/src/constants/ProxiwashConstants.js @@ -17,4 +17,26 @@ export default { 5: 'alert', 6: 'help-circle-outline', }, + washinsa: { + id: 'washinsa', + title: 'screens.proxiwash.washinsa.title', + subtitle: 'screens.proxiwash.washinsa.subtitle', + description: 'screens.proxiwash.washinsa.description', + tarif: 'screens.proxiwash.washinsa.tariff', + paymentMethods: 'screens.proxiwash.washinsa.paymentMethods', + icon: 'school-outline', + url: + 'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json', + }, + tripodeB: { + id: 'tripodeB', + title: 'screens.proxiwash.tripodeB.title', + subtitle: 'screens.proxiwash.tripodeB.subtitle', + description: 'screens.proxiwash.tripodeB.description', + tarif: 'screens.proxiwash.tripodeB.tariff', + paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods', + icon: 'domain', + url: + 'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/tripode_b_data.json', + }, }; diff --git a/src/screens/Proxiwash/ProxiwashAboutScreen.js b/src/screens/Proxiwash/ProxiwashAboutScreen.js index 285c661..f47180a 100644 --- a/src/screens/Proxiwash/ProxiwashAboutScreen.js +++ b/src/screens/Proxiwash/ProxiwashAboutScreen.js @@ -6,6 +6,7 @@ import i18n from 'i18n-js'; import {Card, Avatar, Paragraph, Title} from 'react-native-paper'; import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView'; import type {CardTitleIconPropsType} from '../../constants/PaperStyles'; +import ProxiwashConstants from '../../constants/ProxiwashConstants'; const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png'; @@ -20,31 +21,6 @@ export type LaundromatType = { url: string, }; -export const PROXIWASH_DATA = { - washinsa: { - id: 'washinsa', - title: 'screens.proxiwash.washinsa.title', - subtitle: 'screens.proxiwash.washinsa.subtitle', - description: 'screens.proxiwash.washinsa.description', - tarif: 'screens.proxiwash.washinsa.tariff', - paymentMethods: 'screens.proxiwash.washinsa.paymentMethods', - icon: 'school-outline', - url: - 'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json', - }, - tripodeB: { - id: 'tripodeB', - title: 'screens.proxiwash.tripodeB.title', - subtitle: 'screens.proxiwash.tripodeB.subtitle', - description: 'screens.proxiwash.tripodeB.description', - tarif: 'screens.proxiwash.tripodeB.tariff', - paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods', - icon: 'domain', - url: - 'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/tripode_b_data.json', - }, -}; - /** * Class defining the proxiwash about screen. */ @@ -88,9 +64,9 @@ export default class ProxiwashAboutScreen extends React.Component { /> - {ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.washinsa)} + {ProxiwashAboutScreen.getCardItem(ProxiwashConstants.washinsa)} - {ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.tripodeB)} + {ProxiwashAboutScreen.getCardItem(ProxiwashConstants.tripodeB)} { let data: LaundromatType; switch (state.selectedWash) { case 'tripodeB': - data = PROXIWASH_DATA.tripodeB; + data = ProxiwashConstants.tripodeB; break; default: - data = PROXIWASH_DATA.washinsa; + data = ProxiwashConstants.washinsa; } return (