-
Notifications
You must be signed in to change notification settings - Fork 295
/
TallyingPhase.tsx
72 lines (66 loc) · 1.94 KB
/
TallyingPhase.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// @flow
import React from 'react';
import { observer } from 'mobx-react';
import { injectIntl } from 'react-intl';
import {
CURRENT_VOTING_FUND_NUMBER,
VOTING_RESULTS_DATE,
VOTING_CAST_END_DATE,
} from '../../../config/votingConfig';
import {
formattedDateTime,
mapToLongDateTimeFormat,
} from '../../../utils/formatters';
import type { Locale } from '../../../../../common/types/locales.types';
import type { Intl } from '../../../types/i18nTypes';
import styles from './CurrentPhase.scss';
import { messages } from './TallyingPhase.messages';
import { messages as votingMessages } from './VotingInfo.messages';
type Props = {
currentLocale: Locale,
currentDateFormat: string,
currentTimeFormat: string,
intl: Intl,
};
function TallyingPhase({
currentLocale,
currentDateFormat,
currentTimeFormat,
intl,
}: Props) {
const mappedFormats = mapToLongDateTimeFormat({
currentLocale,
currentDateFormat,
currentTimeFormat,
});
const endDated = formattedDateTime(VOTING_CAST_END_DATE, {
currentLocale,
currentDateFormat: mappedFormats.currentDateFormat,
});
const resultsDate = formattedDateTime(VOTING_RESULTS_DATE, {
currentLocale,
currentDateFormat: mappedFormats.currentDateFormat,
});
return (
<section className={styles.root}>
<h1 className={styles.fundName}>
{intl.formatMessage(votingMessages.fundName, {
votingFundNumber: CURRENT_VOTING_FUND_NUMBER,
})}
</h1>
<div className={styles.block}>
<span className={styles.label}>
{intl.formatMessage(messages.endDateLabel)}
</span>
<span className={styles.value}>{endDated}</span>
</div>
<div className={styles.block}>
<span className={styles.label}>
{intl.formatMessage(messages.resultsLabel)}
</span>
<span className={styles.value}>{resultsDate}</span>
</div>
</section>
);
}
export default injectIntl(observer(TallyingPhase));