forked from vergnet/application-amicale
Added link to the timetable + removed list update toast if success
This commit is contained in:
parent
5c73dc8715
commit
fd0d896709
4 changed files with 26 additions and 14 deletions
|
@ -10,8 +10,9 @@ const deviceHeight = Dimensions.get("window").height;
|
||||||
|
|
||||||
const drawerCover = require("../assets/drawer-cover.png");
|
const drawerCover = require("../assets/drawer-cover.png");
|
||||||
|
|
||||||
const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud/index.php/Accueil";
|
const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud";
|
||||||
const Amicale_LINK = "https://www.etud.insa-toulouse.fr/~amicale";
|
const Amicale_LINK = "https://www.etud.insa-toulouse.fr/~amicale";
|
||||||
|
const TIMETABLE_LINK = "http://planex.insa-toulouse.fr";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
|
@ -73,14 +74,23 @@ export default class SideBar extends React.Component<Props, State> {
|
||||||
route: "amicale",
|
route: "amicale",
|
||||||
icon: "web",
|
icon: "web",
|
||||||
bg: "#477EEA",
|
bg: "#477EEA",
|
||||||
|
link: Amicale_LINK
|
||||||
|
// types: "11"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: i18n.t('screens.timetable'),
|
||||||
|
route: "timetable",
|
||||||
|
icon: "timetable",
|
||||||
|
bg: "#477EEA",
|
||||||
|
link: TIMETABLE_LINK
|
||||||
// types: "11"
|
// types: "11"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "Wiketud",
|
name: "Wiketud",
|
||||||
route: "wiketud",
|
route: "wiketud",
|
||||||
icon: "web",
|
icon: "wikipedia",
|
||||||
bg: "#477EEA",
|
bg: "#477EEA",
|
||||||
|
link: WIKETUD_LINK
|
||||||
// types: "11"
|
// types: "11"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -129,12 +139,10 @@ export default class SideBar extends React.Component<Props, State> {
|
||||||
noBorder={item.name !== 'Wiketud' && item.name !== 'Proximo'} // Display a separator before settings and Amicale
|
noBorder={item.name !== 'Wiketud' && item.name !== 'Proximo'} // Display a separator before settings and Amicale
|
||||||
selected={this.state.active === item.route}
|
selected={this.state.active === item.route}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (item.name !== 'Wiketud' && item.name !== 'Amicale')
|
if (item.link !== undefined)
|
||||||
|
Linking.openURL(item.link).catch((err) => console.error('Error opening link', err));
|
||||||
|
else
|
||||||
this.navigateToScreen(item.route);
|
this.navigateToScreen(item.route);
|
||||||
else if (item.name === 'Wiketud')
|
|
||||||
Linking.openURL(WIKETUD_LINK).catch((err) => console.error('Error opening link', err));
|
|
||||||
else if (item.name === 'Amicale')
|
|
||||||
Linking.openURL(Amicale_LINK).catch((err) => console.error('Error opening link', err));
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Left>
|
<Left>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"planning": "Planning",
|
"planning": "Planning",
|
||||||
"proxiwash": "Proxiwash",
|
"proxiwash": "Proxiwash",
|
||||||
"proximo": "Proximo",
|
"proximo": "Proximo",
|
||||||
|
"timetable": "Timetable",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"about": "About"
|
"about": "About"
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"planning": "Planning",
|
"planning": "Planning",
|
||||||
"proxiwash": "Proxiwash",
|
"proxiwash": "Proxiwash",
|
||||||
"proximo": "Proximo",
|
"proximo": "Proximo",
|
||||||
|
"timetable": "Emploi du temps",
|
||||||
"settings": "Paramètres",
|
"settings": "Paramètres",
|
||||||
"about": "À Propos"
|
"about": "À Propos"
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,12 +29,14 @@ export default class WebDataManager {
|
||||||
|
|
||||||
showUpdateToast(successString, errorString) {
|
showUpdateToast(successString, errorString) {
|
||||||
let isSuccess = this.isDataObjectValid();
|
let isSuccess = this.isDataObjectValid();
|
||||||
Toast.show({
|
if (!isSuccess) {
|
||||||
text: isSuccess ? successString : errorString,
|
Toast.show({
|
||||||
buttonText: 'OK',
|
text: isSuccess ? successString : errorString,
|
||||||
type: isSuccess ? "success" : "danger",
|
buttonText: 'OK',
|
||||||
duration: 2000
|
type: isSuccess ? "success" : "danger",
|
||||||
})
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue