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.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // @flow
  2. import * as React from 'react';
  3. import {Avatar, Card, Paragraph, withTheme} from 'react-native-paper';
  4. import {StyleSheet} from 'react-native';
  5. import i18n from 'i18n-js';
  6. import type {CustomThemeType} from '../../../managers/ThemeManager';
  7. import type {CardTitleIconPropsType} from '../../../constants/PaperStyles';
  8. type PropsType = {
  9. startDate: string | null,
  10. justVoted: boolean,
  11. hasVoted: boolean,
  12. isVoteRunning: boolean,
  13. theme: CustomThemeType,
  14. };
  15. const styles = StyleSheet.create({
  16. card: {
  17. margin: 10,
  18. },
  19. icon: {
  20. backgroundColor: 'transparent',
  21. },
  22. });
  23. class VoteWait extends React.Component<PropsType> {
  24. shouldComponentUpdate(): boolean {
  25. return false;
  26. }
  27. render(): React.Node {
  28. const {props} = this;
  29. const {startDate} = props;
  30. return (
  31. <Card style={styles.card}>
  32. <Card.Title
  33. title={
  34. props.isVoteRunning
  35. ? i18n.t('screens.vote.wait.titleSubmitted')
  36. : i18n.t('screens.vote.wait.titleEnded')
  37. }
  38. subtitle={i18n.t('screens.vote.wait.subtitle')}
  39. left={(iconProps: CardTitleIconPropsType): React.Node => (
  40. <Avatar.Icon size={iconProps.size} icon="progress-check" />
  41. )}
  42. />
  43. <Card.Content>
  44. {props.justVoted ? (
  45. <Paragraph style={{color: props.theme.colors.success}}>
  46. {i18n.t('screens.vote.wait.messageSubmitted')}
  47. </Paragraph>
  48. ) : null}
  49. {props.hasVoted ? (
  50. <Paragraph style={{color: props.theme.colors.success}}>
  51. {i18n.t('screens.vote.wait.messageVoted')}
  52. </Paragraph>
  53. ) : null}
  54. {startDate != null ? (
  55. <Paragraph>
  56. {`${i18n.t('screens.vote.wait.messageDate')} ${startDate}`}
  57. </Paragraph>
  58. ) : (
  59. <Paragraph>
  60. {i18n.t('screens.vote.wait.messageDateUndefined')}
  61. </Paragraph>
  62. )}
  63. </Card.Content>
  64. </Card>
  65. );
  66. }
  67. }
  68. export default withTheme(VoteWait);