Skip to content

Commit

Permalink
fix: disable check in button for ACCEPTED status
Browse files Browse the repository at this point in the history
  • Loading branch information
samderanova committed Jan 24, 2024
1 parent afa8185 commit 3bc0aa2
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from "@cloudscape-design/components/button";

import UserContext from "@/lib/admin/UserContext";
import { isCheckinLead } from "@/lib/admin/authorization";
import { Decision, PostAcceptedStatus } from "@/lib/admin/useApplicant";
import { Status } from "@/lib/admin/useApplicant";
import { Participant } from "@/lib/admin/useParticipants";
import ParticipantActionPopover from "./ParticipantActionPopover";

Expand All @@ -22,7 +22,8 @@ function ParticipantAction({
const { role } = useContext(UserContext);

const isCheckin = isCheckinLead(role);
const isWaiverSigned = participant.status === PostAcceptedStatus.signed;
const isWaiverSigned = participant.status === Status.signed;
const isAccepted = participant.status === Status.accepted;

const promoteButton = (
<Button
Expand All @@ -40,13 +41,13 @@ function ParticipantAction({
variant="inline-link"
ariaLabel={`Check in ${participant._id}`}
onClick={() => initiateCheckIn(participant)}
disabled={isWaiverSigned}
disabled={isWaiverSigned || isAccepted}
>
Check In
</Button>
);

if (participant.status === Decision.waitlisted) {
if (participant.status === Status.waitlisted) {
if (!isCheckin) {
return (
<ParticipantActionPopover content="Only check-in leads are allowed to promote walk-ins.">
Expand All @@ -55,9 +56,12 @@ function ParticipantAction({
);
}
return promoteButton;
} else if (isWaiverSigned) {
} else if (isWaiverSigned || isAccepted) {
const content = isWaiverSigned
? "Must confirm attendance in portal first"
: "Must sign waiver and confirm attendance in portal";
return (
<ParticipantActionPopover content="Must confirm attendance in portal first">
<ParticipantActionPopover content={content}>
{checkinButton}
</ParticipantActionPopover>
);
Expand Down

0 comments on commit 3bc0aa2

Please sign in to comment.