diff --git a/src/app/submissions/signature/verdictSignature.js b/src/app/submissions/signature/verdictSignature.js index 77b7384..ca53614 100644 --- a/src/app/submissions/signature/verdictSignature.js +++ b/src/app/submissions/signature/verdictSignature.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React from 'react'; import { Typography, Grid } from '@material-ui/core'; import AcceptedVerdictIcon from './verdictIcons/acceptedVerdictSignature.js'; @@ -59,49 +59,40 @@ const color = { CE: '#632920' }; -class VerdictSignature extends Component { - constructor(props) { - super(props); - // in order to allow reversion, we render HERE. - this.state = { - icon: ( - - {verdictIcon[this.props.verdict] ? verdictIcon[this.props.verdict] : verdictIcon['Unknown']} - - ), - verdictText: ( - - - {verdictIcon[this.props.verdict] - ? props.t(`submissions.verdict.${this.props.verdict}`) - : this.props.verdict} - {/* if known verdict, display the respective icon, else - render the verdict directly */} - - - ) - }; - } +class VerdictSignature extends React.PureComponent { render() { - if (this.props.iconOnly) return this.state.icon; + const { verdict, reversed, success, t } = this.props; + const icon = {verdictIcon[verdict] ? verdictIcon[verdict] : verdictIcon['Unknown']}; + + const verdictText = ( + + + {verdictIcon[verdict] ? t(`submissions.verdict.${verdict}`) : verdict} + {/* if known verdict, display the respective icon, else + render the verdict directly */} + + + ); + + if (this.props.iconOnly) return icon; else return ( - {this.props.reversed ? ( + {reversed ? ( <> - {this.state.verdictText} - {this.state.icon} + {verdictText} + {icon} ) : ( <> - {this.state.icon} - {this.state.verdictText} + {icon} + {verdictText} )}