import { Box, Button, Card, CardBody, CardFooter, CardHeader, Heading, Icon, ListItem, Stack, StackDivider, Text, UnorderedList, useToast } from "@chakra-ui/react"; export default function(props: InactivityNoticeProps) { const toast = useToast(); async function makeDecision(accepted: boolean) { const decisionReq = await fetch(`/api/inactivity/${props.id}`, { body: JSON.stringify({ accepted }), headers: { "content-type": "application/json" }, method: "POST" }); if (!decisionReq.ok) { toast({ description: (await decisionReq.json() as { error: string }).error, isClosable: true, status: "error", title: "Oops" }); return; } toast({ description: `Inactivity notice ${accepted ? "accepted" : "denied"}.`, isClosable: true, status: "success", title: "Success" }); location.reload(); } const Approved = () => ; const Denied = () => ; return ( Inactivity Notice for {props.user.username} ID: {props.user.id} }> Reason for Inactivity {props.reason} Start Date {new Date(props.start).toLocaleDateString()} End Date {new Date(props.end).toLocaleDateString()} {props.decisions ? Decisions {props.decisions.map(decision => {decision.accepted ? : } {decision.department} )} : null} ); }