@ -1,3 +1,4 @@
import { DateTime } from 'luxon'
import React , { PureComponent } from 'react'
import React , { PureComponent } from 'react'
import PropTypes from 'prop-types'
import PropTypes from 'prop-types'
import HomeNotification from '../home-notification'
import HomeNotification from '../home-notification'
@ -8,18 +9,37 @@ export default class DaiV1MigrationNotification extends PureComponent {
}
}
static defaultProps = {
static defaultProps = {
mkrMigrationReminderTimestamp : null ,
string : '' ,
string : '' ,
symbol : '' ,
symbol : '' ,
}
}
static propTypes = {
static propTypes = {
setMkrMigrationReminderTimestamp : PropTypes . func . isRequired ,
mkrMigrationReminderTimestamp : PropTypes . string ,
string : PropTypes . string ,
string : PropTypes . string ,
symbol : PropTypes . string ,
symbol : PropTypes . string ,
}
}
remindMeLater = ( ) => {
const nextWeek = DateTime . utc ( ) . plus ( {
days : 7 ,
} )
this . props . setMkrMigrationReminderTimestamp ( nextWeek . toString ( ) )
}
render ( ) {
render ( ) {
const { t } = this . context
const { t } = this . context
const { string : balanceString , symbol } = this . props
const { mkrMigrationReminderTimestamp , string : balanceString , symbol } = this . props
if ( mkrMigrationReminderTimestamp ) {
const reminderDateTime = DateTime . fromISO ( mkrMigrationReminderTimestamp , {
zone : 'UTC' ,
} )
if ( reminderDateTime > DateTime . utc ( ) ) {
return null
}
}
if ( ! balanceString || ! symbol ) {
if ( ! balanceString || ! symbol ) {
return null
return null
@ -31,15 +51,27 @@ export default class DaiV1MigrationNotification extends PureComponent {
return (
return (
< HomeNotification
< HomeNotification
descriptionText = { t ( 'migrateSai' ) }
descriptionText = { (
< div >
{ t ( 'migrateSai' ) }
& nbsp ;
< a
href = "#"
onClick = { ( ) => {
window . open ( 'https://blog.makerdao.com/multi-collateral-dai-is-live/' , '_blank' , 'noopener' )
} }
>
{ t ( 'learnMore' ) } .
< / a >
< / d i v >
) }
acceptText = { t ( 'migrate' ) }
acceptText = { t ( 'migrate' ) }
onAccept = { ( ) => {
onAccept = { ( ) => {
window . open ( 'https://migrate.makerdao.com' , '_blank' , 'noopener' )
window . open ( 'https://migrate.makerdao.com' , '_blank' , 'noopener' )
} }
} }
ignoreText = { t ( 'learnMore' ) }
ignoreText = { t ( 'remindMeLater' ) }
onIgnore = { ( ) => {
onIgnore = { this . remindMeLater }
window . open ( 'https://blog.makerdao.com/multi-collateral-dai-is-live/' , '_blank' , 'noopener' )
infoText = { t ( 'migrateSaiInfo' ) }
} }
/ >
/ >
)
)
}
}