Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disable toolbar entirely
  • Loading branch information
regalijan committed Nov 9, 2024
1 parent 065fb86 commit 368be24
Showing 1 changed file with 10 additions and 31 deletions.
41 changes: 10 additions & 31 deletions app/routes/events-calendar.tsx
Expand Up @@ -85,17 +85,12 @@ export async function loader({ context }: { context: RequestContext }) {

export default function () {
const data = useLoaderData<typeof loader>();
const [selectedDate, setDate] = useState(new Date());
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 getEventsOfDay = (date: Date) =>
data.eventList.filter(
(e) =>
e.day === date.getUTCDate() &&
e.month === date.getUTCMonth() + 1 &&
e.year === date.getUTCFullYear(),
) as { [k: string]: any }[];
const [eventsOfDay, setEventsOfDay] = useState(getEventsOfDay(selectedDate));

dayjs.extend(utc);

Expand Down Expand Up @@ -137,21 +132,11 @@ export default function () {
);
onOpen();
}}
onSelectSlot={(s) => {
const date = s.slots.at(0) as Date;
setDate(date);
setEventsOfDay(getEventsOfDay(date));
}}
onSelectSlot={(s) => {}}
popup
startAccessor={(event) => new Date(event.start)}
style={{ height: 500 }}
views={{
month: true,
week: false,
work_week: false,
day: false,
agenda: false,
}}
toolbar={false}
/>
<Accordion id="events-accordion" mt="16px">
<AccordionItem>
Expand All @@ -164,7 +149,7 @@ export default function () {
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
{eventsOfDay.find((e) => e.type === "fotd")?.details || "None"}
{todayFOTD}
<br />
</AccordionPanel>
</AccordionItem>
Expand All @@ -177,9 +162,7 @@ export default function () {
<AccordionIcon />
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
{eventsOfDay.find((e) => e.type === "gamenight")?.details || "None"}
</AccordionPanel>
<AccordionPanel pb={4}>{todayGameNight}</AccordionPanel>
</AccordionItem>
<AccordionItem>
<h2>
Expand All @@ -189,9 +172,7 @@ export default function () {
</Box>
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
{eventsOfDay.find((e) => e.type === "rotw")?.details || "None"}
</AccordionPanel>
<AccordionPanel pb={4}>{todayROTW}</AccordionPanel>
</AccordionItem>
<AccordionItem>
<h2>
Expand All @@ -201,9 +182,7 @@ export default function () {
</Box>
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
{eventsOfDay.find((e) => e.type === "qotd")?.details || "None"}
</AccordionPanel>
<AccordionPanel pb={4}>{todayQOTD}</AccordionPanel>
</AccordionItem>
</Accordion>
</Container>
Expand Down

0 comments on commit 368be24

Please sign in to comment.