Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add buttons that do things to the event calendar page
  • Loading branch information
regalijan committed Dec 12, 2024
1 parent fc654c2 commit b0a1466
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions app/routes/events-calendar.tsx
Expand Up @@ -7,6 +7,7 @@ import { type LinksFunction } from "@remix-run/cloudflare";
import {
Button,
Container,
Flex,
Heading,
Modal,
ModalBody,
Expand All @@ -15,8 +16,17 @@ import {
ModalFooter,
ModalHeader,
ModalOverlay,
Popover,
PopoverArrow,
PopoverBody,
PopoverCloseButton,
PopoverContent,
PopoverHeader,
PopoverTrigger,
Spacer,
Text,
useDisclosure,
VStack,
} from "@chakra-ui/react";
import { useLoaderData } from "@remix-run/react";
import { useState } from "react";
Expand Down Expand Up @@ -76,6 +86,9 @@ export async function loader({ context }: { context: RequestContext }) {

return {
calendarData,
canManage: Boolean(
[1 << 4, 1 << 12].find((p) => context.data.current_user.permissions & p),
),
eventList: eventsData.results,
memberData: memberData.results,
};
Expand Down Expand Up @@ -143,6 +156,39 @@ export default function () {
toolbar={false}
views={["month"]}
/>
<Flex mt="16px">
<Button as="a" colorScheme="blue" href="/book-event">
Book Event
</Button>
<Spacer />
{data.canManage ? (
<Popover placement="top-end">
<PopoverTrigger>
<Button colorScheme="blue">Management</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverHeader fontWeight="semibold">
Management Tools
</PopoverHeader>
<PopoverArrow />
<PopoverCloseButton />
<PopoverBody>
<VStack>
<Button as="a" href="/events-team/historical" w="100%">
Historical Events
</Button>
<Button as="a" href="/et-members" w="100%">
Member Management
</Button>
<Button as="a" href="/events-team/outstanding" w="100%">
Outstanding Events
</Button>
</VStack>
</PopoverBody>
</PopoverContent>
</Popover>
) : null}
</Flex>
</Container>
);
}

0 comments on commit b0a1466

Please sign in to comment.