@@ -8,13 +8,29 @@ import { faHeart, faExternalLinkAlt, faChartLine } from '@fortawesome/free-solid
88library . add ( faHeart , faExternalLinkAlt , faChartLine )
99
1010class CategoryItemBox extends React . Component {
11+ constructor ( props ) {
12+ super ( props )
13+ this . state = {
14+ detailUrl : ''
15+ }
16+ if ( this . props . type === 'tag' ) {
17+ this . state . detailUrl = ( '/Tag/' + this . props . item . name )
18+ } else if ( this . props . type === 'task' ) {
19+ this . state . detailUrl = ( '/Task/' + this . props . item . id )
20+ } else if ( this . props . type === 'method' ) {
21+ this . state . detailUrl = ( '/Method/' + this . props . item . id )
22+ } else if ( this . props . type === 'platform' ) {
23+ this . state . detailUrl = ( '/Platform/' + this . props . item . id )
24+ }
25+ }
26+
1127 render ( ) {
1228 return (
1329 < tr >
1430 < td >
1531 < div className = 'row submission' >
1632 < div className = 'col-md-9' >
17- < a href = { ( this . props . type === 'tag' ) ? ( '/Tag/' + this . props . item . name ) : ( ( ( this . props . type === 'task' ) ? '/Task/' : '/Method/' ) + this . props . item . id ) } >
33+ < a href = { this . state . detailUrl } >
1834 { this . props . type !== 'tag' && this . props . item . description &&
1935 < div >
2036 < div className = 'submission-heading' > { this . props . item . name } </ div >
@@ -25,17 +41,17 @@ class CategoryItemBox extends React.Component {
2541 </ a >
2642 </ div >
2743 < div className = 'col-md-1' >
28- < OverlayTrigger placement = 'top' overlay = { props => < Tooltip { ...props } > Count of results, with { ( this . props . type === 'tag' ) ? ( 'tag' ) : ( ( ( this . props . type === 'task' ) ? 'task' : 'method' ) ) } </ Tooltip > } >
44+ < OverlayTrigger placement = 'top' overlay = { props => < Tooltip { ...props } > Count of results, with { this . props . type } </ Tooltip > } >
2945 < span > < FontAwesomeIcon icon = { faChartLine } /> < br /> { this . props . item . resultCount } </ span >
3046 </ OverlayTrigger >
3147 </ div >
3248 < div className = 'col-md-1' >
33- < OverlayTrigger placement = 'top' overlay = { props => < Tooltip { ...props } > Count of submissions, with { ( this . props . type === 'tag' ) ? ( 'tag' ) : ( ( ( this . props . type === 'task' ) ? 'task' : 'method' ) ) } </ Tooltip > } >
49+ < OverlayTrigger placement = 'top' overlay = { props => < Tooltip { ...props } > Count of submissions, with { this . props . type } </ Tooltip > } >
3450 < span > < FontAwesomeIcon icon = { faExternalLinkAlt } /> < br /> { this . props . item . submissionCount } </ span >
3551 </ OverlayTrigger >
3652 </ div >
3753 < div className = 'col-md-1' >
38- < OverlayTrigger placement = 'top' overlay = { props => < Tooltip { ...props } > Count of up-votes, for all submissions with { ( this . props . type === 'tag' ) ? ( 'tag' ) : ( ( ( this . props . type === 'task' ) ? 'task' : 'method' ) ) } </ Tooltip > } >
54+ < OverlayTrigger placement = 'top' overlay = { props => < Tooltip { ...props } > Count of up-votes, for all submissions with { this . props . type } </ Tooltip > } >
3955 < span > < FontAwesomeIcon icon = { faHeart } /> < br /> { this . props . item . upvoteTotal } </ span >
4056 </ OverlayTrigger >
4157 </ div >
0 commit comments