Skip to content

fix(PM-1310): show types propertly in opportunity details page #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
} from '../../services/copilot-opportunities'
import { FormattedMembers, useMembers } from '../../services/members'
import { copilotRoutesMap } from '../../copilots.routes'
import { ProjectType } from '../../constants'

import { ApplyOpportunityModal } from './apply-opportunity-modal'
import {
Expand Down Expand Up @@ -127,6 +128,21 @@ const CopilotOpportunityDetails: FC<{}> = () => {
const application = copilotApplications && copilotApplications[0]
const isAlreadyMemberOfTheProject = profile && opportunity?.members?.includes(profile.userId)

const getOpportunityType = (type: string): ProjectType => {
switch (type) {
case 'ai':
return ProjectType.ai
case 'datascience':
return ProjectType.datascience
case 'dev':
return ProjectType.developement

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: 'developement' should be corrected to 'development'.

case 'design':
return ProjectType.design
default:
return ProjectType.qa
}
}

return (
<ContentLayout
title='Copilot Opportunity'
Expand Down Expand Up @@ -204,7 +220,11 @@ const CopilotOpportunityDetails: FC<{}> = () => {
<IconOutline.CogIcon className={styles.icon} />
<div className={styles.infoText}>
<span className={styles.infoHeading}>Type</span>
<span className={styles.infoValue}>{opportunity?.type}</span>
<span
className={styles.infoValue}
>
{opportunity?.type && getOpportunityType(opportunity?.type)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider checking if getOpportunityType function handles all possible values of opportunity?.type to avoid unexpected results or errors. If getOpportunityType can return null or undefined, ensure that the UI handles these cases gracefully.

</span>
</div>
</div>
<div className={styles.infoColumn}>
Expand Down