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 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>

View file

@ -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"
}, },

View file

@ -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"
}, },

View file

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