|
@@ -1,12 +1,13 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
3
|
import * as React from 'react';
|
|
4
|
+import {View} from 'react-native'
|
4
|
5
|
import {Badge, Body, H2, Left, ListItem, Right, Text} from 'native-base';
|
5
|
6
|
import i18n from "i18n-js";
|
6
|
7
|
import CustomMaterialIcon from "../../components/CustomMaterialIcon";
|
7
|
8
|
import FetchedDataSectionList from "../../components/FetchedDataSectionList";
|
8
|
9
|
|
9
|
|
-const DATA_URL = "https://etud.insa-toulouse.fr/~vergnet/appli-amicale/dataProximo.json";
|
|
10
|
+const DATA_URL = "https://srv-falcon.etud.insa-toulouse.fr/~proximo/data/stock.json";
|
10
|
11
|
|
11
|
12
|
const typesIcons = {
|
12
|
13
|
Nouveau: "alert-decagram",
|
|
@@ -78,33 +79,38 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
|
78
|
79
|
}
|
79
|
80
|
|
80
|
81
|
getRenderItem(item: Object, section : Object, data : Object) {
|
81
|
|
- return (
|
82
|
|
- <ListItem
|
83
|
|
- button
|
84
|
|
- thumbnail
|
85
|
|
- onPress={() => {
|
86
|
|
- this.props.navigation.navigate('ProximoListScreen', item);
|
87
|
|
- }}
|
88
|
|
- >
|
89
|
|
- <Left>
|
90
|
|
- <CustomMaterialIcon
|
91
|
|
- icon={typesIcons[item.type] ? typesIcons[item.type] : typesIcons.Default}
|
92
|
|
- fontSize={30}
|
93
|
|
- />
|
94
|
|
- </Left>
|
95
|
|
- <Body>
|
96
|
|
- <Text>
|
97
|
|
- {item.type}
|
98
|
|
- </Text>
|
99
|
|
- <Badge><Text>
|
100
|
|
- {item.data.length} {item.data.length > 1 ? i18n.t('proximoScreen.articles') : i18n.t('proximoScreen.article')}
|
101
|
|
- </Text></Badge>
|
102
|
|
- </Body>
|
103
|
|
- <Right>
|
104
|
|
- <CustomMaterialIcon icon="chevron-right"/>
|
105
|
|
- </Right>
|
106
|
|
- </ListItem>
|
107
|
|
- );
|
|
82
|
+ if (item.data.length > 0) {
|
|
83
|
+ return (
|
|
84
|
+ <ListItem
|
|
85
|
+ button
|
|
86
|
+ thumbnail
|
|
87
|
+ onPress={() => {
|
|
88
|
+ this.props.navigation.navigate('ProximoListScreen', item);
|
|
89
|
+ }}
|
|
90
|
+ >
|
|
91
|
+ <Left>
|
|
92
|
+ <CustomMaterialIcon
|
|
93
|
+ icon={typesIcons[item.type] ? typesIcons[item.type] : typesIcons.Default}
|
|
94
|
+ fontSize={30}
|
|
95
|
+ />
|
|
96
|
+ </Left>
|
|
97
|
+ <Body>
|
|
98
|
+ <Text>
|
|
99
|
+ {item.type}
|
|
100
|
+ </Text>
|
|
101
|
+ <Badge><Text>
|
|
102
|
+ {item.data.length} {item.data.length > 1 ? i18n.t('proximoScreen.articles') : i18n.t('proximoScreen.article')}
|
|
103
|
+ </Text></Badge>
|
|
104
|
+ </Body>
|
|
105
|
+ <Right>
|
|
106
|
+ <CustomMaterialIcon icon="chevron-right"/>
|
|
107
|
+ </Right>
|
|
108
|
+ </ListItem>
|
|
109
|
+ );
|
|
110
|
+ } else {
|
|
111
|
+ return <View/>;
|
|
112
|
+ }
|
|
113
|
+
|
108
|
114
|
}
|
109
|
115
|
|
110
|
116
|
getRenderSectionHeader(title: String) {
|