Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AmicaleContactScreen.js 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // @flow
  2. import * as React from 'react';
  3. import {FlatList, Image, Linking, View} from 'react-native';
  4. import {Card, List, Text, withTheme} from 'react-native-paper';
  5. import i18n from 'i18n-js';
  6. import type {MaterialCommunityIconsGlyphs} from "react-native-vector-icons/MaterialCommunityIcons";
  7. import CollapsibleFlatList from "../../components/Collapsible/CollapsibleFlatList";
  8. type Props = {
  9. };
  10. type DatasetItem = {
  11. name: string,
  12. email: string,
  13. icon: MaterialCommunityIconsGlyphs,
  14. }
  15. /**
  16. * Class defining a planning event information page.
  17. */
  18. class AmicaleContactScreen extends React.Component<Props> {
  19. // Dataset containing information about contacts
  20. CONTACT_DATASET: Array<DatasetItem>;
  21. constructor(props: Props) {
  22. super(props);
  23. this.CONTACT_DATASET = [
  24. {
  25. name: i18n.t("screens.amicaleAbout.roles.interSchools"),
  26. email: "inter.ecoles@amicale-insat.fr",
  27. icon: "share-variant"
  28. },
  29. {
  30. name: i18n.t("screens.amicaleAbout.roles.culture"),
  31. email: "culture@amicale-insat.fr",
  32. icon: "book"
  33. },
  34. {
  35. name: i18n.t("screens.amicaleAbout.roles.animation"),
  36. email: "animation@amicale-insat.fr",
  37. icon: "emoticon"
  38. },
  39. {
  40. name: i18n.t("screens.amicaleAbout.roles.clubs"),
  41. email: "clubs@amicale-insat.fr",
  42. icon: "account-group"
  43. },
  44. {
  45. name: i18n.t("screens.amicaleAbout.roles.event"),
  46. email: "evenements@amicale-insat.fr",
  47. icon: "calendar-range"
  48. },
  49. {
  50. name: i18n.t("screens.amicaleAbout.roles.tech"),
  51. email: "technique@amicale-insat.fr",
  52. icon: "cog"
  53. },
  54. {
  55. name: i18n.t("screens.amicaleAbout.roles.communication"),
  56. email: "amicale@amicale-insat.fr",
  57. icon: "comment-account"
  58. },
  59. {
  60. name: i18n.t("screens.amicaleAbout.roles.intraSchools"),
  61. email: "intra.ecoles@amicale-insat.fr",
  62. icon: "school"
  63. },
  64. {
  65. name: i18n.t("screens.amicaleAbout.roles.publicRelations"),
  66. email: "rp@amicale-insat.fr",
  67. icon: "account-tie"
  68. },
  69. ];
  70. }
  71. keyExtractor = (item: DatasetItem) => item.email;
  72. getChevronIcon = (props) => <List.Icon {...props} icon={'chevron-right'}/>;
  73. renderItem = ({item}: { item: DatasetItem }) => {
  74. const onPress = () => Linking.openURL('mailto:' + item.email);
  75. return <List.Item
  76. title={item.name}
  77. description={item.email}
  78. left={(props) => <List.Icon {...props} icon={item.icon}/>}
  79. right={this.getChevronIcon}
  80. onPress={onPress}
  81. />
  82. };
  83. getScreen = () => {
  84. return (
  85. <View>
  86. <View style={{
  87. width: '100%',
  88. height: 100,
  89. marginTop: 20,
  90. marginBottom: 20,
  91. justifyContent: 'center',
  92. alignItems: 'center'
  93. }}>
  94. <Image
  95. source={require('../../../assets/amicale.png')}
  96. style={{flex: 1, resizeMode: "contain"}}
  97. resizeMode="contain"/>
  98. </View>
  99. <Card style={{margin: 5}}>
  100. <Card.Title
  101. title={i18n.t("screens.amicaleAbout.title")}
  102. subtitle={i18n.t("screens.amicaleAbout.subtitle")}
  103. left={props => <List.Icon {...props} icon={'information'}/>}
  104. />
  105. <Card.Content>
  106. <Text>{i18n.t("screens.amicaleAbout.message")}</Text>
  107. {/*$FlowFixMe*/}
  108. <FlatList
  109. data={this.CONTACT_DATASET}
  110. keyExtractor={this.keyExtractor}
  111. renderItem={this.renderItem}
  112. />
  113. </Card.Content>
  114. </Card>
  115. </View>
  116. );
  117. };
  118. render() {
  119. return (
  120. <CollapsibleFlatList
  121. data={[{key: "1"}]}
  122. renderItem={this.getScreen}
  123. hasTab={true}
  124. />
  125. );
  126. }
  127. }
  128. export default withTheme(AmicaleContactScreen);