Remove events accordion
This commit is contained in:
parent
0cfc972dae
commit
fc654c2399
@ -5,12 +5,6 @@ import { Calendar, dayjsLocalizer } from "react-big-calendar";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { type LinksFunction } from "@remix-run/cloudflare";
|
import { type LinksFunction } from "@remix-run/cloudflare";
|
||||||
import {
|
import {
|
||||||
Accordion,
|
|
||||||
AccordionButton,
|
|
||||||
AccordionIcon,
|
|
||||||
AccordionItem,
|
|
||||||
AccordionPanel,
|
|
||||||
Box,
|
|
||||||
Button,
|
Button,
|
||||||
Container,
|
Container,
|
||||||
Heading,
|
Heading,
|
||||||
@ -90,10 +84,6 @@ export async function loader({ context }: { context: RequestContext }) {
|
|||||||
export default function () {
|
export default function () {
|
||||||
const data = useLoaderData<typeof loader>();
|
const data = useLoaderData<typeof loader>();
|
||||||
const [eventData, setEventData] = useState({} as { [k: string]: any });
|
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();
|
const { isOpen, onClose, onOpen } = useDisclosure();
|
||||||
|
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
@ -147,82 +137,12 @@ export default function () {
|
|||||||
);
|
);
|
||||||
onOpen();
|
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
|
popup
|
||||||
startAccessor={(event) => new Date(event.start)}
|
startAccessor={(event) => new Date(event.start)}
|
||||||
style={{ height: 500 }}
|
style={{ height: 500 }}
|
||||||
toolbar={false}
|
toolbar={false}
|
||||||
views={["month"]}
|
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>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user