-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17f1e15
commit 0542573
Showing
5 changed files
with
95 additions
and
19 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
src/web/components/ParticipantRequests/AllParticipantsTable.tsx
This file contains 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,59 @@ | ||
import { ParticipantTypeDTO } from '../../../api/entities/ParticipantType'; | ||
import { ParticipantRequestDTO } from '../../../api/routers/participantsRouter'; | ||
import { ParticipantApprovalFormDetails } from '../../services/participant'; | ||
import { TableNoDataPlaceholder } from '../Core/TableNoDataPlaceholder'; | ||
import { ParticipantRequestItem } from './ParticipantRequestItem'; | ||
|
||
import './ParticipantRequestsTable.scss'; | ||
|
||
type ParticipantRequestsTableProps = { | ||
participantRequests: ParticipantRequestDTO[]; | ||
participantTypes: ParticipantTypeDTO[]; | ||
onApprove: (participantId: number, formData: ParticipantApprovalFormDetails) => Promise<void>; | ||
}; | ||
|
||
function NoParticipantRequests() { | ||
return ( | ||
<TableNoDataPlaceholder | ||
icon={<img src='/group-icon.svg' alt='group-icon' />} | ||
title='No Participant Requests' | ||
> | ||
<span>There are no participants that are awaiting approval.</span> | ||
</TableNoDataPlaceholder> | ||
); | ||
} | ||
|
||
export function AllParticipantsTable({ | ||
participantRequests, | ||
participantTypes, | ||
onApprove, | ||
}: ParticipantRequestsTableProps) { | ||
return ( | ||
<div className='participant-requests-container'> | ||
<table className='participant-requests-table'> | ||
<thead> | ||
<tr> | ||
<th>Participant Name</th> | ||
<th>Participant Type</th> | ||
<th>Allowed API Roles</th> | ||
<th>Name of Approver</th> | ||
<th>Date of Approval</th> | ||
<th className='action'>Actions</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
{participantRequests.map((participantRequest) => ( | ||
<ParticipantRequestItem | ||
key={participantRequest.id} | ||
participantRequest={participantRequest} | ||
participantTypes={participantTypes} | ||
onApprove={onApprove} | ||
/> | ||
))} | ||
</tbody> | ||
</table> | ||
{!participantRequests.length && <NoParticipantRequests />} | ||
</div> | ||
); | ||
} |
This file contains 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 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 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 |
---|---|---|
|
@@ -16,19 +16,19 @@ const Template: ComponentStory<typeof ParticipantRequestsTable> = (args) => ( | |
|
||
export const ParticipantRequests = Template.bind({}); | ||
|
||
const requestingUser: ParticipantRequestDTO['requestingUser'] = { | ||
email: '[email protected]', | ||
fullName: 'Test User', | ||
role: UserRole.Engineering, | ||
}; | ||
ParticipantRequests.args = { | ||
participantRequests: [ | ||
{ | ||
id: 1, | ||
name: 'Participant 1', | ||
|
||
types: [{ id: 1, typeName: 'Type 1' }], | ||
status: ParticipantStatus.AwaitingApproval, | ||
requestingUser, | ||
requestingUser: { | ||
email: '[email protected]', | ||
fullName: 'Test User 1', | ||
role: UserRole.Engineering, | ||
}, | ||
}, | ||
{ | ||
id: 1, | ||
|
@@ -38,7 +38,11 @@ ParticipantRequests.args = { | |
{ id: 2, typeName: 'Type 2' }, | ||
], | ||
status: ParticipantStatus.AwaitingApproval, | ||
requestingUser, | ||
requestingUser: { | ||
email: '[email protected]', | ||
fullName: 'Test User 2', | ||
role: UserRole.BusinessDevelopment, | ||
}, | ||
}, | ||
{ | ||
id: 1, | ||
|
@@ -49,7 +53,11 @@ ParticipantRequests.args = { | |
{ id: 3, typeName: 'Type 3' }, | ||
], | ||
status: ParticipantStatus.AwaitingApproval, | ||
requestingUser, | ||
requestingUser: { | ||
email: '[email protected]', | ||
fullName: 'Test User 3', | ||
role: UserRole.Marketing, | ||
}, | ||
}, | ||
{ | ||
id: 1, | ||
|
@@ -61,7 +69,11 @@ ParticipantRequests.args = { | |
{ id: 4, typeName: 'Type 4' }, | ||
], | ||
status: ParticipantStatus.AwaitingApproval, | ||
requestingUser, | ||
requestingUser: { | ||
email: '[email protected]', | ||
fullName: 'Test User 4', | ||
role: UserRole.MediaBuyer, | ||
}, | ||
}, | ||
], | ||
participantTypes: [ | ||
|
This file contains 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