Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove solve button from ui
  • Loading branch information
regalijan committed Nov 20, 2024
1 parent dd7c537 commit 0378491
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions app/routes/events-team.tsx
Expand Up @@ -102,11 +102,6 @@ export default function () {
onClose: closeComplete,
onOpen: openComplete,
} = useDisclosure();
const {
isOpen: isAnsweredOpen,
onClose: closeAnswered,
onOpen: openAnswered,
} = useDisclosure();
const {
isOpen: isForgottenOpen,
onClose: onForgottenClose,
Expand Down Expand Up @@ -212,35 +207,6 @@ export default function () {
setSelectedEvent("");
}

async function markAnswered(eventId: string) {
const answerResp = await fetch(`/api/events-team/events/${eventId}/solve`, {
body: "{}",
headers: {
"content-type": "application/json",
},
method: "POST",
});

closeAnswered();

if (!answerResp.ok) {
toast({
description: "Failed to mark as solved",
status: "error",
title: "Oops",
});

return;
}

const newEventData = eventData;
newEventData[eventData.findIndex((e) => e.id === eventId)].answered_at =
Date.now();

setEventData([...newEventData]);
setSelectedEvent("");
}

async function markComplete(eventId: string) {
const completeResp = await fetch(
`/api/events-team/events/${eventId}/complete`,
Expand Down Expand Up @@ -446,26 +412,6 @@ export default function () {
</ModalFooter>
</ModalContent>
</Modal>
<Modal isOpen={isAnsweredOpen} onClose={closeAnswered}>
<ModalOverlay />
<ModalContent>
<ModalHeader>Mark as Solved</ModalHeader>
<ModalCloseButton />
<ModalBody>
<Text>Are you sure you want to mark this riddle as solved?</Text>
</ModalBody>
<ModalFooter>
<Button onClick={closeAnswered}>Cancel</Button>
<Button
colorScheme="blue"
ml="8px"
onClick={async () => await markAnswered(selectedEvent)}
>
Mark Answered
</Button>
</ModalFooter>
</ModalContent>
</Modal>
<Modal isOpen={isForgottenOpen} onClose={onForgottenClose}>
<ModalOverlay />
<ModalContent>
Expand Down Expand Up @@ -676,22 +622,6 @@ export default function () {
</>
) : null}
{can_approve &&
!event.pending &&
event.approved &&
event.performed_at &&
event.type === "rotw" &&
!event.answered_at ? (
<Button
colorScheme="blue"
onClick={() => {
setSelectedEvent(event.id);
openAnswered();
}}
>
Mark as Solved
</Button>
) : null}
{can_approve &&
event.approved &&
event.type === "gamenight" &&
event.performed_at &&
Expand Down

0 comments on commit 0378491

Please sign in to comment.