-
Notifications
You must be signed in to change notification settings - Fork 295
/
ResultsPhase.tsx
74 lines (67 loc) · 2.02 KB
/
ResultsPhase.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
73
74
// @flow
import React from 'react';
import { observer } from 'mobx-react';
import { injectIntl } from 'react-intl';
import {
VOTING_CAST_END_DATE,
CURRENT_VOTING_FUND_NUMBER,
} from '../../../config/votingConfig';
import {
formattedDateTime,
mapToLongDateTimeFormat,
} from '../../../utils/formatters';
import type { Locale } from '../../../../../common/types/locales.types';
import { ExternalLinkButton } from '../../widgets/ExternalLinkButton';
import type { Intl } from '../../../types/i18nTypes';
import { messages } from './ResultsPhase.messages';
import { messages as votingMessages } from './VotingInfo.messages';
import styles from './CurrentPhase.scss';
type Props = {
currentLocale: Locale,
currentDateFormat: string,
currentTimeFormat: string,
onExternalLinkClick: Function,
intl: Intl,
};
function ResultsPhase({
currentLocale,
currentDateFormat,
currentTimeFormat,
onExternalLinkClick,
intl,
}: Props) {
const mappedFormats = mapToLongDateTimeFormat({
currentLocale,
currentDateFormat,
currentTimeFormat,
});
const endDate = formattedDateTime(VOTING_CAST_END_DATE, {
currentLocale,
currentDateFormat: mappedFormats.currentDateFormat,
currentTimeFormat: mappedFormats.currentTimeFormat,
});
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}>{endDate}</span>
</div>
<div className={styles.resultsButton}>
<ExternalLinkButton
label={intl.formatMessage(messages.viewResultsLinkLabel)}
onClick={() =>
onExternalLinkClick(intl.formatMessage(messages.viewResultsLinkURL))
}
/>
</div>
</section>
);
}
export default injectIntl(observer(ResultsPhase));