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.tsx 4.8KB

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. import * as React from 'react';
  20. import {FlatList, Image, Linking, View} from 'react-native';
  21. import {Avatar, Card, List, Text} from 'react-native-paper';
  22. import i18n from 'i18n-js';
  23. import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
  24. const AMICALE_LOGO = require('../../../assets/amicale.png');
  25. type DatasetItemType = {
  26. name: string;
  27. email: string;
  28. icon: string;
  29. };
  30. /**
  31. * Class defining a planning event information page.
  32. */
  33. class AmicaleContactScreen extends React.Component<null> {
  34. // Dataset containing information about contacts
  35. CONTACT_DATASET: Array<DatasetItemType>;
  36. constructor() {
  37. super(null);
  38. this.CONTACT_DATASET = [
  39. {
  40. name: i18n.t('screens.amicaleAbout.roles.interSchools'),
  41. email: 'inter.ecoles@amicale-insat.fr',
  42. icon: 'share-variant',
  43. },
  44. {
  45. name: i18n.t('screens.amicaleAbout.roles.culture'),
  46. email: 'culture@amicale-insat.fr',
  47. icon: 'book',
  48. },
  49. {
  50. name: i18n.t('screens.amicaleAbout.roles.animation'),
  51. email: 'animation@amicale-insat.fr',
  52. icon: 'emoticon',
  53. },
  54. {
  55. name: i18n.t('screens.amicaleAbout.roles.clubs'),
  56. email: 'clubs@amicale-insat.fr',
  57. icon: 'account-group',
  58. },
  59. {
  60. name: i18n.t('screens.amicaleAbout.roles.event'),
  61. email: 'evenements@amicale-insat.fr',
  62. icon: 'calendar-range',
  63. },
  64. {
  65. name: i18n.t('screens.amicaleAbout.roles.tech'),
  66. email: 'technique@amicale-insat.fr',
  67. icon: 'cog',
  68. },
  69. {
  70. name: i18n.t('screens.amicaleAbout.roles.communication'),
  71. email: 'amicale@amicale-insat.fr',
  72. icon: 'comment-account',
  73. },
  74. {
  75. name: i18n.t('screens.amicaleAbout.roles.intraSchools'),
  76. email: 'intra.ecoles@amicale-insat.fr',
  77. icon: 'school',
  78. },
  79. {
  80. name: i18n.t('screens.amicaleAbout.roles.publicRelations'),
  81. email: 'rp@amicale-insat.fr',
  82. icon: 'account-tie',
  83. },
  84. ];
  85. }
  86. keyExtractor = (item: DatasetItemType): string => item.email;
  87. getChevronIcon = (iconProps: {
  88. color: string;
  89. style?: {
  90. marginRight: number;
  91. marginVertical?: number;
  92. };
  93. }) => (
  94. <List.Icon
  95. color={iconProps.color}
  96. style={iconProps.style}
  97. icon="chevron-right"
  98. />
  99. );
  100. getRenderItem = ({item}: {item: DatasetItemType}) => {
  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) => (
  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 = () => {
  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) => (
  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() {
  159. return (
  160. <CollapsibleFlatList
  161. data={[{key: '1'}]}
  162. renderItem={this.getScreen}
  163. hasTab
  164. />
  165. );
  166. }
  167. }
  168. export default AmicaleContactScreen;