diff --git a/components/InactivityNoticeCard.tsx b/components/InactivityNoticeCard.tsx
index 0f7163d..84040a2 100644
--- a/components/InactivityNoticeCard.tsx
+++ b/components/InactivityNoticeCard.tsx
@@ -12,27 +12,27 @@ import {
StackDivider,
Text,
UnorderedList,
- useToast
+ useToast,
} from "@chakra-ui/react";
-export default function(props: InactivityNoticeProps) {
+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"
+ "content-type": "application/json",
},
- method: "POST"
+ method: "POST",
});
if (!decisionReq.ok) {
toast({
- description: (await decisionReq.json() as { error: string }).error,
+ description: ((await decisionReq.json()) as { error: string }).error,
isClosable: true,
status: "error",
- title: "Oops"
+ title: "Oops",
});
return;
@@ -42,21 +42,23 @@ export default function(props: InactivityNoticeProps) {
description: `Inactivity notice ${accepted ? "accepted" : "denied"}.`,
isClosable: true,
status: "success",
- title: "Success"
+ title: "Success",
});
location.reload();
}
- const Approved = () =>
-
- ;
+ const Approved = () => (
+
+
+
+ );
- const Denied = () =>
-
- ;
+ const Denied = () => (
+
+
+
+ );
return (
@@ -78,20 +80,33 @@ export default function(props: InactivityNoticeProps) {
End Date
{new Date(props.end).toLocaleDateString()}
- {props.decisions ?
- Decisions
-
- {props.decisions.map(decision =>
- {decision.accepted ? : } {decision.department}
- )}
-
- : null}
+ {props.decisions ? (
+
+ Decisions
+
+ {Object.entries(props.decisions).map(([dept, accepted]) => (
+
+ {accepted ? : } {dept}
+
+ ))}
+
+
+ ) : null}
-
-
diff --git a/index.d.ts b/index.d.ts
index b1ac60e..b3eb57a 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -45,9 +45,11 @@ declare global {
interface InactivityNoticeProps {
created_at: number;
decisions?: {
- accepted: boolean;
- department: string;
- }[];
+ DM?: boolean;
+ ET?: boolean;
+ FM?: boolean;
+ WM?: boolean;
+ };
departments: string[];
end: string;
id: string;