Gab-Social/app/javascript/gabsocial/components/bundle_column_error.js

110 lines
3.3 KiB
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
2020-05-14 20:45:39 +00:00
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'
import {
source_url,
version,
} from '../initial_state'
import {
APP_NAME,
DEFAULT_REL,
} from '../constants'
2020-03-26 03:11:32 +00:00
import Button from './button'
2020-05-14 20:45:39 +00:00
import Divider from './divider'
import Icon from './icon'
import Text from './text'
2019-07-02 07:10:25 +00:00
class BundleColumnError extends React.PureComponent {
2019-07-02 07:10:25 +00:00
handleRetry = () => {
2020-03-24 04:39:12 +00:00
this.props.onRetry()
2019-07-02 07:10:25 +00:00
}
render () {
2020-03-24 04:39:12 +00:00
const { intl: { formatMessage } } = this.props
2019-07-02 07:10:25 +00:00
return (
<div className={[_s.d, _s.minH100VH, _s.w100PC, _s.aiCenter, _s.jcCenter].join(' ')}>
<div className={[_s.d, _s.minH53PX, _s.bgBrand, _s.aiCenter, _s.z3, _s.top0, _s.right0, _s.left0, _s.posFixed].join(' ')} >
<div className={[_s.d, _s.flexRow, _s.saveAreaInsetPT, _s.saveAreaInsetPL, _s.saveAreaInsetPR, _s.w1255PX].join(' ')}>
2020-05-14 20:45:39 +00:00
<div className={[_s.d, _s.flexRow].join(' ')}>
2020-05-14 20:45:39 +00:00
<h1 className={[_s.d, _s.mr15].join(' ')}>
<Button href='/' isText aria-label='Gab' className={[_s.d, _s.jcCenter, _s.noSelect, _s.noUnderline, _s.h53PX, _s.cursorPointer, _s.px10, _s.mr15].join(' ')}>
<Icon id='logo' className={_s.fillWhite} />
2020-05-14 20:45:39 +00:00
</Button>
</h1>
</div>
</div>
</div>
<div className={[_s.d, _s.maxW640PX, _s.px15, _s.py10].join(' ')}>
2020-05-14 20:45:39 +00:00
<Icon id='warning' size='28px' className={[_s.d, _s.cSecondary, _s.mb15].join(' ')} />
2020-05-14 20:45:39 +00:00
<Text size='medium' className={_s.pt15}>
{formatMessage(messages.body)}
</Text>
<div className={[_s.d, _s.py10, _s.my10].join(' ')}>
2020-05-14 20:45:39 +00:00
<Text>
{APP_NAME} ({version})
</Text>
<div className={[_s.d, _s.flexRow, _s.mt10, _s.aiCenter].join(' ')}>
2020-05-14 20:45:39 +00:00
<Button
isText
href={source_url}
rel={DEFAULT_REL}
target='_blank'
backgroundColor='tertiary'
color='primary'
radiusSmall
className={[_s.py2, _s.px10].join(' ')}
>
<Text color='inherit'>
<FormattedMessage
id='errors.unexpected_crash.report_issue'
defaultMessage='Report issue'
/>
</Text>
</Button>
</div>
</div>
<Divider />
<div className={[_s.d, _s.flexRow].join(' ')}>
2020-05-14 20:45:39 +00:00
<Button
icon='repost'
href='#'
2020-05-14 20:45:39 +00:00
onClick={this.handleRetry} size={64}
>
<Text align='center' color='inherit' className={_s.ml5}>
{formatMessage(messages.retry)}
</Text>
</Button>
</div>
</div>
2020-02-24 23:25:55 +00:00
</div>
2020-03-24 04:39:12 +00:00
)
2019-07-02 07:10:25 +00:00
}
}
const messages = defineMessages({
title: { id: 'bundle_column_error.title', defaultMessage: 'Network error' },
body: { id: 'bundle_column_error.body', defaultMessage: 'Something went wrong while loading this component.' },
retry: { id: 'bundle_column_error.retry', defaultMessage: 'Try again' },
})
BundleColumnError.propTypes = {
onRetry: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
export default injectIntl(BundleColumnError)