import { Component } from 'react'; import { observer } from 'mobx-react'; import { defineMessages, injectIntl } from 'react-intl'; import Markdown from 'markdown-to-jsx'; import { ferdiumVersion } from '../../../environment-remote'; import { getFerdiumVersion, getUpdateInfoFromGH, } from '../../../helpers/update-helpers'; const messages = defineMessages({ headline: { id: 'settings.releasenotes.headline', defaultMessage: 'Release Notes', }, connectionError: { id: 'settings.releasenotes.connectionError', defaultMessage: 'An error occured when connecting to Github, please try again later.', }, connectionErrorPageMissing: { id: 'settings.releasenotes.connectionErrorPageMissing', defaultMessage: 'An error occured when connecting to Github, the page you are looking for is missing.', }, }); interface IProps { intl: any; } class ReleaseNotesDashboard extends Component { state = { data: '', }; constructor(props) { super(props); this.state = { data: '' }; } async componentDidMount() { const { intl } = this.props; const data = await getUpdateInfoFromGH( window.location.href, ferdiumVersion, intl, ); this.setState({ data, }); } overrideAnchor = props => ( // eslint-disable-next-line jsx-a11y/anchor-has-content ); render() { const { intl } = this.props; const { data } = this.state; return (
Ferdium {getFerdiumVersion(window.location.href, ferdiumVersion)}{' '} {' | '} {intl.formatMessage(messages.headline)}
{data}
); } } export default injectIntl(observer(ReleaseNotesDashboard));