Added link to the timetable + removed list update toast if success

This commit is contained in:
keplyx 2019-08-05 22:55:45 +02:00
parent 5c73dc8715
commit fd0d896709
4 changed files with 26 additions and 14 deletions

View file

@ -10,8 +10,9 @@ const deviceHeight = Dimensions.get("window").height;
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 TIMETABLE_LINK = "http://planex.insa-toulouse.fr";
type Props = {
navigation: Object,
@ -73,14 +74,23 @@ export default class SideBar extends React.Component<Props, State> {
route: "amicale",
icon: "web",
bg: "#477EEA",
link: Amicale_LINK
// types: "11"
},
{
name: i18n.t('screens.timetable'),
route: "timetable",
icon: "timetable",
bg: "#477EEA",
link: TIMETABLE_LINK
// types: "11"
},
{
name: "Wiketud",
route: "wiketud",
icon: "web",
icon: "wikipedia",
bg: "#477EEA",
link: WIKETUD_LINK
// 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
selected={this.state.active === item.route}
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);
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>

View file

@ -4,6 +4,7 @@
"planning": "Planning",
"proxiwash": "Proxiwash",
"proximo": "Proximo",
"timetable": "Timetable",
"settings": "Settings",
"about": "About"
},

View file

@ -4,6 +4,7 @@
"planning": "Planning",
"proxiwash": "Proxiwash",
"proximo": "Proximo",
"timetable": "Emploi du temps",
"settings": "Paramètres",
"about": "À Propos"
},

View file

@ -29,12 +29,14 @@ export default class WebDataManager {
showUpdateToast(successString, errorString) {
let isSuccess = this.isDataObjectValid();
Toast.show({
text: isSuccess ? successString : errorString,
buttonText: 'OK',
type: isSuccess ? "success" : "danger",
duration: 2000
})
if (!isSuccess) {
Toast.show({
text: isSuccess ? successString : errorString,
buttonText: 'OK',
type: isSuccess ? "success" : "danger",
duration: 2000
});
}
}
}