-
Notifications
You must be signed in to change notification settings - Fork 13
feat(PM-1067): list copilot applications #1068
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
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2ee1f11
feat: list copilot applications
hentrymartin 557e546
fix: review comments
hentrymartin 6acbb53
fix: review comments
hentrymartin ec0e17e
Merge branch 'pm-578' into pm-1067
hentrymartin ca7c666
fix: lint
hentrymartin cf19762
removed circle config
hentrymartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...copilots/src/pages/copilot-opportunity-details/tabs/config/copilot-details-tabs-config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { TabsNavItem } from '~/libs/ui' | ||
|
||
export enum CopilotDetailsTabViews { | ||
details = '0', | ||
applications = '1', | ||
} | ||
|
||
export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean): TabsNavItem[] => (isAdminOrPM ? [ | ||
{ | ||
id: CopilotDetailsTabViews.details, | ||
title: 'Details', | ||
}, | ||
{ | ||
id: CopilotDetailsTabViews.applications, | ||
title: 'Applications', | ||
}, | ||
] : [ | ||
{ | ||
id: CopilotDetailsTabViews.details, | ||
title: 'Details', | ||
}, | ||
]) | ||
|
||
export const CopilotDetailsTabsConfig: TabsNavItem[] = [ | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
id: CopilotDetailsTabViews.details, | ||
title: 'Details', | ||
}, | ||
{ | ||
id: CopilotDetailsTabViews.applications, | ||
title: 'Applications', | ||
}, | ||
] | ||
|
||
export function getHashFromTabId(tabId: string): string { | ||
switch (tabId) { | ||
case CopilotDetailsTabViews.details: | ||
return '#details' | ||
case CopilotDetailsTabViews.applications: | ||
return '#applications' | ||
default: | ||
return '#details' | ||
} | ||
} | ||
|
||
export function getTabIdFromHash(hash: string): string { | ||
switch (hash) { | ||
case '#details': | ||
return CopilotDetailsTabViews.details | ||
case '#applications': | ||
return CopilotDetailsTabViews.applications | ||
default: | ||
return CopilotDetailsTabViews.details | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
...s/src/pages/copilot-opportunity-details/tabs/copilot-applications/CopilotApplications.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { FC, useMemo } from 'react' | ||
|
||
import { Table, TableColumn } from '~/libs/ui' | ||
import { USER_PROFILE_URL } from '~/config/environments/default.env' | ||
|
||
import { CopilotApplication } from '../../../../models/CopilotApplication' | ||
import { FormattedMembers } from '../../../../services/members' | ||
|
||
import styles from './styles.module.scss' | ||
|
||
const tableColumns: TableColumn<CopilotApplication>[] = [ | ||
{ | ||
label: 'Topcoder Handle', | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
propertyName: 'handle', | ||
renderer: (copilotApplication: CopilotApplication) => ( | ||
<a | ||
href={`${USER_PROFILE_URL}/${copilotApplication.handle}`} | ||
target='_blank' | ||
rel='noreferrer' | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
> | ||
{copilotApplication.handle} | ||
</a> | ||
), | ||
type: 'element', | ||
}, | ||
{ | ||
label: 'Fulfillment Rating', | ||
propertyName: 'fulfilment', | ||
type: 'text', | ||
}, | ||
{ | ||
label: 'Active Projects', | ||
propertyName: 'activeProjects', | ||
type: 'text', | ||
}, | ||
{ | ||
label: 'Applied Date', | ||
propertyName: 'createdAt', | ||
type: 'date', | ||
}, | ||
{ | ||
label: 'Notes', | ||
propertyName: 'notes', | ||
renderer: (copilotApplication: CopilotApplication) => ( | ||
<div className={styles.title}> | ||
{copilotApplication.notes} | ||
</div> | ||
), | ||
type: 'element', | ||
}, | ||
] | ||
|
||
const CopilotApplications: FC<{ | ||
copilotApplications?: CopilotApplication[] | ||
members?: FormattedMembers[] | ||
}> = props => { | ||
const getData = (): CopilotApplication[] => (props.copilotApplications ? props.copilotApplications.map(item => { | ||
const member = props.members && props.members.find(each => each.userId === item.userId) | ||
return { | ||
...item, | ||
activeProjects: member?.activeProjects || 0, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fulfilment: member?.copilotFulfillment || 0, | ||
handle: member?.handle, | ||
} | ||
}) | ||
.sort((a, b) => (b.fulfilment || 0) - (a.fulfilment || 0)) : []) | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const tableData = useMemo(getData, [props.copilotApplications, props.members]) | ||
|
||
return ( | ||
<div> | ||
{ | ||
tableData.length > 0 && ( | ||
<Table | ||
columns={tableColumns} | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data={tableData} | ||
disableSorting | ||
removeDefaultSort | ||
preventDefault | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/> | ||
) | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
export default CopilotApplications |
1 change: 1 addition & 0 deletions
1
src/apps/copilots/src/pages/copilot-opportunity-details/tabs/copilot-applications/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as CopilotApplications } from './CopilotApplications' |
Empty file.
35 changes: 35 additions & 0 deletions
35
...ots/src/pages/copilot-opportunity-details/tabs/opportunity-details/OpportunityDetails.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { FC } from 'react' | ||
|
||
import { CopilotOpportunity } from '../../../../models/CopilotOpportunity' | ||
|
||
import styles from './styles.module.scss' | ||
|
||
const OpportunityDetails: FC<{ | ||
opportunity?: CopilotOpportunity | ||
}> = props => ( | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div className={styles.content}> | ||
<div> | ||
<h2 className={styles.subHeading}> Required skills </h2> | ||
<div className={styles.skillsContainer}> | ||
{props.opportunity?.skills.map((skill: any) => ( | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div key={skill.id} className={styles.skillPill}> | ||
{skill.name} | ||
</div> | ||
))} | ||
</div> | ||
<h2 className={styles.subHeading}> Description </h2> | ||
<p> | ||
{props.opportunity?.overview} | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</p> | ||
</div> | ||
<div> | ||
<h2 className={styles.subHeading}> Complexity </h2> | ||
<span className={styles.textCaps}>{props.opportunity?.complexity}</span> | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<h2 className={styles.subHeading}> Requires Communication </h2> | ||
<span className={styles.textCaps}>{props.opportunity?.requiresCommunication}</span> | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
</div> | ||
) | ||
|
||
export default OpportunityDetails |
1 change: 1 addition & 0 deletions
1
src/apps/copilots/src/pages/copilot-opportunity-details/tabs/opportunity-details/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as OpportunityDetails } from './OpportunityDetails' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.