diff --git a/src/analysis/individualStudy/ParticipantRejectModal.tsx b/src/analysis/individualStudy/ParticipantRejectModal.tsx index 263919fb55..5efd5ac714 100644 --- a/src/analysis/individualStudy/ParticipantRejectModal.tsx +++ b/src/analysis/individualStudy/ParticipantRejectModal.tsx @@ -1,5 +1,5 @@ import { - Modal, Text, TextInput, Flex, Button, Alert, Tooltip, + Modal, Text, TextInput, Flex, Button, Alert, Tooltip, Group, } from '@mantine/core'; import { IconAlertTriangle } from '@tabler/icons-react'; import { @@ -52,6 +52,8 @@ export function ParticipantRejectModal({ const currentAndSelectedParticipants = useMemo(() => [...selectedParticipants, currentParticipantData].filter((p) => p !== null) as ParticipantData[], [selectedParticipants, currentParticipantData]); const rejectedParticipantsCount = useMemo(() => currentAndSelectedParticipants.filter((p) => p.rejected).length, [currentAndSelectedParticipants]); const nonRejectedParticipantsCount = useMemo(() => currentAndSelectedParticipants.filter((p) => !p.rejected).length, [currentAndSelectedParticipants]); + const rejectParticipantLabel = `Reject Participant${nonRejectedParticipantsCount === 1 ? '' : 's'}`; + const undoRejectParticipantLabel = `Undo Reject Participant${rejectedParticipantsCount === 1 ? '' : 's'}`; const rejectParticipant = useCallback(async (rejectParticipantId: string, reason: string) => { if (storageEngine && studyId) { @@ -106,26 +108,30 @@ export function ParticipantRejectModal({ return ( <> - {rejectedParticipantsCount > 0 && ( - - - - )} - {nonRejectedParticipantsCount > 0 && ( - - - + {(rejectedParticipantsCount > 0 || nonRejectedParticipantsCount > 0) && ( + + {rejectedParticipantsCount > 0 && ( + + + + )} + {nonRejectedParticipantsCount > 0 && ( + + + + )} + )} setModalRejectOpened(false)} - title={nonRejectedParticipantsCount > 0 ? `Reject Participants (${nonRejectedParticipantsCount})` : 'Reject Participant'} + title={footer + ? rejectParticipantLabel + : `${rejectParticipantLabel} (${nonRejectedParticipantsCount})`} > } @@ -134,25 +140,28 @@ export function ParticipantRejectModal({ mb="md" > {currentAndSelectedParticipants.length > 0 && rejectedParticipantsCount > 0 && ( - <> - {rejectedParticipantsCount} - {' '} - of your - {' '} - {currentAndSelectedParticipants.length} - {' '} - selected participant - {currentAndSelectedParticipants.length === 1 ? '' : 's'} - {' '} - {rejectedParticipantsCount === 1 ? 'has' : 'have'} - {' '} - already been rejected. Clicking reject participants will now reject the other - {' '} - {nonRejectedParticipantsCount} - . -
-
- + <> + {rejectedParticipantsCount} + {' '} + of your + {' '} + {currentAndSelectedParticipants.length} + {' '} + selected participant + {currentAndSelectedParticipants.length === 1 ? '' : 's'} + {' '} + {rejectedParticipantsCount === 1 ? 'has' : 'have'} + {' '} + already been rejected. Clicking reject participant + {nonRejectedParticipantsCount === 1 ? '' : 's'} + {' '} + will now reject + {' '} + {nonRejectedParticipantsCount === 1 ? 'this participant' : 'these participants'} + . +
+
+ )} When participants are rejected, their sequences will be reassigned to other participants.
@@ -165,7 +174,7 @@ export function ParticipantRejectModal({ Cancel
@@ -173,11 +182,9 @@ export function ParticipantRejectModal({ setModalUndoRejectOpened(false)} - title={( - - {`Undo Reject Participants (${currentAndSelectedParticipants.length})`} - - )} + title={footer + ? undoRejectParticipantLabel + : `${undoRejectParticipantLabel} (${rejectedParticipantsCount})`} > } @@ -188,7 +195,12 @@ export function ParticipantRejectModal({ When you undo participant rejections, you may end up with unbalanced latin squares. This is because the rejected sequence may have been reassigned. {currentAndSelectedParticipants.length > 0 ? ( - Are you sure you want to undo the rejection of these participants? + + Are you sure you want to undo the rejection of + {' '} + {rejectedParticipantsCount === 1 ? 'this participant' : 'these participants'} + ? + ) : ( <> @@ -206,7 +218,7 @@ export function ParticipantRejectModal({ Cancel diff --git a/src/analysis/individualStudy/thinkAloud/ThinkAloudFooter.tsx b/src/analysis/individualStudy/thinkAloud/ThinkAloudFooter.tsx index 52d431e27b..c3fa0e6b3c 100644 --- a/src/analysis/individualStudy/thinkAloud/ThinkAloudFooter.tsx +++ b/src/analysis/individualStudy/thinkAloud/ThinkAloudFooter.tsx @@ -125,6 +125,7 @@ export function ThinkAloudFooter({ async function fetchAssetsUrl() { if (!storageEngine || !participantId || !currentTrial) { setAudioUrl(null); + setScreenRecordingUrl(null); return; } @@ -599,7 +600,7 @@ export function ThinkAloudFooter({ )} {screenRecordingUrl && ( - +