Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/actions/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function loadChallengesByPage (page, projectId, status, filterChallengeNa
}
if (selfService) {
filters.selfService = true
if (userHandle && filters.status.toUpperCase() !== CHALLENGE_STATUS.DRAFT) {
if (userHandle && filters.status.toUpperCase() !== CHALLENGE_STATUS.DRAFT && filters.status.toUpperCase() !== CHALLENGE_STATUS.NEW) {
filters.selfServiceCopilot = userHandle
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/components/ChallengeEditor/Description-Field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ class DescriptionField extends Component {
}
})
} else {
this.ref.current.innerHTML = challenge[type] ? marked(challenge[type]) : ''
if (challenge.legacy.selfService) {
const regex = new RegExp('{{[a-zA-Z0-9.]+}}', 'g')
const newDescription = challenge[type] ? challenge[type].replace(regex, '<span style="color:red">MISSING DATA FROM INTAKE FORM</span>') : ''
this.ref.current.innerHTML = marked(newDescription)
} else {
this.ref.current.innerHTML = challenge[type] ? marked(challenge[type]) : ''
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ class ChallengeEditor extends Component {
)}
</div>
<div className={styles.group}>
<div className={styles.title}>Public specification <span>*</span></div>
<div className={styles.title}>Public specification<span>*</span></div>
<div className={styles.templateLink}>
<i>Access specification templates <a href='https://github.com/topcoder-platform-templates/specification-templates' target='_blank'>here</a></i>
</div>
Expand Down
17 changes: 15 additions & 2 deletions src/components/ChallengesComponent/ChallengeList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Message from '../Message'
import {
CHALLENGE_STATUS
} from '../../../config/constants'
import { checkAdmin } from '../../../util/tc'

require('bootstrap/scss/bootstrap.scss')

Expand Down Expand Up @@ -105,6 +106,9 @@ class ChallengeList extends Component {
}

getHandle () {
if (checkAdmin(this.props.auth.token)) {
return null
}
return this.props.auth && this.props.auth.user ? this.props.auth.user.handle : null
}

Expand All @@ -130,9 +134,11 @@ class ChallengeList extends Component {
let selectedTab = 0
switch (status) {
case CHALLENGE_STATUS.APPROVED:
case CHALLENGE_STATUS.NEW:
selectedTab = 1
break
case CHALLENGE_STATUS.NEW:
selectedTab = selfService ? 3 : 1
break
case CHALLENGE_STATUS.DRAFT:
selectedTab = 2
break
Expand Down Expand Up @@ -194,7 +200,8 @@ class ChallengeList extends Component {
break
}
case 3: {
this.directUpdateSearchParam(searchText, CHALLENGE_STATUS.COMPLETED)
const status = selfService ? CHALLENGE_STATUS.NEW : CHALLENGE_STATUS.COMPLETED
this.directUpdateSearchParam(searchText, status)
break
}
case 4: {
Expand All @@ -203,12 +210,18 @@ class ChallengeList extends Component {
}
}
}}>
{
selfService && <h4>Total Challenges: {totalChallenges}</h4>
}
<TabList>
<Tab>{(selfService ? 'Assigned challenges' : 'Active')}</Tab>
<Tab>{(selfService ? 'Approved' : 'New')}</Tab>
<Tab>{this.getStatusTextFunc(selfService)(CHALLENGE_STATUS.DRAFT)}</Tab>
{(!selfService && <Tab>Completed</Tab>)}
{(!selfService && <Tab>Cancelled</Tab>)}
{
selfService && checkAdmin(this.props.auth.token) && <Tab>Draft</Tab>
}
</TabList>
<TabPanel />
<TabPanel />
Expand Down
43 changes: 25 additions & 18 deletions src/containers/Challenges/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { loadProject } from '../../actions/projects'
import { loadProjects, setActiveProject, resetSidebarActiveParams } from '../../actions/sidebar'
import { CHALLENGE_STATUS } from '../../config/constants'
import styles from './Challenges.module.scss'
import { checkAdmin } from '../../util/tc'

class Challenges extends Component {
constructor (props) {
Expand Down Expand Up @@ -48,7 +49,8 @@ class Challenges extends Component {
reloadChallenges (props) {
const { activeProjectId, projectDetail: reduxProjectInfo, projectId, challengeProjectId, loadProject, selfService } = props
if (activeProjectId !== challengeProjectId || selfService) {
this.props.loadChallengesByPage(1, projectId ? parseInt(projectId) : -1, CHALLENGE_STATUS.ACTIVE, '', selfService)
const isAdmin = checkAdmin(this.props.auth.token)
this.props.loadChallengesByPage(1, projectId ? parseInt(projectId) : -1, CHALLENGE_STATUS.ACTIVE, '', selfService, isAdmin ? null : this.props.auth.user.handle)
if (!selfService && (!reduxProjectInfo || `${reduxProjectInfo.id}` !== projectId)
) {
loadProject(projectId)
Expand All @@ -68,6 +70,7 @@ class Challenges extends Component {
}

render () {
console.log('im here', this.props.auth)
const {
challenges,
isLoading,
Expand Down Expand Up @@ -103,23 +106,27 @@ class Challenges extends Component {
return (
<Fragment>
<div className={styles.projectSearch}>
<div className={styles.projectSearchHeader}>
<label>Switch Project</label>
<DebounceInput
minLength={2}
debounceTimeout={300}
placeholder='Search projects (Enter project id or project title in double quotes or any text from project)'
onChange={(e) => this.updateProjectName(e.target.value)}
value={searchProjectName}
/>
<input
type='checkbox'
label='My Projects'
checked={onlyMyProjects}
onChange={this.toggleMyProjects}
/>
<label>My Projects</label>
</div>
{
!selfService && (
<div className={styles.projectSearchHeader}>
<label>Switch Project</label>
<DebounceInput
minLength={2}
debounceTimeout={300}
placeholder='Search projects (Enter project id or project title in double quotes or any text from project)'
onChange={(e) => this.updateProjectName(e.target.value)}
value={searchProjectName}
/>
<input
type='checkbox'
label='My Projects'
checked={onlyMyProjects}
onChange={this.toggleMyProjects}
/>
<label>My Projects</label>
</div>
)
}
{
activeProjectId === -1 && !selfService && <div>No project selected. Select one below</div>
}
Expand Down