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-08-17 21:39:25 +01:00
import { connect } from 'react-redux'
2020-02-24 23:25:55 +00:00
import { defineMessages , injectIntl } from 'react-intl'
2020-07-25 03:27:09 +01:00
import {
URL _GAB _PRO ,
DEFAULT _THEME ,
} from '../../constants'
2020-02-24 23:25:55 +00:00
import Button from '../button'
import Text from '../text'
2020-07-25 03:27:09 +01:00
import Icon from '../icon'
import Image from '../image'
2020-02-24 23:25:55 +00:00
import ModalLayout from './modal_layout'
2019-09-19 00:48:09 +01:00
2020-08-19 01:22:15 +01:00
class ProUpgradeModal extends React . PureComponent {
2019-09-19 00:48:09 +01:00
2020-02-24 23:25:55 +00:00
render ( ) {
2020-07-25 03:27:09 +01:00
const {
intl ,
onClose ,
theme ,
} = this . props
const imgSuffix = ( theme === 'light' || ! theme ) ? 'light' : 'dark'
const title = (
2020-08-18 21:49:11 +01:00
< span className = { [ _s . d , _s . flexRow , _s . jcCenter , _s . aiCenter ] . join ( ' ' ) } >
< span className = { [ _s . d , _s . mr2 ] . join ( ' ' ) } >
2020-07-25 03:27:09 +01:00
Upgrade to Gab
< / s p a n >
2020-08-18 21:43:06 +01:00
< span className = { [ _s . bgPro , _s . cBlack , _s . radiusSmall , _s . px5 , _s . py5 ] . join ( ' ' ) } > PRO < / s p a n >
2020-07-25 03:27:09 +01:00
< / s p a n >
)
2019-09-19 00:48:09 +01:00
return (
2020-04-07 02:53:23 +01:00
< ModalLayout
2020-07-25 03:27:09 +01:00
title = { title }
width = { 540 }
2020-04-07 02:53:23 +01:00
onClose = { onClose }
>
2020-07-25 03:27:09 +01:00
< Text size = 'medium' weight = 'medium' className = { _s . mb10 } >
2020-03-11 23:56:18 +00:00
{ intl . formatMessage ( messages . text ) }
< / T e x t >
2020-07-25 03:27:09 +01:00
< Text size = 'medium' color = 'secondary' >
2020-03-11 23:56:18 +00:00
{ intl . formatMessage ( messages . benefits ) }
< / T e x t >
2020-08-18 21:49:11 +01:00
< div className = { [ _s . d , _s . my10 ] . join ( ' ' ) } >
2020-07-25 03:27:09 +01:00
< Image
src = { ` /headers/pro-features- ${ imgSuffix } .png ` }
width = '100%'
height = 'auto'
fit = 'cover'
2020-08-18 21:43:06 +01:00
className = { [ _s . maxH340PX , _s . minH200PX ] . join ( ' ' ) }
2020-07-25 03:27:09 +01:00
/ >
2019-09-19 00:48:09 +01:00
< / d i v >
2020-02-24 23:25:55 +00:00
2020-08-18 21:49:11 +01:00
< div className = { [ _s . d , _s . flexRow , _s . py10 ] . join ( ' ' ) } >
2020-07-25 03:27:09 +01:00
< Button
isOutline
color = 'brand'
backgroundColor = 'none'
href = { URL _GAB _PRO }
2020-08-18 21:43:06 +01:00
className = { [ _s . flexRow , _s . aiCenter , _s . jcCenter , _s . mr10 ] . join ( ' ' ) }
2020-07-25 03:27:09 +01:00
>
< Text color = 'inherit' weight = 'medium' align = 'center' >
{ intl . formatMessage ( messages . learnMore ) }
< / T e x t >
< / B u t t o n >
< Button
href = { URL _GAB _PRO }
2020-08-18 21:43:06 +01:00
className = { [ _s . flexRow , _s . flexGrow1 , _s . aiCenter , _s . jcCenter ] . join ( ' ' ) }
2020-07-25 03:27:09 +01:00
>
< Text color = 'inherit' size = 'large' weight = 'bold' align = 'center' >
{ intl . formatMessage ( messages . upgrade ) }
< / T e x t >
2020-08-18 21:43:06 +01:00
< Icon id = 'arrow-right' size = '20px' className = { [ _s . cWhite , _s . ml5 ] . join ( ' ' ) } / >
2020-07-25 03:27:09 +01:00
< / B u t t o n >
< / d i v >
2020-02-24 23:25:55 +00:00
< / M o d a l L a y o u t >
)
2019-09-19 00:48:09 +01:00
}
2020-04-08 02:06:59 +01:00
2019-09-19 00:48:09 +01:00
}
2020-08-18 18:07:47 +01:00
const messages = defineMessages ( {
title : { id : 'promo.gab_pro' , defaultMessage : 'Upgrade to GabPRO' } ,
upgrade : { id : 'promo.upgrade' , defaultMessage : 'Upgrade' } ,
learnMore : { id : 'promo.learn_more' , defaultMessage : 'Learn more' } ,
text : { id : 'pro_upgrade_modal.text' , defaultMessage : 'Gab is fully funded by people like you. Please consider supporting us on our mission to defend free expression online for all people.' } ,
benefits : { id : 'pro_upgrade_modal.benefits' , defaultMessage : 'Here are some benefits that GabPRO members receive:' } ,
} )
const mapStateToProps = ( state ) => ( {
theme : state . getIn ( [ 'settings' , 'displayOptions' , 'theme' ] , DEFAULT _THEME ) ,
} )
ProUpgradeModal . propTypes = {
intl : PropTypes . object . isRequired ,
onClose : PropTypes . func . isRequired ,
theme : PropTypes . string . isRequired ,
}
export default injectIntl ( connect ( mapStateToProps ) ( ProUpgradeModal ) )