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.

VoteWait.tsx 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 {Avatar, Card, Paragraph, useTheme} from 'react-native-paper';
  21. import {StyleSheet} from 'react-native';
  22. import i18n from 'i18n-js';
  23. type PropsType = {
  24. startDate: string | null;
  25. justVoted: boolean;
  26. hasVoted: boolean;
  27. isVoteRunning: boolean;
  28. };
  29. const styles = StyleSheet.create({
  30. card: {
  31. margin: 10,
  32. },
  33. icon: {
  34. backgroundColor: 'transparent',
  35. },
  36. });
  37. export default function VoteWait(props: PropsType) {
  38. const theme = useTheme();
  39. const {startDate} = props;
  40. return (
  41. <Card style={styles.card}>
  42. <Card.Title
  43. title={
  44. props.isVoteRunning
  45. ? i18n.t('screens.vote.wait.titleSubmitted')
  46. : i18n.t('screens.vote.wait.titleEnded')
  47. }
  48. subtitle={i18n.t('screens.vote.wait.subtitle')}
  49. left={(iconProps) => (
  50. <Avatar.Icon size={iconProps.size} icon="progress-check" />
  51. )}
  52. />
  53. <Card.Content>
  54. {props.justVoted ? (
  55. <Paragraph style={{color: theme.colors.success}}>
  56. {i18n.t('screens.vote.wait.messageSubmitted')}
  57. </Paragraph>
  58. ) : null}
  59. {props.hasVoted ? (
  60. <Paragraph style={{color: theme.colors.success}}>
  61. {i18n.t('screens.vote.wait.messageVoted')}
  62. </Paragraph>
  63. ) : null}
  64. {startDate != null ? (
  65. <Paragraph>
  66. {`${i18n.t('screens.vote.wait.messageDate')} ${startDate}`}
  67. </Paragraph>
  68. ) : (
  69. <Paragraph>
  70. {i18n.t('screens.vote.wait.messageDateUndefined')}
  71. </Paragraph>
  72. )}
  73. </Card.Content>
  74. </Card>
  75. );
  76. }