diff --git a/__test__/components/DuplicateEvent.test.tsx b/__test__/components/DuplicateEvent.test.tsx index f3c0066..91b3165 100644 --- a/__test__/components/DuplicateEvent.test.tsx +++ b/__test__/components/DuplicateEvent.test.tsx @@ -62,8 +62,9 @@ const preloadedState = { }; describe("EventDuplication", () => { - it("opens EventPopover when button clicked", () => { + it("calls onOpenDuplicate when button clicked", () => { const handleClose = jest.fn(); + const onOpenDuplicate = jest.fn(); renderWithProviders( { .event1 } onClose={handleClose} + onOpenDuplicate={onOpenDuplicate} />, preloadedState ); fireEvent.click(screen.getByRole("menuitem", { name: /Duplicate event/i })); - expect(screen.getAllByText(/Duplicate Event/i)[1]).toBeInTheDocument(); - }); - - it("calls onClose when closing the popover", () => { - const handleClose = jest.fn(); - renderWithProviders( - , - preloadedState - ); - - fireEvent.click(screen.getByRole("menuitem", { name: /Duplicate event/i })); - - // Cancel button only appears in expanded mode - fireEvent.click(screen.getByRole("button", { name: /More options/i })); - - fireEvent.click(screen.getByRole("button", { name: /Cancel/i })); - - expect(handleClose).toHaveBeenCalled(); + expect(onOpenDuplicate).toHaveBeenCalled(); }); }); diff --git a/src/App.tsx b/src/App.tsx index 28485a9..955f7fe 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,18 +8,22 @@ import { Loading } from "./components/Loading/Loading"; import HandleLogin from "./features/User/HandleLogin"; import CalendarLayout from "./components/Calendar/CalendarLayout"; import { Error } from "./components/Error/Error"; +import { CustomThemeProvider } from "./theme/ThemeProvider"; + function App() { return ( - }> - - - } /> - } /> - } /> - } /> - - - + + }> + + + } /> + } /> + } /> + } /> + + + + ); } diff --git a/src/components/Calendar/TimezoneSelector.tsx b/src/components/Calendar/TimezoneSelector.tsx index e7580f2..8378c53 100644 --- a/src/components/Calendar/TimezoneSelector.tsx +++ b/src/components/Calendar/TimezoneSelector.tsx @@ -66,17 +66,19 @@ export function TimezoneSelector({ value, onChange }: TimezoneSelectProps) { }} slotProps={{ paper: { - sx: { width: 280, maxHeight: 400, overflow: "auto", p: 1 }, + sx: { width: 280, maxHeight: 400, overflow: "hidden", p: 0 }, }, }} > {children} )} - {actions && {actions}} + {actions && ( + `1px solid ${theme.palette.divider}` + : undefined, + justifyContent: actionsJustifyContent, + paddingTop: "18px", + paddingBottom: "18px", + }} + > + {actions} + + )} ); } diff --git a/src/components/Event/EventDuplicate.tsx b/src/components/Event/EventDuplicate.tsx index 826cb67..468f09e 100644 --- a/src/components/Event/EventDuplicate.tsx +++ b/src/components/Event/EventDuplicate.tsx @@ -1,51 +1,22 @@ -import { IconButton, MenuItem } from "@mui/material"; +import { MenuItem } from "@mui/material"; import { CalendarEvent } from "../../features/Events/EventsTypes"; -import AddToPhotosIcon from "@mui/icons-material/AddToPhotos"; -import { useRef, useState } from "react"; -import EventPopover from "../../features/Events/EventModal"; -import { CalendarApi, DateSelectArg } from "@fullcalendar/core"; export default function EventDuplication({ onClose, event, + onOpenDuplicate, }: { onClose: Function; event: CalendarEvent; + onOpenDuplicate?: () => void; }) { - const [openModal, setOpenModal] = useState(false); - const [selectedRange, setSelectedRange] = useState({ - start: new Date(event.start), - startStr: event.start, - end: new Date(event.end ?? ""), - endStr: event.end ?? "", - allDay: event.allday ?? false, - } as DateSelectArg); - const calendarRef = useRef(null); - - const handleClosePopover = () => { - calendarRef.current?.unselect(); - setSelectedRange(null); - setOpenModal(!openModal); - onClose({}, "backdropClick"); - }; return ( - <> - { - setOpenModal(true); - }} - > - Duplicate event - - - + { + onOpenDuplicate?.(); + }} + > + Duplicate event + ); } diff --git a/src/components/Event/InfoRow.tsx b/src/components/Event/InfoRow.tsx index 25195b5..5695f1b 100644 --- a/src/components/Event/InfoRow.tsx +++ b/src/components/Event/InfoRow.tsx @@ -77,12 +77,14 @@ export function InfoRow({ {data ? ( diff --git a/src/components/Event/utils/eventUtils.tsx b/src/components/Event/utils/eventUtils.tsx index ea5805b..2161973 100644 --- a/src/components/Event/utils/eventUtils.tsx +++ b/src/components/Event/utils/eventUtils.tsx @@ -44,6 +44,7 @@ export function renderAttendeeBadge( > {isOrganizer && ( - + Organizer )} diff --git a/src/features/Events/EventDisplayPreview.tsx b/src/features/Events/EventDisplayPreview.tsx index 28b987f..8031614 100644 --- a/src/features/Events/EventDisplayPreview.tsx +++ b/src/features/Events/EventDisplayPreview.tsx @@ -12,13 +12,13 @@ import SubjectIcon from "@mui/icons-material/Subject"; import VideocamIcon from "@mui/icons-material/Videocam"; import RepeatIcon from "@mui/icons-material/Repeat"; import LockOutlineIcon from "@mui/icons-material/LockOutline"; +import EventPopover from "./EventModal"; +import { DateSelectArg } from "@fullcalendar/core"; import { Box, Button, - ButtonGroup, Chip, DialogActions, - Divider, IconButton, Menu, MenuItem, @@ -77,6 +77,7 @@ export default function EventPreviewModal({ const [showAllAttendees, setShowAllAttendees] = useState(false); const [openFullDisplay, setOpenFullDisplay] = useState(false); const [openUpdateModal, setOpenUpdateModal] = useState(false); + const [openDuplicateModal, setOpenDuplicateModal] = useState(false); const [hidePreview, setHidePreview] = useState(false); const [openEditModePopup, setOpenEditModePopup] = useState( null @@ -136,6 +137,8 @@ export default function EventPreviewModal({ open={open && !hidePreview} onClose={() => onClose({}, "backdropClick")} showHeaderActions={false} + actionsBorderTop={true} + actionsJustifyContent="center" style={{ overflow: "auto" }} title={ event.title && ( @@ -210,7 +213,15 @@ export default function EventPreviewModal({ Email attendees )} - + setToggleActionMenu(null)} + onOpenDuplicate={() => { + setToggleActionMenu(null); + setHidePreview(true); + setOpenDuplicateModal(true); + }} + /> {user.userData.email === event.organizer?.cal_address && ( { @@ -270,10 +281,12 @@ export default function EventPreviewModal({ ))} @@ -293,7 +306,7 @@ export default function EventPreviewModal({ )} - + {formatDate(event.start, event.allday)} {event.end && formatEnd(event.start, event.end, event.allday) && @@ -305,15 +318,22 @@ export default function EventPreviewModal({ actions={ <> {currentUserAttendee && ( - - Attending? - + <> + Attending? + - - + + )} } @@ -428,7 +462,11 @@ export default function EventPreviewModal({ {/* Video */} {event.x_openpass_videoconference && ( } + icon={ + + + + } content={