forked from vergnet/application-amicale
Changed data source for proximo to use proximo's website
This commit is contained in:
parent
054d8f4a33
commit
ed597bfa8a
5 changed files with 44 additions and 35 deletions
|
@ -27,6 +27,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
|
|||
willFocusSubscription : function;
|
||||
willBlurSubscription : function;
|
||||
refreshInterval: IntervalID;
|
||||
refreshTime: number;
|
||||
|
||||
constructor(fetchUrl: string, refreshTime : number) {
|
||||
super();
|
||||
|
|
|
@ -8,9 +8,6 @@ import Touchable from 'react-native-platform-touchable';
|
|||
import Menu, {MenuItem} from 'react-native-material-menu';
|
||||
import i18n from "i18n-js";
|
||||
|
||||
const IMG_URL = "https://etud.insa-toulouse.fr/~vergnet/appli-amicale/img/";
|
||||
const defaultImage = require('../../assets/image-missing.png');
|
||||
|
||||
const sortMode = {
|
||||
price: "0",
|
||||
name: '1',
|
||||
|
@ -217,16 +214,19 @@ export default class ProximoListScreen extends React.Component<Props, State> {
|
|||
<ListItem
|
||||
thumbnail
|
||||
onPress={() => {
|
||||
console.log(IMG_URL + item.name + '.jpg')
|
||||
console.log(item.image)
|
||||
}}
|
||||
>
|
||||
<Left>
|
||||
<Thumbnail square source={{uri: IMG_URL + item.name + '.jpg'}}/>
|
||||
<Thumbnail square source={{uri: item.image}}/>
|
||||
</Left>
|
||||
<Body>
|
||||
<Text style={{marginLeft: 20}}>
|
||||
{item.name}
|
||||
</Text>
|
||||
<Text note style={{marginLeft: 20}}>
|
||||
{item.quantity + ' ' + i18n.t('proximoScreen.inStock')}
|
||||
</Text>
|
||||
</Body>
|
||||
<Right style={{flex: 1}}>
|
||||
<Text>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {View} from 'react-native'
|
||||
import {Badge, Body, H2, Left, ListItem, Right, Text} from 'native-base';
|
||||
import i18n from "i18n-js";
|
||||
import CustomMaterialIcon from "../../components/CustomMaterialIcon";
|
||||
import FetchedDataSectionList from "../../components/FetchedDataSectionList";
|
||||
|
||||
const DATA_URL = "https://etud.insa-toulouse.fr/~vergnet/appli-amicale/dataProximo.json";
|
||||
const DATA_URL = "https://srv-falcon.etud.insa-toulouse.fr/~proximo/data/stock.json";
|
||||
|
||||
const typesIcons = {
|
||||
Nouveau: "alert-decagram",
|
||||
|
@ -78,33 +79,38 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
|
|||
}
|
||||
|
||||
getRenderItem(item: Object, section : Object, data : Object) {
|
||||
return (
|
||||
<ListItem
|
||||
button
|
||||
thumbnail
|
||||
onPress={() => {
|
||||
this.props.navigation.navigate('ProximoListScreen', item);
|
||||
}}
|
||||
>
|
||||
<Left>
|
||||
<CustomMaterialIcon
|
||||
icon={typesIcons[item.type] ? typesIcons[item.type] : typesIcons.Default}
|
||||
fontSize={30}
|
||||
/>
|
||||
</Left>
|
||||
<Body>
|
||||
<Text>
|
||||
{item.type}
|
||||
</Text>
|
||||
<Badge><Text>
|
||||
{item.data.length} {item.data.length > 1 ? i18n.t('proximoScreen.articles') : i18n.t('proximoScreen.article')}
|
||||
</Text></Badge>
|
||||
</Body>
|
||||
<Right>
|
||||
<CustomMaterialIcon icon="chevron-right"/>
|
||||
</Right>
|
||||
</ListItem>
|
||||
);
|
||||
if (item.data.length > 0) {
|
||||
return (
|
||||
<ListItem
|
||||
button
|
||||
thumbnail
|
||||
onPress={() => {
|
||||
this.props.navigation.navigate('ProximoListScreen', item);
|
||||
}}
|
||||
>
|
||||
<Left>
|
||||
<CustomMaterialIcon
|
||||
icon={typesIcons[item.type] ? typesIcons[item.type] : typesIcons.Default}
|
||||
fontSize={30}
|
||||
/>
|
||||
</Left>
|
||||
<Body>
|
||||
<Text>
|
||||
{item.type}
|
||||
</Text>
|
||||
<Badge><Text>
|
||||
{item.data.length} {item.data.length > 1 ? i18n.t('proximoScreen.articles') : i18n.t('proximoScreen.article')}
|
||||
</Text></Badge>
|
||||
</Body>
|
||||
<Right>
|
||||
<CustomMaterialIcon icon="chevron-right"/>
|
||||
</Right>
|
||||
</ListItem>
|
||||
);
|
||||
} else {
|
||||
return <View/>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getRenderSectionHeader(title: String) {
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
"listUpdated": "Article list updated!",
|
||||
"listUpdateFail": "Error while updating article list",
|
||||
"loading": "Loading...",
|
||||
"listTitle": "Choose a category"
|
||||
"listTitle": "Choose a category",
|
||||
"inStock": "in stock"
|
||||
},
|
||||
"proxiwashScreen": {
|
||||
"dryer": "Dryer",
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
"listUpdated": "Liste d'articles mise à jour !",
|
||||
"listUpdateFail": "Erreur lors de la mise à jour de la list d'articles",
|
||||
"loading": "Chargement...",
|
||||
"listTitle": "Choisissez une catégorie"
|
||||
"listTitle": "Choisissez une catégorie",
|
||||
"inStock": "en stock"
|
||||
},
|
||||
"proxiwashScreen": {
|
||||
"dryer": "Sèche Linge",
|
||||
|
|
Loading…
Reference in a new issue