Changed data source for proximo to use proximo's website

This commit is contained in:
keplyx 2019-08-01 11:04:27 +02:00
parent 054d8f4a33
commit ed597bfa8a
5 changed files with 44 additions and 35 deletions

View file

@ -27,6 +27,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
willFocusSubscription : function; willFocusSubscription : function;
willBlurSubscription : function; willBlurSubscription : function;
refreshInterval: IntervalID; refreshInterval: IntervalID;
refreshTime: number;
constructor(fetchUrl: string, refreshTime : number) { constructor(fetchUrl: string, refreshTime : number) {
super(); super();

View file

@ -8,9 +8,6 @@ import Touchable from 'react-native-platform-touchable';
import Menu, {MenuItem} from 'react-native-material-menu'; import Menu, {MenuItem} from 'react-native-material-menu';
import i18n from "i18n-js"; 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 = { const sortMode = {
price: "0", price: "0",
name: '1', name: '1',
@ -217,16 +214,19 @@ export default class ProximoListScreen extends React.Component<Props, State> {
<ListItem <ListItem
thumbnail thumbnail
onPress={() => { onPress={() => {
console.log(IMG_URL + item.name + '.jpg') console.log(item.image)
}} }}
> >
<Left> <Left>
<Thumbnail square source={{uri: IMG_URL + item.name + '.jpg'}}/> <Thumbnail square source={{uri: item.image}}/>
</Left> </Left>
<Body> <Body>
<Text style={{marginLeft: 20}}> <Text style={{marginLeft: 20}}>
{item.name} {item.name}
</Text> </Text>
<Text note style={{marginLeft: 20}}>
{item.quantity + ' ' + i18n.t('proximoScreen.inStock')}
</Text>
</Body> </Body>
<Right style={{flex: 1}}> <Right style={{flex: 1}}>
<Text> <Text>

View file

@ -1,12 +1,13 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {View} from 'react-native'
import {Badge, Body, H2, Left, ListItem, Right, Text} from 'native-base'; import {Badge, Body, H2, Left, ListItem, Right, Text} from 'native-base';
import i18n from "i18n-js"; import i18n from "i18n-js";
import CustomMaterialIcon from "../../components/CustomMaterialIcon"; import CustomMaterialIcon from "../../components/CustomMaterialIcon";
import FetchedDataSectionList from "../../components/FetchedDataSectionList"; 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 = { const typesIcons = {
Nouveau: "alert-decagram", Nouveau: "alert-decagram",
@ -78,6 +79,7 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
} }
getRenderItem(item: Object, section : Object, data : Object) { getRenderItem(item: Object, section : Object, data : Object) {
if (item.data.length > 0) {
return ( return (
<ListItem <ListItem
button button
@ -105,6 +107,10 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
</Right> </Right>
</ListItem> </ListItem>
); );
} else {
return <View/>;
}
} }
getRenderSectionHeader(title: String) { getRenderSectionHeader(title: String) {

View file

@ -49,7 +49,8 @@
"listUpdated": "Article list updated!", "listUpdated": "Article list updated!",
"listUpdateFail": "Error while updating article list", "listUpdateFail": "Error while updating article list",
"loading": "Loading...", "loading": "Loading...",
"listTitle": "Choose a category" "listTitle": "Choose a category",
"inStock": "in stock"
}, },
"proxiwashScreen": { "proxiwashScreen": {
"dryer": "Dryer", "dryer": "Dryer",

View file

@ -49,7 +49,8 @@
"listUpdated": "Liste d'articles mise à jour !", "listUpdated": "Liste d'articles mise à jour !",
"listUpdateFail": "Erreur lors de la mise à jour de la list d'articles", "listUpdateFail": "Erreur lors de la mise à jour de la list d'articles",
"loading": "Chargement...", "loading": "Chargement...",
"listTitle": "Choisissez une catégorie" "listTitle": "Choisissez une catégorie",
"inStock": "en stock"
}, },
"proxiwashScreen": { "proxiwashScreen": {
"dryer": "Sèche Linge", "dryer": "Sèche Linge",