forked from vergnet/application-amicale
Added tutorinsa to the dashboard + reworked item organization
This commit is contained in:
parent
e419626c43
commit
f3d1c705ae
6 changed files with 135 additions and 84 deletions
|
@ -140,8 +140,8 @@ export default class DashboardItem extends React.Component<Props> {
|
||||||
this.props.color :
|
this.props.color :
|
||||||
ThemeManager.getCurrentThemeVariables().textDisabledColor
|
ThemeManager.getCurrentThemeVariables().textDisabledColor
|
||||||
}
|
}
|
||||||
fontSize={this.props.isSquare ? 60 : 40}
|
fontSize={this.props.isSquare ? 50 : 40}
|
||||||
width={this.props.isSquare ? 60 : 40}/>
|
width={this.props.isSquare ? 50 : 40}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,7 @@ export default {
|
||||||
proximoColor: '#ec5904',
|
proximoColor: '#ec5904',
|
||||||
proxiwashColor: '#1fa5ee',
|
proxiwashColor: '#1fa5ee',
|
||||||
menuColor: '#e91314',
|
menuColor: '#e91314',
|
||||||
|
tutorinsaColor: '#f93943',
|
||||||
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|
|
@ -138,7 +138,7 @@ export default {
|
||||||
|
|
||||||
// Footer
|
// Footer
|
||||||
footerHeight: 55,
|
footerHeight: 55,
|
||||||
footerDefaultBg: platform === "ios" ? "#F8F8F8" : "#be1522",
|
footerDefaultBg: platform === "ios" ? "#333333" : "#be1522",
|
||||||
footerPaddingBottom: 0,
|
footerPaddingBottom: 0,
|
||||||
|
|
||||||
// FooterTab
|
// FooterTab
|
||||||
|
@ -279,6 +279,7 @@ export default {
|
||||||
proximoColor: '#ec5904',
|
proximoColor: '#ec5904',
|
||||||
proxiwashColor: '#1fa5ee',
|
proxiwashColor: '#1fa5ee',
|
||||||
menuColor: '#b81213',
|
menuColor: '#b81213',
|
||||||
|
tutorinsaColor: '#f93943',
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
borderRadiusBase: platform === "ios" ? 5 : 2,
|
borderRadiusBase: platform === "ios" ? 5 : 2,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import FetchedDataSectionList from "../components/FetchedDataSectionList";
|
||||||
import Autolink from 'react-native-autolink';
|
import Autolink from 'react-native-autolink';
|
||||||
import ThemeManager from "../utils/ThemeManager";
|
import ThemeManager from "../utils/ThemeManager";
|
||||||
import DashboardItem from "../components/DashboardItem";
|
import DashboardItem from "../components/DashboardItem";
|
||||||
// import DATA from "../dashboard_data.json";
|
import DATA from "../dashboard_data.json";
|
||||||
|
|
||||||
|
|
||||||
const ICON_AMICALE = require('../assets/amicale.png');
|
const ICON_AMICALE = require('../assets/amicale.png');
|
||||||
|
@ -39,7 +39,7 @@ function openWebLink(link) {
|
||||||
export default class HomeScreen extends FetchedDataSectionList {
|
export default class HomeScreen extends FetchedDataSectionList {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(DATA_URL, REFRESH_TIME);
|
super('DATA_URL', REFRESH_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeaderTranslation() {
|
getHeaderTranslation() {
|
||||||
|
@ -55,7 +55,7 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
}
|
}
|
||||||
|
|
||||||
createDataset(fetchedData: Object) {
|
createDataset(fetchedData: Object) {
|
||||||
// fetchedData = DATA;
|
fetchedData = DATA;
|
||||||
let newsData = [];
|
let newsData = [];
|
||||||
let dashboardData = [];
|
let dashboardData = [];
|
||||||
if (fetchedData['news_feed'] !== undefined)
|
if (fetchedData['news_feed'] !== undefined)
|
||||||
|
@ -83,7 +83,7 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
generateDashboardDataset(dashboardData: Object) {
|
generateDashboardDataset(dashboardData: Object) {
|
||||||
let dataset = [
|
let dataset = [
|
||||||
{
|
{
|
||||||
id: 'top',
|
id: 'event',
|
||||||
content: undefined
|
content: undefined
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'bottom',
|
id: 'bottom',
|
||||||
content: undefined
|
content: [{}, {}]
|
||||||
},
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -101,15 +101,19 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
case 'today_events':
|
case 'today_events':
|
||||||
dataset[0]['content'] = value;
|
dataset[0]['content'] = value;
|
||||||
break;
|
break;
|
||||||
case 'proximo_articles':
|
case 'available_machines':
|
||||||
dataset[1]['content'][0] = {id: key, data: value};
|
dataset[1]['content'][0] = {id: key, data: value};
|
||||||
break;
|
break;
|
||||||
case 'today_menu':
|
case 'available_tutorials':
|
||||||
dataset[1]['content'][1] = {id: key, data: value};
|
dataset[1]['content'][1] = {id: key, data: value};
|
||||||
break;
|
break;
|
||||||
case 'available_machines':
|
case 'proximo_articles':
|
||||||
dataset[2]['content'] = value;
|
dataset[2]['content'][0] = {id: key, data: value};
|
||||||
break;
|
break;
|
||||||
|
case 'today_menu':
|
||||||
|
dataset[2]['content'][1] = {id: key, data: value};
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dataset
|
return dataset
|
||||||
|
@ -147,12 +151,12 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
|
|
||||||
getDashboardItem(item: Object) {
|
getDashboardItem(item: Object) {
|
||||||
let content = item['content'];
|
let content = item['content'];
|
||||||
if (item['id'] === 'top')
|
if (item['id'] === 'event')
|
||||||
return this.getDashboardEventItem(content);
|
return this.getDashboardEventItem(content);
|
||||||
else if (item['id'] === 'middle')
|
else if (item['id'] === 'middle')
|
||||||
return this.getDashboardMiddleItem(content);
|
return this.getDashboardMiddleItem(content);
|
||||||
else
|
else
|
||||||
return this.getDashboardProxiwashItem(content);
|
return this.getDashboardBottomItem(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -325,7 +329,7 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getDashboardMiddleItem(content: Object) {
|
getDashboardBottomItem(content: Array<Object>) {
|
||||||
let proximoData = content[0]['data'];
|
let proximoData = content[0]['data'];
|
||||||
let menuData = content[1]['data'];
|
let menuData = content[1]['data'];
|
||||||
let proximoIcon = 'shopping';
|
let proximoIcon = 'shopping';
|
||||||
|
@ -366,15 +370,6 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
marginRight: 10,
|
marginRight: 10,
|
||||||
}}>
|
}}>
|
||||||
<DashboardItem
|
|
||||||
isSquare={true}
|
|
||||||
subtitle={proximoSubtitle}
|
|
||||||
color={proximoColor}
|
|
||||||
icon={proximoIcon}
|
|
||||||
clickAction={() => proximoClickAction()}
|
|
||||||
title={proximoTitle}
|
|
||||||
isAvailable={isProximoAvailable}
|
|
||||||
isSquareLeft={true}/>
|
|
||||||
<DashboardItem
|
<DashboardItem
|
||||||
isSquare={true}
|
isSquare={true}
|
||||||
subtitle={menuSubtitle}
|
subtitle={menuSubtitle}
|
||||||
|
@ -382,73 +377,121 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
icon={menuIcon}
|
icon={menuIcon}
|
||||||
clickAction={() => menuClickAction()}
|
clickAction={() => menuClickAction()}
|
||||||
title={menuTitle}
|
title={menuTitle}
|
||||||
isAvailable={isMenuAvailable}/>
|
isAvailable={isMenuAvailable}
|
||||||
{/*{this.getSquareDashboardItem(isProximoAvailable, proximoIcon, proximoColor, proximoTitle, proximoSubtitle, proximoClickAction, true)}*/}
|
isSquareLeft={true}/>
|
||||||
{/*{this.getSquareDashboardItem(isMenuAvailable, menuIcon, menuColor, menuTitle, menuSubtitle, menuClickAction, false)}*/}
|
<DashboardItem
|
||||||
|
isSquare={true}
|
||||||
|
subtitle={proximoSubtitle}
|
||||||
|
color={proximoColor}
|
||||||
|
icon={proximoIcon}
|
||||||
|
clickAction={() => proximoClickAction()}
|
||||||
|
title={proximoTitle}
|
||||||
|
isAvailable={isProximoAvailable}/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDashboardMiddleItem(content: Array<Object>) {
|
||||||
|
let proxiwashData = content[0]['data'];
|
||||||
|
let tutorinsaData = content[1]['data'];
|
||||||
|
|
||||||
getDashboardProxiwashItem(content: Object) {
|
let proxiwashIcon = 'washing-machine';
|
||||||
let icon = 'washing-machine';
|
let proxiwashColor = ThemeManager.getCurrentThemeVariables().proxiwashColor;
|
||||||
let color = ThemeManager.getCurrentThemeVariables().proxiwashColor;
|
let proxiwashTitle = i18n.t('homeScreen.dashboard.proxiwashTitle');
|
||||||
let title = i18n.t('homeScreen.dashboard.proxiwashTitle');
|
let proxiwashIsAvailable = parseInt(proxiwashData['dryers']) > 0 || parseInt(proxiwashData['washers']) > 0;
|
||||||
let isAvailable = parseInt(content['dryers']) > 0 || parseInt(content['washers']) > 0;
|
let proxiwashSubtitle;
|
||||||
let subtitle;
|
let dryerColor = parseInt(proxiwashData['dryers']) > 0 ?
|
||||||
let dryerColor = parseInt(content['dryers']) > 0 ?
|
|
||||||
ThemeManager.getCurrentThemeVariables().textColor :
|
ThemeManager.getCurrentThemeVariables().textColor :
|
||||||
ThemeManager.getCurrentThemeVariables().listNoteColor;
|
ThemeManager.getCurrentThemeVariables().listNoteColor;
|
||||||
let washerColor = parseInt(content['washers']) > 0 ?
|
let washerColor = parseInt(proxiwashData['washers']) > 0 ?
|
||||||
ThemeManager.getCurrentThemeVariables().textColor :
|
ThemeManager.getCurrentThemeVariables().textColor :
|
||||||
ThemeManager.getCurrentThemeVariables().listNoteColor;
|
ThemeManager.getCurrentThemeVariables().listNoteColor;
|
||||||
let availableDryers = content['dryers'];
|
let availableDryers = proxiwashData['dryers'];
|
||||||
let availableWashers = content['washers'];
|
let availableWashers = proxiwashData['washers'];
|
||||||
if (isAvailable) {
|
if (proxiwashIsAvailable) {
|
||||||
subtitle =
|
proxiwashSubtitle =
|
||||||
|
<Text>
|
||||||
|
<Text style={{
|
||||||
|
fontWeight: parseInt(proxiwashData['dryers']) > 0 ?
|
||||||
|
'bold' :
|
||||||
|
'normal',
|
||||||
|
color: dryerColor
|
||||||
|
}}>
|
||||||
|
{availableDryers}
|
||||||
|
</Text>
|
||||||
|
<Text>
|
||||||
|
{
|
||||||
|
availableDryers > 1 ?
|
||||||
|
i18n.t('homeScreen.dashboard.proxiwashSubtitle1Plural') :
|
||||||
|
i18n.t('homeScreen.dashboard.proxiwashSubtitle1')
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
{"\n"}
|
||||||
|
<Text style={{
|
||||||
|
fontWeight: parseInt(proxiwashData['washers']) > 0 ?
|
||||||
|
'bold' :
|
||||||
|
'normal',
|
||||||
|
color: washerColor
|
||||||
|
}}>
|
||||||
|
{availableWashers}
|
||||||
|
</Text>
|
||||||
|
<Text>
|
||||||
|
{
|
||||||
|
availableWashers > 1 ?
|
||||||
|
i18n.t('homeScreen.dashboard.proxiwashSubtitle2Plural') :
|
||||||
|
i18n.t('homeScreen.dashboard.proxiwashSubtitle2')
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
</Text>;
|
||||||
|
} else
|
||||||
|
proxiwashSubtitle = i18n.t('homeScreen.dashboard.proxiwashSubtitleNA');
|
||||||
|
let proxiwashClickAction = () => this.props.navigation.navigate('Proxiwash');
|
||||||
|
|
||||||
|
let tutorinsaIcon = 'school';
|
||||||
|
let tutorinsaColor = ThemeManager.getCurrentThemeVariables().tutorinsaColor;
|
||||||
|
let tutorinsaTitle = 'Tutor\'INSA';
|
||||||
|
let tutorinsaIsAvailable = tutorinsaData > 0;
|
||||||
|
let tutorinsaSubtitle;
|
||||||
|
if (tutorinsaIsAvailable) {
|
||||||
|
tutorinsaSubtitle =
|
||||||
<Text>
|
<Text>
|
||||||
<Text style={{
|
<Text style={{fontWeight: "bold"}}>{tutorinsaData}</Text>
|
||||||
fontWeight: parseInt(content['dryers']) > 0 ?
|
|
||||||
'bold' :
|
|
||||||
'normal',
|
|
||||||
color: dryerColor
|
|
||||||
}}>
|
|
||||||
{availableDryers}
|
|
||||||
</Text>
|
|
||||||
<Text>
|
<Text>
|
||||||
{
|
{
|
||||||
availableDryers > 1 ?
|
tutorinsaData > 1 ?
|
||||||
i18n.t('homeScreen.dashboard.proxiwashSubtitle1Plural') :
|
i18n.t('homeScreen.dashboard.tutorinsaSubtitlePlural') :
|
||||||
i18n.t('homeScreen.dashboard.proxiwashSubtitle1')
|
i18n.t('homeScreen.dashboard.tutorinsaSubtitle')
|
||||||
}
|
|
||||||
</Text>
|
|
||||||
<Text style={{
|
|
||||||
fontWeight: parseInt(content['washers']) > 0 ?
|
|
||||||
'bold' :
|
|
||||||
'normal',
|
|
||||||
color: washerColor
|
|
||||||
}}>
|
|
||||||
{availableWashers}
|
|
||||||
</Text>
|
|
||||||
<Text>
|
|
||||||
{
|
|
||||||
availableWashers > 1 ?
|
|
||||||
i18n.t('homeScreen.dashboard.proxiwashSubtitle2Plural') :
|
|
||||||
i18n.t('homeScreen.dashboard.proxiwashSubtitle2')
|
|
||||||
}
|
}
|
||||||
</Text>
|
</Text>
|
||||||
</Text>;
|
</Text>;
|
||||||
} else
|
} else
|
||||||
subtitle = i18n.t('homeScreen.dashboard.proxiwashSubtitleNA');
|
tutorinsaSubtitle = i18n.t('homeScreen.dashboard.tutorinsaSubtitleNA');
|
||||||
let clickAction = () => this.props.navigation.navigate('Proxiwash');
|
let tutorinsaClickAction = () => this.props.navigation.navigate('TutorInsaScreen');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardItem
|
<View style={{
|
||||||
subtitle={subtitle}
|
flexDirection: 'row',
|
||||||
color={color}
|
marginLeft: 10,
|
||||||
icon={icon}
|
marginRight: 10,
|
||||||
clickAction={() => clickAction()}
|
}}>
|
||||||
title={title}
|
<DashboardItem
|
||||||
isAvailable={isAvailable}/>
|
isSquare={true}
|
||||||
|
subtitle={proxiwashSubtitle}
|
||||||
|
color={proxiwashColor}
|
||||||
|
icon={proxiwashIcon}
|
||||||
|
clickAction={() => proxiwashClickAction()}
|
||||||
|
title={proxiwashTitle}
|
||||||
|
isAvailable={proxiwashIsAvailable}
|
||||||
|
isSquareLeft={true}/>
|
||||||
|
<DashboardItem
|
||||||
|
isSquare={true}
|
||||||
|
subtitle={tutorinsaSubtitle}
|
||||||
|
color={tutorinsaColor}
|
||||||
|
icon={tutorinsaIcon}
|
||||||
|
clickAction={() => tutorinsaClickAction()}
|
||||||
|
title={tutorinsaTitle}
|
||||||
|
isAvailable={tutorinsaIsAvailable}/>
|
||||||
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,10 +80,13 @@
|
||||||
"proximoSubtitleNA": "No articles available",
|
"proximoSubtitleNA": "No articles available",
|
||||||
"proximoSubtitle": " article available",
|
"proximoSubtitle": " article available",
|
||||||
"proximoSubtitlePlural": " articles available",
|
"proximoSubtitlePlural": " articles available",
|
||||||
|
"tutorinsaSubtitleNA": "No tutorial available",
|
||||||
|
"tutorinsaSubtitle": " tutorial available",
|
||||||
|
"tutorinsaSubtitlePlural": " tutorials available",
|
||||||
"proxiwashTitle": "Available machines",
|
"proxiwashTitle": "Available machines",
|
||||||
"proxiwashSubtitleNA": "No machines available",
|
"proxiwashSubtitleNA": "No machines available",
|
||||||
"proxiwashSubtitle1": " dryer and ",
|
"proxiwashSubtitle1": " dryer",
|
||||||
"proxiwashSubtitle1Plural": " dryers and ",
|
"proxiwashSubtitle1Plural": " dryers",
|
||||||
"proxiwashSubtitle2": " washer",
|
"proxiwashSubtitle2": " washer",
|
||||||
"proxiwashSubtitle2Plural": " washers",
|
"proxiwashSubtitle2Plural": " washers",
|
||||||
"menuTitle": "Today's menu",
|
"menuTitle": "Today's menu",
|
||||||
|
|
|
@ -80,12 +80,15 @@
|
||||||
"proximoSubtitleNA": "pas d'article en vente",
|
"proximoSubtitleNA": "pas d'article en vente",
|
||||||
"proximoSubtitle": " article disponible",
|
"proximoSubtitle": " article disponible",
|
||||||
"proximoSubtitlePlural": " articles disponibles",
|
"proximoSubtitlePlural": " articles disponibles",
|
||||||
|
"tutorinsaSubtitleNA": "Aucun tutorat disponible",
|
||||||
|
"tutorinsaSubtitle": " tutorat disponible",
|
||||||
|
"tutorinsaSubtitlePlural": " tutorats disponibles",
|
||||||
"proxiwashTitle": "Machines disponibles",
|
"proxiwashTitle": "Machines disponibles",
|
||||||
"proxiwashSubtitleNA": "Pas de machine disponible",
|
"proxiwashSubtitleNA": "Pas de machine disponible",
|
||||||
"proxiwashSubtitle1": " sèches linges et ",
|
"proxiwashSubtitle1": " sèche-linge",
|
||||||
"proxiwashSubtitle1Plural": " sèche linge et ",
|
"proxiwashSubtitle1Plural": " sèche-linges",
|
||||||
"proxiwashSubtitle2": " laves linges",
|
"proxiwashSubtitle2": " lave-linge",
|
||||||
"proxiwashSubtitle2Plural": " lave linge",
|
"proxiwashSubtitle2Plural": " lave-linges",
|
||||||
"menuTitle": "Menu d'aujourd'hui",
|
"menuTitle": "Menu d'aujourd'hui",
|
||||||
"menuSubtitleNA": "Pas de menu disponible",
|
"menuSubtitleNA": "Pas de menu disponible",
|
||||||
"menuSubtitle": "Cliquez ici pour voir le menu"
|
"menuSubtitle": "Cliquez ici pour voir le menu"
|
||||||
|
@ -127,10 +130,10 @@
|
||||||
"paymentMethodsDescription" : "Espèce ou Lydia"
|
"paymentMethodsDescription" : "Espèce ou Lydia"
|
||||||
},
|
},
|
||||||
"proxiwashScreen": {
|
"proxiwashScreen": {
|
||||||
"dryer": "Sèche Linge",
|
"dryer": "Sèche-Linge",
|
||||||
"dryers": "Sèche Linges",
|
"dryers": "Sèche-Linges",
|
||||||
"washer": "Lave Linge",
|
"washer": "Lave-Linge",
|
||||||
"washers": "Lave Linges",
|
"washers": "Lave-Linges",
|
||||||
"min": "min",
|
"min": "min",
|
||||||
"listUpdated": "Etat des machines mis à jour",
|
"listUpdated": "Etat des machines mis à jour",
|
||||||
"listUpdateFail": "Erreur lors de la mise à jour del'état des machines",
|
"listUpdateFail": "Erreur lors de la mise à jour del'état des machines",
|
||||||
|
|
Loading…
Reference in a new issue