Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove events accordion
  • Loading branch information
regalijan committed Dec 12, 2024
1 parent 0cfc972 commit fc654c2
Showing 1 changed file with 0 additions and 80 deletions.
80 changes: 0 additions & 80 deletions app/routes/events-calendar.tsx
Expand Up @@ -5,12 +5,6 @@ import { Calendar, dayjsLocalizer } from "react-big-calendar";
import dayjs from "dayjs";
import { type LinksFunction } from "@remix-run/cloudflare";
import {
Accordion,
AccordionButton,
AccordionIcon,
AccordionItem,
AccordionPanel,
Box,
Button,
Container,
Heading,
Expand Down Expand Up @@ -90,10 +84,6 @@ export async function loader({ context }: { context: RequestContext }) {
export default function () {
const data = useLoaderData<typeof loader>();
const [eventData, setEventData] = useState({} as { [k: string]: any });
const [todayFOTD, setTodayFOTD] = useState("None");
const [todayGameNight, setTodayGameNight] = useState("None");
const [todayQOTD, setTodayQOTD] = useState("None");
const [todayROTW, setTodayROTW] = useState("None");
const { isOpen, onClose, onOpen } = useDisclosure();

dayjs.extend(utc);
Expand Down Expand Up @@ -147,82 +137,12 @@ export default function () {
);
onOpen();
}}
onSelectSlot={(s) => {
const day = s.start.getUTCDate();
const month = s.start.getUTCMonth() + 1;

for (const [type, setter] of Object.entries({
fotd: setTodayFOTD,
gamenight: setTodayGameNight,
qotd: setTodayQOTD,
rotw: setTodayROTW,
})) {
const event = data.eventList.find(
(ev) => ev.type === type && ev.day === day && ev.month === month,
);

if (!event) continue;

setter(
event.type === "rotw"
? `${event.details}\n\nAnswer: ${event.answer}`
: (event.details as string),
);
}
}}
popup
startAccessor={(event) => new Date(event.start)}
style={{ height: 500 }}
toolbar={false}
views={["month"]}
/>
<Accordion id="events-accordion" mt="16px">
<AccordionItem>
<h2>
<AccordionButton>
<Box as="span" flex="1" textAlign="left">
Fact of the Day
</Box>
<AccordionIcon />
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
{todayFOTD}
<br />
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<h2>
<AccordionButton>
<Box as="span" flex="1" textAlign="left">
Gamenight
</Box>
<AccordionIcon />
</AccordionButton>
</h2>
<AccordionPanel pb={4}>{todayGameNight}</AccordionPanel>
</AccordionItem>
<AccordionItem>
<h2>
<AccordionButton>
<Box as="span" flex="1" textAlign="left">
Riddle of the Week
</Box>
</AccordionButton>
</h2>
<AccordionPanel pb={4}>{todayROTW}</AccordionPanel>
</AccordionItem>
<AccordionItem>
<h2>
<AccordionButton>
<Box as="span" flex="1" textAlign="left">
Question of the Day
</Box>
</AccordionButton>
</h2>
<AccordionPanel pb={4}>{todayQOTD}</AccordionPanel>
</AccordionItem>
</Accordion>
</Container>
);
}

0 comments on commit fc654c2

Please sign in to comment.