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

Commit af860ad

Browse files
Merge pull request #512 from unitaryfund/452_architecture
#452: "Platforms"
2 parents 0c0e7f9 + 9802f8b commit af860ad

File tree

10 files changed

+1145
-59
lines changed

10 files changed

+1145
-59
lines changed

src/App.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ form > .row > label {
195195
}
196196

197197
.task-method-item {
198-
display: inline-block;
198+
width: 100%;
199199
text-align: left;
200200
}
201201

src/MainRouter.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ import Token from './views/Token'
1616
import Password from './views/Password'
1717
import Methods from './views/Methods'
1818
import Tasks from './views/Tasks'
19+
import Platforms from './views/Platforms'
1920
import Tags from './views/Tags'
2021
import Submission from './views/Submission'
2122
import Method from './views/Method'
2223
import Task from './views/Task'
24+
import Platform from './views/Platform'
2325
import NotFound from './views/NotFound'
2426

2527
const MainRouter = (props) => {
@@ -44,6 +46,12 @@ const MainRouter = (props) => {
4446
>
4547
<Tasks isLoggedIn={props.isLoggedIn} />
4648
</Route>
49+
<Route
50+
exact
51+
path='/Platforms'
52+
>
53+
<Platforms isLoggedIn={props.isLoggedIn} />
54+
</Route>
4755
<Route
4856
exact
4957
path='/Tags'
@@ -155,6 +163,11 @@ const MainRouter = (props) => {
155163
path='/Task/:id'
156164
render={(p) => <Task {...p} isLoggedIn={props.isLoggedIn} onLogin={props.onLogin} />}
157165
/>
166+
<Route
167+
exact
168+
path='/Platform/:id'
169+
render={(p) => <Platform {...p} isLoggedIn={props.isLoggedIn} onLogin={props.onLogin} />}
170+
/>
158171
<Route component={NotFound} />
159172
</Switch>
160173
</Router>

src/components/CategoryItemBox.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,29 @@ import { faHeart, faExternalLinkAlt, faChartLine } from '@fortawesome/free-solid
88
library.add(faHeart, faExternalLinkAlt, faChartLine)
99

1010
class 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>

src/components/CategoryScroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CategoryScroll extends React.Component {
2323
<div className='row'>
2424
<div className='col-md-12'>
2525
{!this.props.items.length && <p><b>There are no approved items, yet.</b></p>}
26-
{this.props.items.length &&
26+
{(this.props.items.length > 0) &&
2727
<div className='task'>
2828
<div className='row h-100'>
2929
<div className='col-md col h-100'>

src/components/MainNavLeft.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const MainNavLeft = () => {
66
<Nav className='metriq-navbar'>
77
<Nav.Link href='/Tasks' className='metriq-navbar-text'>Tasks</Nav.Link>
88
<Nav.Link href='/Methods' className='metriq-navbar-text'>Methods</Nav.Link>
9+
<Nav.Link href='/Platforms' className='metriq-navbar-text'>Platforms</Nav.Link>
910
<Nav.Link href='/Tags' className='metriq-navbar-text'>Tags</Nav.Link>
1011
<NavDropdown title='About' active='true' className='metriq-navbar-text' alignRight>
1112
<NavDropdown.Item href='/About'><p class='font-weight-bold'>About</p></NavDropdown.Item>

src/views/Method.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class Method extends React.Component {
259259
centered
260260
>
261261
<Modal.Header closeButton>
262-
<Modal.Title>Edit Submission</Modal.Title>
262+
<Modal.Title>Edit Method</Modal.Title>
263263
</Modal.Header>
264264
<Modal.Body>
265265
{(this.state.modalMode === 'Login') &&

0 commit comments

Comments
 (0)