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
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,13 @@ const CopilotOpportunityDetails: FC<{}> = () => {
)
}
{activeTab === CopilotDetailsTabViews.details && <OpportunityDetails opportunity={opportunity} />}
{activeTab === CopilotDetailsTabViews.applications && isAdminOrPM && opportunity && (
{activeTab === CopilotDetailsTabViews.applications && opportunity && (

Choose a reason for hiding this comment

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

The isAdminOrPM prop is being passed to CopilotApplications, but the condition isAdminOrPM has been removed from the check for rendering this component. Ensure that the logic for selectively visible columns is correctly implemented within CopilotApplications based on this prop.

<CopilotApplications
copilotApplications={copilotApplications}
opportunity={opportunity}
members={members}
onApplied={onApplied}
isAdminOrPM
/>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const tableColumns: TableColumn<CopilotApplication>[] = [
},
{
label: 'Actions',
propertyName: '',
propertyName: 'actions',
renderer: CopilotApplicationAction,
type: 'element',
},
Expand All @@ -78,6 +78,7 @@ const CopilotApplications: FC<{
members?: FormattedMembers[]
opportunity: CopilotOpportunity
onApplied: () => void
isAdminOrPM: boolean
}> = props => {
const getData = (): CopilotApplication[] => (props.copilotApplications ? props.copilotApplications.map(item => {
const member = props.members && props.members.find(each => each.userId === item.userId)
Expand All @@ -96,12 +97,18 @@ const CopilotApplications: FC<{

const tableData = useMemo(getData, [props.copilotApplications, props.members])

const visibleColumns = props.isAdminOrPM

Choose a reason for hiding this comment

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

Consider renaming visibleColumns to filteredColumns or userSpecificColumns for clarity, as it indicates that the columns are filtered based on user roles.

? tableColumns
: tableColumns.filter(col => ![

Choose a reason for hiding this comment

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

The filter logic could be extracted into a separate function for better readability and maintainability. For example, const getVisibleColumns = (isAdminOrPM, columns) => { return isAdminOrPM ? columns : columns.filter(...); }.

'fulfilment', 'activeProjects', 'pastProjects', 'notes', 'actions',
].includes(col.propertyName ?? ''))

return (
<div>
{
tableData.length > 0 ? (
<Table
columns={tableColumns}
columns={visibleColumns}
data={tableData}
disableSorting
removeDefaultSort
Expand Down