Skip to content

Commit

Permalink
Warn when participant is already checked in
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Jul 4, 2024
1 parent c0d05a7 commit 26d61b3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/pages/participant/ParticipantPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import db, {
import {useErrorModal} from '../../hooks/useModal';
import useSettings from '../../hooks/useSettings';
import {useIsOffline} from '../../utils/client';
import {formatDatetime} from '../../utils/date';
import {checkIn} from '../Events/checkin';
import {syncEvent, syncParticipant, syncRegform} from '../Events/sync';
import {NotFoundBanner} from '../NotFound';
Expand Down Expand Up @@ -112,6 +113,23 @@ function ParticipantPageContent({
}
}, [navigate, state]);

useEffect(() => {
if (!participant) {
return;
}
if (state?.fromScan) {
// remove fromScan from location state
const {fromScan, ...rest} = state;
navigate('.', {replace: true, state: rest});
if (participant.checkedIn) {
errorModal({
title: 'Participant already checked in',
content: `This participant was checked in on ${formatDatetime(participant.checkedInDt!)}`,
});
}
}
}, [participant, state, errorModal, navigate]);

const accompanyingPersons = useMemo(() => {
if (participant?.registrationData) {
return getAccompanyingPersons(participant.registrationData);
Expand Down

0 comments on commit 26d61b3

Please sign in to comment.