Improved code readability

This commit is contained in:
Arnaud Vergnet 2020-04-22 09:54:40 +02:00
parent bbe343da3b
commit 926515213d
2 changed files with 67 additions and 78 deletions

View file

@ -45,68 +45,68 @@ class ServicesScreen extends React.Component<Props> {
super(props);
const nav = props.navigation;
this.studentsDataset = [
{
title: "proximo",
subtitle: "proximo",
image: PROXIMO_IMAGE,
onPress: () => nav.navigate("proximo"),
},
{
title: "AMICALE",
subtitle: "AMICALE",
image: AMICALE_IMAGE,
onPress: () => nav.navigate("amicale-website"),
},
{
title: "wiketud",
subtitle: "wiketud",
image: WIKETUD_LINK,
onPress: () => nav.navigate("wiketud"),
},
{
title: "ELUS ETUDIANTS",
subtitle: "ELUS ETUDIANTS",
image: EE_IMAGE,
onPress: () => nav.navigate("elus-etudiants"),
},
{
title: "TUTOR INSA",
subtitle: "TUTOR INSA",
image: TUTORINSA_IMAGE,
onPress: () => nav.navigate("tutorinsa"),
},
{
title: "proximo",
subtitle: "proximo",
image: PROXIMO_IMAGE,
onPress: () => nav.navigate("proximo"),
},
{
title: "AMICALE",
subtitle: "AMICALE",
image: AMICALE_IMAGE,
onPress: () => nav.navigate("amicale-website"),
},
{
title: "wiketud",
subtitle: "wiketud",
image: WIKETUD_LINK,
onPress: () => nav.navigate("wiketud"),
},
{
title: "ELUS ETUDIANTS",
subtitle: "ELUS ETUDIANTS",
image: EE_IMAGE,
onPress: () => nav.navigate("elus-etudiants"),
},
{
title: "TUTOR INSA",
subtitle: "TUTOR INSA",
image: TUTORINSA_IMAGE,
onPress: () => nav.navigate("tutorinsa"),
},
];
this.insaDataset = [
{
title: "RU",
subtitle: "the ru",
image: RU_IMAGE,
onPress: () => nav.navigate("self-menu"),
},
{
title: "AVAILABLE ROOMS",
subtitle: "ROOMS",
image: ROOM_IMAGE,
onPress: () => nav.navigate("available-rooms"),
},
{
title: "BIB",
subtitle: "BIB",
image: BIB_IMAGE,
onPress: () => nav.navigate("bib"),
},
{
title: "EMAIL",
subtitle: "EMAIL",
image: EMAIL_IMAGE,
onPress: () => nav.navigate("bluemind"),
},
{
title: "ENT",
subtitle: "ENT",
image: ENT_IMAGE,
onPress: () => nav.navigate("ent"),
},
{
title: "RU",
subtitle: "the ru",
image: RU_IMAGE,
onPress: () => nav.navigate("self-menu"),
},
{
title: "AVAILABLE ROOMS",
subtitle: "ROOMS",
image: ROOM_IMAGE,
onPress: () => nav.navigate("available-rooms"),
},
{
title: "BIB",
subtitle: "BIB",
image: BIB_IMAGE,
onPress: () => nav.navigate("bib"),
},
{
title: "EMAIL",
subtitle: "EMAIL",
image: EMAIL_IMAGE,
onPress: () => nav.navigate("bluemind"),
},
{
title: "ENT",
subtitle: "ENT",
image: ENT_IMAGE,
onPress: () => nav.navigate("ent"),
},
];
this.finalDataset = [
{
@ -141,15 +141,15 @@ class ServicesScreen extends React.Component<Props> {
getAvatar(props, source: string | number) {
if (typeof source === "number")
return <Avatar.Image
size={48}
source={AMICALE_IMAGE}
style={{backgroundColor: 'transparent'}}/>
return <Avatar.Image
size={48}
source={AMICALE_IMAGE}
style={{backgroundColor: 'transparent'}}/>
else
return <List.Icon {...props} icon={source} />
return <List.Icon {...props} icon={source}/>
}
renderItem = ({item} : {item: listItem}) => {
renderItem = ({item}: { item: listItem }) => {
return (
<Card
style={{
@ -161,7 +161,7 @@ class ServicesScreen extends React.Component<Props> {
title={item.title}
subtitle={item.description}
left={(props) => this.getAvatar(props, item.image)}
right={(props) => <List.Icon {...props} icon="chevron-right" />}
right={(props) => <List.Icon {...props} icon="chevron-right"/>}
/>
<CardList
dataset={item.content}

View file

@ -13,17 +13,6 @@ type Props = {
route: Object,
collapsibleStack: Collapsible,
}
const BIB_IMAGE = "https://scontent-cdg2-1.xx.fbcdn.net/v/t1.0-9/50695561_2124263197597162_2325349608210825216_n.jpg?_nc_cat=109&_nc_sid=8bfeb9&_nc_ohc=tmcV6FWO7_kAX9vfWHU&_nc_ht=scontent-cdg2-1.xx&oh=3b81c76e46b49f7c3a033ea3b07ec212&oe=5EC59B4D";
const RU_IMAGE = "https://scontent-cdg2-1.xx.fbcdn.net/v/t1.0-9/47123773_2041883702501779_5289372776166064128_o.jpg?_nc_cat=100&_nc_sid=cdbe9c&_nc_ohc=dpuBGlIIy_EAX8CyC0l&_nc_ht=scontent-cdg2-1.xx&oh=5c5bb4f0c7f12b554246f7c9b620a5f3&oe=5EC4DB31";
const ROOM_IMAGE = "https://scontent-cdt1-1.xx.fbcdn.net/v/t1.0-9/47041013_2043521689004647_316124496522117120_n.jpg?_nc_cat=103&_nc_sid=8bfeb9&_nc_ohc=bIp8OVJvvSEAX8mKnDZ&_nc_ht=scontent-cdt1-1.xx&oh=b4fef72a645804a849ad30e9e20fca12&oe=5EC29309";
const EMAIL_IMAGE = "https://etud-mel.insa-toulouse.fr/webmail/images/logo-bluemind.png";
const ENT_IMAGE = "https://ent.insa-toulouse.fr/media/org/jasig/portal/layout/tab-column/xhtml-theme/insa/institutional/LogoInsa.png";
const PROXIMO_IMAGE = require("../../../assets/proximo-logo.png");
const WIKETUD_LINK = "https://wiki.etud.insa-toulouse.fr/resources/assets/wiketud.png?ff051";
const AMICALE_IMAGE = require("../../../assets/amicale.png");
const EE_IMAGE = "https://etud.insa-toulouse.fr/~eeinsat/wp-content/uploads/2019/09/logo-blanc.png";
const TUTORINSA_IMAGE = "https://www.etud.insa-toulouse.fr/~tutorinsa/public/images/logo-gray.png";
type listItem = {
title: string,