Updated home screen to use v2 dashboard

This commit is contained in:
Arnaud Vergnet 2020-07-02 12:13:57 +02:00
parent 5bfc353218
commit 01e3d96ddb

View file

@ -27,7 +27,7 @@ import AvailableWebsites from "../../constants/AvailableWebsites";
const NAME_AMICALE = 'Amicale INSA Toulouse'; const NAME_AMICALE = 'Amicale INSA Toulouse';
const DATA_URL = "https://etud.insa-toulouse.fr/~amicale_app/dashboard/dashboard_data.json"; const DATA_URL = "https://etud.insa-toulouse.fr/~amicale_app/v2/dashboard/dashboard_data.json";
const FEED_ITEM_HEIGHT = 500; const FEED_ITEM_HEIGHT = 500;
const SECTIONS_ID = [ const SECTIONS_ID = [
@ -55,10 +55,8 @@ export type feedItem = {
type fullDashboard = { type fullDashboard = {
today_menu: Array<{ [key: string]: any }>, today_menu: Array<{ [key: string]: any }>,
proximo_articles: number, proximo_articles: number,
available_machines: { available_dryers: number,
dryers: number, available_washers: number,
washers: number,
},
today_events: Array<{ [key: string]: any }>, today_events: Array<{ [key: string]: any }>,
available_tutorials: number, available_tutorials: number,
} }
@ -269,19 +267,19 @@ class HomeScreen extends React.Component<Props, State> {
content: [ content: [
{ {
id: 'washers', id: 'washers',
data: dashboardData == null ? 0 : dashboardData.available_machines.washers, data: dashboardData == null ? 0 : dashboardData.available_washers,
icon: 'washing-machine', icon: 'washing-machine',
color: this.props.theme.colors.proxiwashColor, color: this.props.theme.colors.proxiwashColor,
onPress: this.onProxiwashClick, onPress: this.onProxiwashClick,
isAvailable: dashboardData == null ? false : dashboardData.available_machines.washers > 0 isAvailable: dashboardData == null ? false : dashboardData.available_washers > 0
}, },
{ {
id: 'dryers', id: 'dryers',
data: dashboardData == null ? 0 : dashboardData.available_machines.dryers, data: dashboardData == null ? 0 : dashboardData.available_dryers,
icon: 'tumble-dryer', icon: 'tumble-dryer',
color: this.props.theme.colors.proxiwashColor, color: this.props.theme.colors.proxiwashColor,
onPress: this.onProxiwashClick, onPress: this.onProxiwashClick,
isAvailable: dashboardData == null ? false : dashboardData.available_machines.dryers > 0 isAvailable: dashboardData == null ? false : dashboardData.available_dryers > 0
}, },
{ {
id: 'available_tutorials', id: 'available_tutorials',