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.

FeedbackScreen.js 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // @flow
  2. import * as React from 'react';
  3. import {Avatar, Button, Card, Paragraph, withTheme} from 'react-native-paper';
  4. import i18n from 'i18n-js';
  5. import {Linking} from 'react-native';
  6. import type {CustomThemeType} from '../../managers/ThemeManager';
  7. import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
  8. import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
  9. type PropsType = {
  10. theme: CustomThemeType,
  11. };
  12. const links = {
  13. bugsMail: `mailto:app@amicale-insat.fr?subject=[BUG] Application CAMPUS
  14. &body=Coucou Arnaud ça bug c'est nul,\n\n
  15. Informations sur ton système si tu sais (iOS ou Android, modèle du tel, version):\n\n\n
  16. Nature du problème :\n\n\n
  17. Étapes pour reproduire ce pb :\n\n\n\n
  18. Stp corrige le pb, bien cordialement.`,
  19. bugsGit:
  20. 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/issues/new',
  21. facebook: 'https://www.facebook.com/campus.insat',
  22. feedbackMail: `mailto:app@amicale-insat.fr?subject=[FEEDBACK] Application CAMPUS
  23. &body=Coucou Arnaud j'ai du feedback\n\n\n\nBien cordialement.`,
  24. feedbackGit:
  25. 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/issues/new',
  26. };
  27. class FeedbackScreen extends React.Component<PropsType> {
  28. /**
  29. * Gets link buttons
  30. *
  31. * @param isBug True if buttons should redirect to bug report methods
  32. * @returns {*}
  33. */
  34. static getButtons(isBug: boolean): React.Node {
  35. return (
  36. <Card.Actions
  37. style={{
  38. flex: 1,
  39. flexWrap: 'wrap',
  40. }}>
  41. <Button
  42. icon="email"
  43. mode="contained"
  44. style={{
  45. marginLeft: 'auto',
  46. marginTop: 5,
  47. }}
  48. onPress={() => {
  49. Linking.openURL(isBug ? links.bugsMail : links.feedbackMail);
  50. }}>
  51. MAIL
  52. </Button>
  53. <Button
  54. icon="git"
  55. mode="contained"
  56. color="#609927"
  57. style={{
  58. marginLeft: 'auto',
  59. marginTop: 5,
  60. }}
  61. onPress={() => {
  62. Linking.openURL(isBug ? links.bugsGit : links.feedbackGit);
  63. }}>
  64. GITEA
  65. </Button>
  66. <Button
  67. icon="facebook"
  68. mode="contained"
  69. color="#2e88fe"
  70. style={{
  71. marginLeft: 'auto',
  72. marginTop: 5,
  73. }}
  74. onPress={() => {
  75. Linking.openURL(links.facebook);
  76. }}>
  77. Facebook
  78. </Button>
  79. </Card.Actions>
  80. );
  81. }
  82. render(): React.Node {
  83. const {theme} = this.props;
  84. return (
  85. <CollapsibleScrollView style={{padding: 5}}>
  86. <Card>
  87. <Card.Title
  88. title={i18n.t('screens.feedback.bugs')}
  89. subtitle={i18n.t('screens.feedback.bugsSubtitle')}
  90. left={(iconProps: CardTitleIconPropsType): React.Node => (
  91. <Avatar.Icon size={iconProps.size} icon="bug" />
  92. )}
  93. />
  94. <Card.Content>
  95. <Paragraph>{i18n.t('screens.feedback.bugsDescription')}</Paragraph>
  96. <Paragraph style={{color: theme.colors.primary}}>
  97. {i18n.t('screens.feedback.contactMeans')}
  98. </Paragraph>
  99. </Card.Content>
  100. {FeedbackScreen.getButtons(true)}
  101. </Card>
  102. <Card style={{marginTop: 20, marginBottom: 10}}>
  103. <Card.Title
  104. title={i18n.t('screens.feedback.title')}
  105. subtitle={i18n.t('screens.feedback.feedbackSubtitle')}
  106. left={(iconProps: CardTitleIconPropsType): React.Node => (
  107. <Avatar.Icon size={iconProps.size} icon="comment" />
  108. )}
  109. />
  110. <Card.Content>
  111. <Paragraph>
  112. {i18n.t('screens.feedback.feedbackDescription')}
  113. </Paragraph>
  114. </Card.Content>
  115. {FeedbackScreen.getButtons(false)}
  116. </Card>
  117. </CollapsibleScrollView>
  118. );
  119. }
  120. }
  121. export default withTheme(FeedbackScreen);