2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-04-29 23:32:49 +01:00
|
|
|
import { injectIntl, defineMessages } from 'react-intl'
|
|
|
|
import { monthlyExpensesComplete } from '../../initial_state'
|
2020-07-02 02:38:10 +01:00
|
|
|
import {
|
|
|
|
URL_DISSENTER_SHOP,
|
|
|
|
URL_DISSENTER_SHOP_DONATIONS,
|
|
|
|
} from '../../constants'
|
2020-02-05 22:45:48 +00:00
|
|
|
import PanelLayout from './panel_layout';
|
|
|
|
import ProgressBar from '../progress_bar'
|
2020-07-02 02:38:10 +01:00
|
|
|
import Button from '../button'
|
|
|
|
import Text from '../text'
|
2020-02-05 22:45:48 +00:00
|
|
|
|
2020-08-17 21:07:16 +01:00
|
|
|
class ProgressPanel extends React.PureComponent {
|
2020-04-29 23:32:49 +01:00
|
|
|
|
2020-02-05 22:45:48 +00:00
|
|
|
render() {
|
2020-04-29 23:32:49 +01:00
|
|
|
const { intl } = this.props
|
|
|
|
|
|
|
|
if (!monthlyExpensesComplete) return null
|
|
|
|
|
|
|
|
const value = Math.min(parseFloat(monthlyExpensesComplete), 100)
|
2020-02-05 22:45:48 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<PanelLayout
|
2020-04-29 23:32:49 +01:00
|
|
|
title={intl.formatMessage(messages.operationsTitle)}
|
|
|
|
subtitle={intl.formatMessage(messages.operationsSubtitle)}
|
2020-02-05 22:45:48 +00:00
|
|
|
>
|
2020-03-26 03:11:32 +00:00
|
|
|
<ProgressBar
|
|
|
|
progress={monthlyExpensesComplete}
|
2020-04-29 23:32:49 +01:00
|
|
|
title={intl.formatMessage(messages.progressTitle, { value })}
|
|
|
|
href={URL_DISSENTER_SHOP}
|
2020-03-26 03:11:32 +00:00
|
|
|
/>
|
2020-07-02 02:38:10 +01:00
|
|
|
<Button
|
|
|
|
isOutline
|
|
|
|
isNarrow
|
|
|
|
color='brand'
|
|
|
|
backgroundColor='none'
|
|
|
|
className={[_s.mt10].join(' ')}
|
|
|
|
href={URL_DISSENTER_SHOP_DONATIONS}
|
|
|
|
>
|
|
|
|
<Text
|
|
|
|
align='center'
|
|
|
|
color='inherit'
|
|
|
|
weight='medium'
|
|
|
|
>
|
|
|
|
{intl.formatMessage(messages.donationTitle)}
|
|
|
|
</Text>
|
|
|
|
</Button>
|
2020-02-05 22:45:48 +00:00
|
|
|
</PanelLayout>
|
|
|
|
)
|
|
|
|
}
|
2020-04-29 23:32:49 +01:00
|
|
|
|
2020-08-19 01:22:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
progressTitle: { id: 'progress_title', defaultMessage: '{value}% covered this month' },
|
|
|
|
operationsTitle: { id: 'operations_title', defaultMessage: "Gab's Operational Expenses" },
|
|
|
|
operationsSubtitle: { id: 'operations_subtitle', defaultMessage: 'We are 100% funded by you' },
|
|
|
|
donationTitle: { id: 'make_donation', defaultMessage: 'Make a Donation' },
|
|
|
|
})
|
|
|
|
|
|
|
|
ProgressPanel.propTypes = {
|
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default injectIntl(ProgressPanel)
|