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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright (c) 2019 - 2020 Arnaud Vergnet.
  3. *
  4. * This file is part of Campus INSAT.
  5. *
  6. * Campus INSAT is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Campus INSAT is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. // @flow
  20. import * as React from 'react';
  21. import {FlatList, Image, Linking, View} from 'react-native';
  22. import {Card, List, Text, withTheme, Avatar} from 'react-native-paper';
  23. import i18n from 'i18n-js';
  24. import type {MaterialCommunityIconsGlyphs} from 'react-native-vector-icons/MaterialCommunityIcons';
  25. import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
  26. import AMICALE_LOGO from '../../../assets/amicale.png';
  27. import type {
  28. CardTitleIconPropsType,
  29. ListIconPropsType,
  30. } from '../../constants/PaperStyles';
  31. type DatasetItemType = {
  32. name: string,
  33. email: string,
  34. icon: MaterialCommunityIconsGlyphs,
  35. };
  36. /**
  37. * Class defining a planning event information page.
  38. */
  39. class AmicaleContactScreen extends React.Component<null> {
  40. // Dataset containing information about contacts
  41. CONTACT_DATASET: Array<DatasetItemType>;
  42. constructor() {
  43. super();
  44. this.CONTACT_DATASET = [
  45. {
  46. name: i18n.t('screens.amicaleAbout.roles.interSchools'),
  47. email: 'inter.ecoles@amicale-insat.fr',
  48. icon: 'share-variant',
  49. },
  50. {
  51. name: i18n.t('screens.amicaleAbout.roles.culture'),
  52. email: 'culture@amicale-insat.fr',
  53. icon: 'book',
  54. },
  55. {
  56. name: i18n.t('screens.amicaleAbout.roles.animation'),
  57. email: 'animation@amicale-insat.fr',
  58. icon: 'emoticon',
  59. },
  60. {
  61. name: i18n.t('screens.amicaleAbout.roles.clubs'),
  62. email: 'clubs@amicale-insat.fr',
  63. icon: 'account-group',
  64. },
  65. {
  66. name: i18n.t('screens.amicaleAbout.roles.event'),
  67. email: 'evenements@amicale-insat.fr',
  68. icon: 'calendar-range',
  69. },
  70. {
  71. name: i18n.t('screens.amicaleAbout.roles.tech'),
  72. email: 'technique@amicale-insat.fr',
  73. icon: 'cog',
  74. },
  75. {
  76. name: i18n.t('screens.amicaleAbout.roles.communication'),
  77. email: 'amicale@amicale-insat.fr',
  78. icon: 'comment-account',
  79. },
  80. {
  81. name: i18n.t('screens.amicaleAbout.roles.intraSchools'),
  82. email: 'intra.ecoles@amicale-insat.fr',
  83. icon: 'school',
  84. },
  85. {
  86. name: i18n.t('screens.amicaleAbout.roles.publicRelations'),
  87. email: 'rp@amicale-insat.fr',
  88. icon: 'account-tie',
  89. },
  90. ];
  91. }
  92. keyExtractor = (item: DatasetItemType): string => item.email;
  93. getChevronIcon = (iconProps: ListIconPropsType): React.Node => (
  94. <List.Icon
  95. color={iconProps.color}
  96. style={iconProps.style}
  97. icon="chevron-right"
  98. />
  99. );
  100. getRenderItem = ({item}: {item: DatasetItemType}): React.Node => {
  101. const onPress = () => {
  102. Linking.openURL(`mailto:${item.email}`);
  103. };
  104. return (
  105. <List.Item
  106. title={item.name}
  107. description={item.email}
  108. left={(iconProps: ListIconPropsType): React.Node => (
  109. <List.Icon
  110. color={iconProps.color}
  111. style={iconProps.style}
  112. icon={item.icon}
  113. />
  114. )}
  115. right={this.getChevronIcon}
  116. onPress={onPress}
  117. />
  118. );
  119. };
  120. getScreen = (): React.Node => {
  121. return (
  122. <View>
  123. <View
  124. style={{
  125. width: '100%',
  126. height: 100,
  127. marginTop: 20,
  128. marginBottom: 20,
  129. justifyContent: 'center',
  130. alignItems: 'center',
  131. }}>
  132. <Image
  133. source={AMICALE_LOGO}
  134. style={{flex: 1, resizeMode: 'contain'}}
  135. resizeMode="contain"
  136. />
  137. </View>
  138. <Card style={{margin: 5}}>
  139. <Card.Title
  140. title={i18n.t('screens.amicaleAbout.title')}
  141. subtitle={i18n.t('screens.amicaleAbout.subtitle')}
  142. left={(iconProps: CardTitleIconPropsType): React.Node => (
  143. <Avatar.Icon size={iconProps.size} icon="information" />
  144. )}
  145. />
  146. <Card.Content>
  147. <Text>{i18n.t('screens.amicaleAbout.message')}</Text>
  148. <FlatList
  149. data={this.CONTACT_DATASET}
  150. keyExtractor={this.keyExtractor}
  151. renderItem={this.getRenderItem}
  152. />
  153. </Card.Content>
  154. </Card>
  155. </View>
  156. );
  157. };
  158. render(): React.Node {
  159. return (
  160. <CollapsibleFlatList
  161. data={[{key: '1'}]}
  162. renderItem={this.getScreen}
  163. hasTab
  164. />
  165. );
  166. }
  167. }
  168. export default withTheme(AmicaleContactScreen);