Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit dc46052

Browse files
Merge pull request #482 from unitaryfund/217_submission_tag_list
#217: Submission tag lists (front-end)
2 parents 79eb011 + 577fd13 commit dc46052

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/components/SubmissionBox.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ class SubmissionBox extends React.Component {
1818
this.state = {
1919
upvotes: props.item.upvotesCount || 0,
2020
isUpvoted: props.item.isUpvoted,
21+
tags: props.item.tags.map((obj, ind) => obj.name),
2122
description: !this.props.item.description ? '' : ((this.props.item.description.length > 500) ? (this.props.item.description.substring(0, 497) + '...') : this.props.item.description)
2223
}
2324

25+
console.log(this.state.tags)
26+
2427
this.handleUpVoteOnClick = this.handleUpVoteOnClick.bind(this)
2528
this.handleDeleteOnClick = this.handleDeleteOnClick.bind(this)
2629
this.handleExternalLinkClick = this.handleExternalLinkClick.bind(this)
@@ -89,6 +92,10 @@ class SubmissionBox extends React.Component {
8992
<div className='submission-description'>
9093
{this.state.description ? this.state.description.replace(/\0.*$/g, '').split('. ')[0] + '.' : <i>(No description provided.)</i>}
9194
</div>
95+
{this.state.tags.length > 0 &&
96+
<div className='submission-description'>
97+
<b>Tags: </b>{this.state.tags.map((obj, ind) => <span key={obj}>{ind > 0 && <span></span>}<Link to={'/Tag/' + obj}><span className='link'>{obj}</span></Link></span>)}
98+
</div>}
9299
</div>
93100
<div className='col-md-2 col-sm-12 h-100' />
94101
</div>

src/views/Home.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ const Home = (props) => {
88
<br />
99
<Tabs defaultActiveKey='trending' id='top-submissions-tabs'>
1010
<Tab eventKey='trending' title='Trending' className='metriq-nav-tab'>
11-
<SubmissionScroll sortType='trending' isLoggedIn={props.isLoggedIn} tag={props.match ? props.match.params.tag : ''} />
11+
<SubmissionScroll sortType='trending' isLoggedIn={props.isLoggedIn} tag={props.match ? props.match.params.tag : ''} key={Math.random()} />
1212
</Tab>
1313
<Tab eventKey='popular' title='Popular'>
14-
<SubmissionScroll sortType='popular' isLoggedIn={props.isLoggedIn} tag={props.match ? props.match.params.tag : ''} />
14+
<SubmissionScroll sortType='popular' isLoggedIn={props.isLoggedIn} tag={props.match ? props.match.params.tag : ''} key={Math.random()} />
1515
</Tab>
1616
<Tab eventKey='latest' title='Latest'>
17-
<SubmissionScroll sortType='latest' isLoggedIn={props.isLoggedIn} tag={props.match ? props.match.params.tag : ''} />
17+
<SubmissionScroll sortType='latest' isLoggedIn={props.isLoggedIn} tag={props.match ? props.match.params.tag : ''} key={Math.random()} />
1818
</Tab>
1919
</Tabs>
2020
</div>

0 commit comments

Comments
 (0)