Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove finalize button
  • Loading branch information
regalijan committed Nov 17, 2024
1 parent f8015ae commit 5f3ffc0
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions app/routes/events-team_.report.tsx
@@ -1,5 +1,4 @@
import {
Button,
Container,
Heading,
Table,
Expand All @@ -12,7 +11,6 @@ import {
Tr,
} from "@chakra-ui/react";
import { useLoaderData } from "@remix-run/react";
import { useState } from "react";

export async function loader({ context }: { context: RequestContext }) {
const { current_user: user } = context.data;
Expand Down Expand Up @@ -84,27 +82,17 @@ export async function loader({ context }: { context: RequestContext }) {
)
memberMap[member].points -= 30;

const date = new Date();
const reportFinalizationKey = await context.env.DATA.get(
`reportfinalized_${date.getUTCFullYear()}-${date.getUTCMonth() + 1}`,
);

return {
can_finalize: typeof reportFinalizationKey !== "undefined",
members: memberMap,
};
}

export default function () {
const data = useLoaderData<typeof loader>() as {
can_finalize: boolean;
members: {
[k: string]: { name: string; points: number; roblox_id?: number };
};
};
const [showFinalizeButton, setShowFinalizeButton] = useState(
data.can_finalize,
);
const now = new Date();
let month = now.getUTCMonth();
let year = now.getUTCFullYear();
Expand Down Expand Up @@ -144,7 +132,6 @@ export default function () {
</Tbody>
</Table>
</TableContainer>
<Button disabled={!showFinalizeButton}>Finalize Report</Button>
</Container>
);
}

0 comments on commit 5f3ffc0

Please sign in to comment.