From 71abecae4ee2113da8f108aecfcfde93b70b10ff Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 21 Jun 2024 18:30:33 +0200 Subject: [PATCH] Prepare calendar popover --- .../AccommodationsReservationsRoute.tsx | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/geneit_app/src/routes/family/accommodations/AccommodationsReservationsRoute.tsx b/geneit_app/src/routes/family/accommodations/AccommodationsReservationsRoute.tsx index 669d5c7..20b3e4f 100644 --- a/geneit_app/src/routes/family/accommodations/AccommodationsReservationsRoute.tsx +++ b/geneit_app/src/routes/family/accommodations/AccommodationsReservationsRoute.tsx @@ -11,6 +11,9 @@ import { FormControlLabel, FormGroup, FormLabel, + Popover, + Typography, + fabClasses, } from "@mui/material"; import React from "react"; import { FamilyApi, FamilyUser } from "../../../api/FamilyApi"; @@ -55,6 +58,17 @@ export function AccommodationsReservationsRoute(): React.ReactElement { Set >(new Set()); + const eventPopupAnchor = React.useRef(null); + const [activeEvent, setActiveEvent] = React.useState< + | undefined + | { + x: number; + y: number; + w: number; + h: number; + } + >(); + const load = async () => { setReservations( await AccommodationsReservationsApi.FullListOfFamily(family.family) @@ -113,6 +127,8 @@ export function AccommodationsReservationsRoute(): React.ReactElement { }; const onEventClick = (ev: EventClickArg) => { + const loc = ev.el.getBoundingClientRect(); + setActiveEvent({ x: loc.left, y: loc.top, w: loc.width, h: loc.height }); console.log(ev); }; @@ -271,6 +287,33 @@ export function AccommodationsReservationsRoute(): React.ReactElement { })} /> + + {/* Calendar event popover */} +
+ { + setActiveEvent(undefined); + }} + anchorOrigin={{ + vertical: "bottom", + horizontal: "left", + }} + > + The content of the Popover. + )} />