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

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