-
Notifications
You must be signed in to change notification settings - Fork 13
fix(PM-580): dont show action button when invite is inprogress #1087
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import { useParams } from 'react-router-dom' | ||
import { toast } from 'react-toastify' | ||
import { mutate } from 'swr' | ||
import { useCallback } from 'react' | ||
import { useCallback, useMemo } from 'react' | ||
|
||
import { assignCopilotOpportunity, copilotBaseUrl } from '~/apps/copilots/src/services/copilot-opportunities' | ||
import { CopilotApplication, CopilotApplicationStatus } from '~/apps/copilots/src/models/CopilotApplication' | ||
import { IconSolid, Tooltip } from '~/libs/ui' | ||
|
||
import styles from './styles.module.scss' | ||
|
||
const CopilotApplicationAction = (copilotApplication: CopilotApplication): JSX.Element => { | ||
const CopilotApplicationAction = ( | ||
copilotApplication: CopilotApplication, | ||
allCopilotApplications: CopilotApplication[], | ||
): JSX.Element => { | ||
const { opportunityId }: {opportunityId?: string} = useParams<{ opportunityId?: string }>() | ||
const isInvited = useMemo( | ||
() => allCopilotApplications.findIndex(item => item.status === CopilotApplicationStatus.INVITED) > -1, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[allCopilotApplications], | ||
) | ||
const onClick = useCallback(async () => { | ||
if (copilotApplication.status !== CopilotApplicationStatus.PENDING) { | ||
return | ||
|
@@ -39,7 +46,7 @@ const CopilotApplicationAction = (copilotApplication: CopilotApplication): JSX.E | |
} | ||
|
||
{ | ||
copilotApplication.status === CopilotApplicationStatus.PENDING && ( | ||
!isInvited && copilotApplication.status === CopilotApplicationStatus.PENDING && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a check for |
||
<IconSolid.UserAddIcon /> | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,7 @@ const Table: <T extends { [propertyName: string]: any }>(props: TableProps<T>) = | |
<TableRow | ||
key={getKey(index)} | ||
data={sorted} | ||
allRows={sortedData} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The addition of the |
||
onRowClick={props.onRowClick} | ||
columns={props.columns} | ||
index={index} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,14 @@ interface TableCellProps<T> { | |
readonly index: number | ||
readonly propertyName?: string | ||
readonly className?: string | ||
readonly renderer?: (data: T) => JSX.Element | undefined | ||
readonly renderer?: (data: T, allRows?: ReadonlyArray<T>) => JSX.Element | undefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
readonly type: TableCellType | ||
readonly onExpand?: () => void | ||
readonly as?: ElementType | ||
readonly showExpandIndicator?: boolean | ||
readonly isExpanded?: boolean | ||
readonly colSpan?: number | ||
allRows?: ReadonlyArray<T> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
const TableCell: <T extends { [propertyName: string]: any }>( | ||
|
@@ -40,7 +41,7 @@ const TableCell: <T extends { [propertyName: string]: any }>( | |
case 'action': | ||
case 'element': | ||
case 'numberElement': | ||
data = props.renderer?.(props.data) | ||
data = props.renderer?.(props.data, props.allRows) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
break | ||
case 'money': | ||
data = textFormatMoneyLocaleString( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ interface Props<T> { | |
index: number | ||
readonly showExpand?: boolean | ||
readonly preventDefault?: boolean | ||
allRows?: ReadonlyArray<T> | ||
} | ||
|
||
export const TableRow: <T extends { [propertyName: string]: any }>( | ||
|
@@ -50,6 +51,7 @@ export const TableRow: <T extends { [propertyName: string]: any }>( | |
{...col} | ||
data={props.data} | ||
index={props.index} | ||
allRows={props.allRows} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The addition of the |
||
key={getKey(`${props.index}${colIndex}`)} | ||
showExpandIndicator={colIndex === 0 && props.showExpand} | ||
isExpanded={isExpanded && colIndex === 0} | ||
|
Uh oh!
There was an error while loading. Please reload this page.