Application Android et IOS pour l'amicale des élèves https://play.google.com/store/apps/details?id=fr.amicaleinsat.application
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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // @flow
  2. import * as React from 'react';
  3. import {FlatList, Image, Linking, View} from 'react-native';
  4. import {Card, List, Text, withTheme, Avatar} 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. import AMICALE_LOGO from '../../../assets/amicale.png';
  9. import type {
  10. CardTitleIconPropsType,
  11. ListIconPropsType,
  12. } from '../../constants/PaperStyles';
  13. type DatasetItemType = {
  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<null> {
  22. // Dataset containing information about contacts
  23. CONTACT_DATASET: Array<DatasetItemType>;
  24. constructor() {
  25. super();
  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: DatasetItemType): string => item.email;
  75. getChevronIcon = (iconProps: ListIconPropsType): React.Node => (
  76. <List.Icon
  77. color={iconProps.color}
  78. style={iconProps.style}
  79. icon="chevron-right"
  80. />
  81. );
  82. getRenderItem = ({item}: {item: DatasetItemType}): React.Node => {
  83. const onPress = () => {
  84. Linking.openURL(`mailto:${item.email}`);
  85. };
  86. return (
  87. <List.Item
  88. title={item.name}
  89. description={item.email}
  90. left={(iconProps: ListIconPropsType): React.Node => (
  91. <List.Icon
  92. color={iconProps.color}
  93. style={iconProps.style}
  94. icon={item.icon}
  95. />
  96. )}
  97. right={this.getChevronIcon}
  98. onPress={onPress}
  99. />
  100. );
  101. };
  102. getScreen = (): React.Node => {
  103. return (
  104. <View>
  105. <View
  106. style={{
  107. width: '100%',
  108. height: 100,
  109. marginTop: 20,
  110. marginBottom: 20,
  111. justifyContent: 'center',
  112. alignItems: 'center',
  113. }}>
  114. <Image
  115. source={AMICALE_LOGO}
  116. style={{flex: 1, resizeMode: 'contain'}}
  117. resizeMode="contain"
  118. />
  119. </View>
  120. <Card style={{margin: 5}}>
  121. <Card.Title
  122. title={i18n.t('screens.amicaleAbout.title')}
  123. subtitle={i18n.t('screens.amicaleAbout.subtitle')}
  124. left={(iconProps: CardTitleIconPropsType): React.Node => (
  125. <Avatar.Icon size={iconProps.size} icon="information" />
  126. )}
  127. />
  128. <Card.Content>
  129. <Text>{i18n.t('screens.amicaleAbout.message')}</Text>
  130. <FlatList
  131. data={this.CONTACT_DATASET}
  132. keyExtractor={this.keyExtractor}
  133. renderItem={this.getRenderItem}
  134. />
  135. </Card.Content>
  136. </Card>
  137. </View>
  138. );
  139. };
  140. render(): React.Node {
  141. return (
  142. <CollapsibleFlatList
  143. data={[{key: '1'}]}
  144. renderItem={this.getScreen}
  145. hasTab
  146. />
  147. );
  148. }
  149. }
  150. export default withTheme(AmicaleContactScreen);