Move constant data in constants file

This commit is contained in:
Arnaud Vergnet 2020-09-21 17:15:58 +02:00
parent 61647ce6ec
commit b27864858b
3 changed files with 27 additions and 30 deletions

View file

@ -17,4 +17,26 @@ export default {
5: 'alert', 5: 'alert',
6: 'help-circle-outline', 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',
},
}; };

View file

@ -6,6 +6,7 @@ import i18n from 'i18n-js';
import {Card, Avatar, Paragraph, Title} from 'react-native-paper'; import {Card, Avatar, Paragraph, Title} from 'react-native-paper';
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
import type {CardTitleIconPropsType} from '../../constants/PaperStyles'; import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
import ProxiwashConstants from '../../constants/ProxiwashConstants';
const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png'; const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png';
@ -20,31 +21,6 @@ export type LaundromatType = {
url: string, 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. * Class defining the proxiwash about screen.
*/ */
@ -88,9 +64,9 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
/> />
</View> </View>
{ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.washinsa)} {ProxiwashAboutScreen.getCardItem(ProxiwashConstants.washinsa)}
{ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.tripodeB)} {ProxiwashAboutScreen.getCardItem(ProxiwashConstants.tripodeB)}
<Card style={{margin: 5}}> <Card style={{margin: 5}}>
<Card.Title <Card.Title

View file

@ -26,7 +26,6 @@ import {
import {MASCOT_STYLE} from '../../components/Mascot/Mascot'; import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
import MascotPopup from '../../components/Mascot/MascotPopup'; import MascotPopup from '../../components/Mascot/MascotPopup';
import type {SectionListDataType} from '../../components/Screens/WebSectionList'; import type {SectionListDataType} from '../../components/Screens/WebSectionList';
import {PROXIWASH_DATA} from './ProxiwashAboutScreen';
import type {LaundromatType} from './ProxiwashAboutScreen'; import type {LaundromatType} from './ProxiwashAboutScreen';
const modalStateStrings = {}; const modalStateStrings = {};
@ -450,10 +449,10 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
let data: LaundromatType; let data: LaundromatType;
switch (state.selectedWash) { switch (state.selectedWash) {
case 'tripodeB': case 'tripodeB':
data = PROXIWASH_DATA.tripodeB; data = ProxiwashConstants.tripodeB;
break; break;
default: default:
data = PROXIWASH_DATA.washinsa; data = ProxiwashConstants.washinsa;
} }
return ( return (
<View <View