ACTUALLY fix it now
This commit is contained in:
parent
ce868b44ab
commit
0a3bbf28ee
@ -11,19 +11,19 @@ import {
|
|||||||
StackDivider,
|
StackDivider,
|
||||||
Text,
|
Text,
|
||||||
UnorderedList,
|
UnorderedList,
|
||||||
useToast,
|
useToast
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
|
|
||||||
export default function (props: InactivityNoticeProps) {
|
export default function(props: InactivityNoticeProps) {
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
async function makeDecision(accepted: boolean) {
|
async function makeDecision(accepted: boolean) {
|
||||||
const decisionReq = await fetch(`/api/inactivity/${props.id}`, {
|
const decisionReq = await fetch(`/api/inactivity/${props.id}`, {
|
||||||
body: JSON.stringify({ accepted }),
|
body: JSON.stringify({ accepted }),
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json"
|
||||||
},
|
},
|
||||||
method: "POST",
|
method: "POST"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!decisionReq.ok) {
|
if (!decisionReq.ok) {
|
||||||
@ -31,7 +31,7 @@ export default function (props: InactivityNoticeProps) {
|
|||||||
description: ((await decisionReq.json()) as { error: string }).error,
|
description: ((await decisionReq.json()) as { error: string }).error,
|
||||||
isClosable: true,
|
isClosable: true,
|
||||||
status: "error",
|
status: "error",
|
||||||
title: "Oops",
|
title: "Oops"
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -41,7 +41,7 @@ export default function (props: InactivityNoticeProps) {
|
|||||||
description: `Inactivity notice ${accepted ? "accepted" : "denied"}.`,
|
description: `Inactivity notice ${accepted ? "accepted" : "denied"}.`,
|
||||||
isClosable: true,
|
isClosable: true,
|
||||||
status: "success",
|
status: "success",
|
||||||
title: "Success",
|
title: "Success"
|
||||||
});
|
});
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
@ -49,13 +49,15 @@ export default function (props: InactivityNoticeProps) {
|
|||||||
|
|
||||||
const Approved = () => (
|
const Approved = () => (
|
||||||
<svg fill="currentColor" height="16" viewBox="0 0 16 16" width="16">
|
<svg fill="currentColor" height="16" viewBox="0 0 16 16" width="16">
|
||||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
|
<path
|
||||||
|
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
const Denied = () => (
|
const Denied = () => (
|
||||||
<svg fill="currentColor" height="16" viewBox="0 0 16 16" width="16">
|
<svg fill="currentColor" height="16" viewBox="0 0 16 16" width="16">
|
||||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z" />
|
<path
|
||||||
|
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z" />
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -85,8 +87,9 @@ export default function (props: InactivityNoticeProps) {
|
|||||||
<UnorderedList>
|
<UnorderedList>
|
||||||
{Object.entries(props.decisions).map(([dept, accepted]) => (
|
{Object.entries(props.decisions).map(([dept, accepted]) => (
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<Stack direction="row">
|
<Stack alignItems="center" direction="row">
|
||||||
{accepted ? <Approved /> : <Denied />} {dept}
|
<Text>{dept}: </Text>
|
||||||
|
{accepted ? <Approved /> : <Denied />}
|
||||||
</Stack>
|
</Stack>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user