diff --git a/components/FetchedDataSectionList.js b/components/FetchedDataSectionList.js
index 0a857d3..8473715 100644
--- a/components/FetchedDataSectionList.js
+++ b/components/FetchedDataSectionList.js
@@ -168,7 +168,7 @@ export default class FetchedDataSectionList extends React.Component;
}
@@ -268,6 +268,10 @@ export default class FetchedDataSectionList extends React.Component
}
+ hasStickyHeader() {
+ return false;
+ }
+
/**
* Get the section list render using the generated dataset
*
@@ -281,7 +285,7 @@ export default class FetchedDataSectionList extends React.Component;
+ } else {
+ return (
+
+ {title}
+
+ );
+ }
+ }
+
+ getDashboardItemData(item: Object) {
+ let icon = '';
+ let title = '';
+ let subtitle = '';
+ let clickAction;
+ switch (item['id']) {
+ case 'today_events':
+ icon = 'calendar-range';
+ title = 'Today\s events';
+ if (item['data'].length === 0)
+ subtitle = 'Pas d\'event ajd';
+ else
+ subtitle = item['data'].length + ' events ajd';
+ clickAction = () => this.props.navigation.navigate('Planning');
+ break;
+ case 'proximo_articles':
+ icon = 'shopping';
+ title = 'Proximo';
+ subtitle = item['data'] + ' articles disponibles';
+ clickAction = () => this.props.navigation.navigate('Proximo');
+ break;
+ case 'available_machines':
+ icon = 'washing-machine';
+ title = 'Machines disponibles';
+ subtitle = item['data']['dryers'] + ' dryers and ' + item['data']['washers'] + ' washers.';
+ clickAction = () => this.props.navigation.navigate('Proxiwash');
+ break;
+ case 'today_menu':
+ icon = 'silverware-fork-knife';
+ title = 'Menu du jour';
+ if (item['data'].length === 0)
+ subtitle = 'non disponible';
+ else
+ subtitle = 'Click here to show the menu';
+ clickAction = () => this.props.navigation.navigate('SelfMenuScreen');
+ break;
+ }
+ return {
+ icon: icon,
+ title: title,
+ subtitle: subtitle,
+ clickAction: clickAction
+ }
+ }
+
+
getRenderItem(item: Object, section: Object, data: Object) {
- return (
-
-
-
-
+ if (section['id'] === SECTIONS_ID[0]) {
+ let itemData = this.getDashboardItemData(item);
+ return (
+
+
+
+
+
+
+ {itemData['title']}
+ {itemData['subtitle']}
+
+
+
+
+
+ );
+ } else {
+ return (
+
+
+
+
+
+ {NAME_AMICALE}
+ {HomeScreen.getFormattedDate(item.created_time)}
+
+
+
+
- {NAME_AMICALE}
- {HomeScreen.getFormattedDate(item.created_time)}
+ {item.full_picture !== '' && item.full_picture !== undefined ?
+ openWebLink(item.full_picture)}
+ style={{width: '100%', height: 250}}>
+
+
+ : }
+ {item.message !== undefined ?
+ :
+ }
-
-
-
-
- {item.full_picture !== '' && item.full_picture !== undefined ?
- openWebLink(item.full_picture)}
- style={{width: '100%', height: 250}}>
-
-
- : }
- {item.message !== undefined ?
- :
- }
-
-
-
-
-
-
-
-
- );
+
+
+
+
+
+
+
+ );
+ }
}
}
diff --git a/screens/SelfMenuScreen.js b/screens/SelfMenuScreen.js
index 46c50e9..7c7060b 100644
--- a/screens/SelfMenuScreen.js
+++ b/screens/SelfMenuScreen.js
@@ -60,6 +60,10 @@ export default class SelfMenuScreen extends FetchedDataSectionList {
return true;
}
+ hasStickyHeader(): boolean {
+ return true;
+ }
+
createDataset(fetchedData: Object) {
let result = [];
// Prevent crash by giving a default value when fetchedData is empty (not yet available)
@@ -94,7 +98,7 @@ export default class SelfMenuScreen extends FetchedDataSectionList {
return this.daysOfWeek[date.getDay() - 1] + " " + date.getDate() + " " + this.monthsOfYear[date.getMonth()] + " " + date.getFullYear();
}
- getRenderSectionHeader(title: String) {
+ getRenderSectionHeader(title: string) {
return (