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
53 changes: 40 additions & 13 deletions src/components/MenuItem/MenuItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,54 @@ const MenuItem = ({
match,
wrapperClass,
toolTipText,
enforceA,
openNewTab,
}) => {
const matchedPath = match && match.path
const isChildActive = children && some(children, c => c.to === matchedPath)

const linkContent = (
<span styleName="content">
<span styleName="left">
{!!Icon && (
<Icon className={cn(styles.icon, styles[iconClassName])} />
)}
{label}
</span>
<span styleName="right">
{!!count && <NotificationBadge count={count} text={toolTipText} />}
</span>
</span>
)

return (
<li className={
cn(wrapperClass,
styles.menuItem,
{ [styles.open]: isAccordionOpen, [styles.withChildren]: children })}
>
{!children && (
{!children && !enforceA && (
<NavLink
to={to}
className={styles.navItem}
activeClassName={styles.active}
exact={exact}
isActive={isActive}
>
<span styleName="content">
<span styleName="left">
{!!Icon && (
<Icon className={cn(styles.icon, styles[iconClassName])} />
)}
{label}
</span>
<span styleName="right">
{!!count && <NotificationBadge count={count} text={toolTipText} />}
</span>
</span>
{linkContent}
</NavLink>
)}

{!children && enforceA && (
<a
href={to}
className={styles.navItem}
target={openNewTab ? '_blank' : ''}
>
{linkContent}
</a>
)}

{children && (
<div>
<div
Expand Down Expand Up @@ -91,7 +107,9 @@ const MenuItem = ({
}

MenuItem.defaultProps = {
exact: true
exact: true,
enforceA: false,
openNewTab: false,
}

MenuItem.propTypes = {
Expand All @@ -107,6 +125,15 @@ MenuItem.propTypes = {
onAccordionToggle: PT.func,
wrapperClass: PT.string,
toolTipText: PT.string,
/**
* Render as regular link `<a>` instead of React Router `<NavLink>`
*/
enforceA: PT.bool,
/**
* Open link in the new tab.
* Only works if `enforceA` is `true`.
*/
openNewTab: PT.bool,
}

export default withRouter(MenuItem)
4 changes: 3 additions & 1 deletion src/components/UserSidebar/UserSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ const navLinks = [{
iconClassName: 'fill',
}, {
label: 'GIVE APPLICATION FEEDBACK',
to: '/',
to: 'https://forms.gle/hwRWYB3cGQnKVpjk7',
enforceA: true,
openNewTab: true,
Icon: FAQIcon,
iconClassName: 'fill',
}]
Expand Down
12 changes: 6 additions & 6 deletions src/projects/detail/containers/ProjectInfoContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
PROJECT_ROLE_MANAGER,
DIRECT_PROJECT_URL,
SALESFORCE_PROJECT_LEAD_LINK,
WORK_MANAGER_APP,
PROJECT_STATUS_CANCELLED,
PROJECT_STATUS_ACTIVE,
PROJECT_STATUS_COMPLETED,
Expand All @@ -26,7 +25,6 @@ import {
PROJECT_ROLE_PROJECT_MANAGER,
PROJECT_ROLE_PROGRAM_MANAGER,
PROJECT_ROLE_SOLUTION_ARCHITECT,
PROJECT_CATEGORY_TAAS,
} from '../../../config/constants'
import PERMISSIONS from '../../../config/permissions'
import { hasPermission } from '../../../helpers/permissions'
Expand Down Expand Up @@ -436,7 +434,7 @@ class ProjectInfoContainer extends React.Component {
? _.find(projectTemplates, pt => pt.id === projectTemplateId)
: getProjectTemplateByKey(projectTemplates, projectTemplateKey)

const isTaaS = PROJECT_CATEGORY_TAAS === projectTemplate.category
// const isTaaS = PROJECT_CATEGORY_TAAS === projectTemplate.category
let directLinks = null
// check if direct links need to be added
const isMemberOrCopilot = _.indexOf([
Expand All @@ -448,8 +446,8 @@ class ProjectInfoContainer extends React.Component {
], currentMemberRole) > -1
if (isMemberOrCopilot || isSuperUser) {
directLinks = []
if(!isTaaS)
directLinks.push({name: 'Launch Work Manager', href: `${WORK_MANAGER_APP}/${project.id}/challenges`})
// if(!isTaaS)
// directLinks.push({name: 'Launch Work Manager', href: `${WORK_MANAGER_APP}/${project.id}/challenges`})
if (project.directProjectId) {
directLinks.push({name: 'Project in Topcoder Direct', href: `${DIRECT_PROJECT_URL}${project.directProjectId}`})
} else {
Expand Down Expand Up @@ -596,7 +594,9 @@ class ProjectInfoContainer extends React.Component {
navLinks={[
{
label: 'GIVE APPLICATION FEEDBACK',
to: '/',
to: 'https://forms.gle/hwRWYB3cGQnKVpjk7',
enforceA: true,
openNewTab: true,
Icon: FAQIcon,
iconClassName: 'fill',
}
Expand Down