Refactor imports (#470)
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
import CalendarApp from "@/components/Calendar/Calendar";
|
||||
import CalendarLayout from "@/components/Calendar/CalendarLayout";
|
||||
import * as calendarDetailThunks from "@/features/Calendars/services";
|
||||
import * as servicesModule from "@/features/Calendars/services";
|
||||
import { searchUsers } from "@/features/User/userAPI";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import CalendarApp from "../../src/components/Calendar/Calendar";
|
||||
import * as eventThunks from "../../src/features/Calendars/CalendarSlice";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import { searchUsers } from "../../src/features/User/userAPI";
|
||||
import * as calendarDetailThunks from "../../src/features/Calendars/services/getCalendarDetailAsync";
|
||||
|
||||
import { useRef } from "react";
|
||||
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import CalendarLayout from "../../src/components/Calendar/CalendarLayout";
|
||||
jest.mock("../../src/features/User/userAPI");
|
||||
import { useRef } from "react";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
|
||||
jest.mock("@/features/User/userAPI");
|
||||
const mockedSearchUsers = searchUsers as jest.MockedFunction<
|
||||
typeof searchUsers
|
||||
>;
|
||||
@@ -348,7 +347,7 @@ describe("calendar Availability search", () => {
|
||||
|
||||
it("imports temporary calendars when selecting new users", async () => {
|
||||
const spy = jest
|
||||
.spyOn(eventThunks, "getTempCalendarsListAsync")
|
||||
.spyOn(servicesModule, "getTempCalendarsListAsync")
|
||||
.mockImplementation((payload) => {
|
||||
return () => Promise.resolve(payload) as any;
|
||||
});
|
||||
@@ -389,7 +388,7 @@ describe("calendar Availability search", () => {
|
||||
},
|
||||
]);
|
||||
const spy = jest
|
||||
.spyOn(eventThunks, "getTempCalendarsListAsync")
|
||||
.spyOn(servicesModule, "getTempCalendarsListAsync")
|
||||
.mockImplementation((payload) => {
|
||||
return () => Promise.resolve(payload) as any;
|
||||
});
|
||||
@@ -411,7 +410,7 @@ describe("calendar Availability search", () => {
|
||||
|
||||
it("open window with attendees filled after temp search on create event button click", async () => {
|
||||
const spy = jest
|
||||
.spyOn(eventThunks, "getTempCalendarsListAsync")
|
||||
.spyOn(servicesModule, "getTempCalendarsListAsync")
|
||||
.mockImplementation((payload) => {
|
||||
return () => Promise.resolve(payload) as any;
|
||||
});
|
||||
@@ -455,7 +454,7 @@ describe("calendar Availability search", () => {
|
||||
|
||||
it("open window with attendees filled after temp search on enter in temp input", async () => {
|
||||
const spy = jest
|
||||
.spyOn(eventThunks, "getTempCalendarsListAsync")
|
||||
.spyOn(servicesModule, "getTempCalendarsListAsync")
|
||||
.mockImplementation((payload) => {
|
||||
return () => Promise.resolve(payload) as any;
|
||||
});
|
||||
@@ -696,10 +695,10 @@ describe("calendar Availability search", () => {
|
||||
);
|
||||
|
||||
const selectedCalls = spy.mock.calls.filter(
|
||||
(call) => call[0].calId === "user1/cal1"
|
||||
(call: { calId: string }[]) => call[0].calId === "user1/cal1"
|
||||
);
|
||||
const hiddenCalls = spy.mock.calls.filter(
|
||||
(call) =>
|
||||
(call: { calId: string }[]) =>
|
||||
call[0].calId === "user1/cal2" || call[0].calId === "user1/cal3"
|
||||
);
|
||||
|
||||
@@ -729,12 +728,13 @@ describe("calendar Availability search", () => {
|
||||
);
|
||||
|
||||
const callsForCal1 = spy.mock.calls.filter(
|
||||
(call) => call[0].calId === "user1/cal1"
|
||||
(call: { calId: string }[]) => call[0].calId === "user1/cal1"
|
||||
);
|
||||
|
||||
const uniqueRanges = new Set(
|
||||
callsForCal1.map(
|
||||
(call) => `${call[0].match.start}_${call[0].match.end}`
|
||||
(call: { match: { end: string; start: string } }[]) =>
|
||||
`${call[0].match.start}_${call[0].match.end}`
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { fireEvent, screen, waitFor, act } from "@testing-library/react";
|
||||
import CalendarSearch from "@/components/Calendar/CalendarSearch";
|
||||
import * as CalendarApi from "@/features/Calendars/CalendarApi";
|
||||
import * as CalendarSlice from "@/features/Calendars/services";
|
||||
import { searchUsers } from "@/features/User/userAPI";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import CalendarSearch from "../../src/components/Calendar/CalendarSearch";
|
||||
import * as CalendarApi from "../../src/features/Calendars/CalendarApi";
|
||||
import * as CalendarSlice from "../../src/features/Calendars/CalendarSlice";
|
||||
import { searchUsers } from "../../src/features/User/userAPI";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
|
||||
jest.mock("../../src/features/User/userAPI");
|
||||
jest.mock("../../src/features/Calendars/CalendarApi");
|
||||
jest.mock("@/features/User/userAPI");
|
||||
jest.mock("@/features/Calendars/CalendarApi");
|
||||
|
||||
const mockedSearchUsers = searchUsers as jest.MockedFunction<
|
||||
typeof searchUsers
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { screen, fireEvent, waitFor, cleanup } from "@testing-library/react";
|
||||
import CalendarSelection from "@/components/Calendar/CalendarSelection";
|
||||
import * as calendarThunks from "@/features/Calendars/services";
|
||||
import "@testing-library/jest-dom";
|
||||
import CalendarSelection from "../../src/components/Calendar/CalendarSelection";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import * as calendarThunks from "../../src/features/Calendars/CalendarSlice";
|
||||
import { cleanup, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
|
||||
describe("CalendarSelection", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
screen,
|
||||
fireEvent,
|
||||
waitFor,
|
||||
DateTimeFields,
|
||||
DateTimeFieldsProps,
|
||||
} from "@/components/Event/components/DateTimeFields";
|
||||
import {
|
||||
act,
|
||||
fireEvent,
|
||||
render,
|
||||
screen,
|
||||
waitFor,
|
||||
} from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import {
|
||||
DateTimeFieldsProps,
|
||||
DateTimeFields,
|
||||
} from "../../src/components/Event/components/DateTimeFields";
|
||||
|
||||
jest.mock("twake-i18n", () => ({
|
||||
useI18n: () => ({
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { RootState } from "@/app/store";
|
||||
import EventDuplication from "@/components/Event/EventDuplicate";
|
||||
import EventPreviewModal from "@/features/Events/EventDisplayPreview";
|
||||
import EventPopover from "@/features/Events/EventModal";
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import EventDuplication from "../../src/components/Event/EventDuplicate";
|
||||
import EventPopover from "../../src/features/Events/EventModal";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import EventPreviewModal from "../../src/features/Events/EventDisplayPreview";
|
||||
|
||||
const day = new Date();
|
||||
const preloadedState = {
|
||||
@@ -58,7 +59,7 @@ const preloadedState = {
|
||||
},
|
||||
pending: false,
|
||||
},
|
||||
};
|
||||
} as unknown as RootState;
|
||||
|
||||
describe("EventDuplication", () => {
|
||||
it("calls onOpenDuplicate when button clicked", () => {
|
||||
@@ -155,7 +156,7 @@ describe("EventDisplayModal", () => {
|
||||
expect(
|
||||
screen.getByDisplayValue(
|
||||
preloadedState.calendars.list["667037022b752d0026472254/cal1"].events
|
||||
.event1.title
|
||||
.event1.title as string
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
DATETIME_WITH_SECONDS_LENGTH,
|
||||
DATETIME_FORMAT_WITH_SECONDS,
|
||||
DATETIME_FORMAT_WITHOUT_SECONDS,
|
||||
} from "../../../../src/components/Event/utils/dateTimeHelpers";
|
||||
} from "@/components/Event/utils/dateTimeHelpers";
|
||||
|
||||
describe("dateTimeHelpers", () => {
|
||||
describe("Constants", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import CalendarLayout from "@/components/Calendar/CalendarLayout";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import CalendarLayout from "../../src/components/Calendar/CalendarLayout";
|
||||
|
||||
describe("Event Error Handling", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import * as appHooks from "@/app/hooks";
|
||||
import { AppDispatch } from "@/app/store";
|
||||
import CalendarApp from "@/components/Calendar/Calendar";
|
||||
import {
|
||||
createEventHandlers,
|
||||
EventHandlersProps,
|
||||
} from "@/components/Calendar/handlers/eventHandlers";
|
||||
import * as eventThunks from "@/features/Calendars/services";
|
||||
import EventUpdateModal from "@/features/Events/EventUpdateModal";
|
||||
import { CalendarApi } from "@fullcalendar/core";
|
||||
import { jest } from "@jest/globals";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import "@testing-library/jest-dom";
|
||||
import {
|
||||
act,
|
||||
@@ -9,15 +17,7 @@ import {
|
||||
waitFor,
|
||||
within,
|
||||
} from "@testing-library/react";
|
||||
import * as appHooks from "../../src/app/hooks";
|
||||
import * as eventThunks from "../../src/features/Calendars/CalendarSlice";
|
||||
import CalendarApp from "../../src/components/Calendar/Calendar";
|
||||
import EventUpdateModal from "../../src/features/Events/EventUpdateModal";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import {
|
||||
createEventHandlers,
|
||||
EventHandlersProps,
|
||||
} from "../../src/components/Calendar/handlers/eventHandlers";
|
||||
|
||||
describe("CalendarApp integration", () => {
|
||||
const today = new Date();
|
||||
@@ -28,7 +28,7 @@ describe("CalendarApp integration", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
const dispatch = jest.fn() as ThunkDispatch<any, any, any>;
|
||||
const dispatch = jest.fn() as AppDispatch;
|
||||
jest.spyOn(appHooks, "useAppDispatch").mockReturnValue(dispatch);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { Menubar } from "@/components/Menubar/Menubar";
|
||||
import * as oidcAuth from "@/features/User/oidcAuth";
|
||||
import "@testing-library/jest-dom";
|
||||
import { Menubar } from "../../src/components/Menubar/Menubar";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import * as oidcAuth from "../../src/features/User/oidcAuth";
|
||||
|
||||
describe("Calendar App Component Display Tests", () => {
|
||||
const preloadedState = {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import { screen } from "@testing-library/react";
|
||||
import * as appHooks from "@/app/hooks";
|
||||
import { AppDispatch } from "@/app/store";
|
||||
import CalendarApp from "@/components/Calendar/Calendar";
|
||||
import { jest } from "@jest/globals";
|
||||
import CalendarApp from "../../src/components/Calendar/Calendar";
|
||||
import * as appHooks from "../../src/app/hooks";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
|
||||
describe("MiniCalendar", () => {
|
||||
const day = new Date();
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
const dispatch = jest.fn() as ThunkDispatch<any, any, any>;
|
||||
const dispatch = jest.fn() as AppDispatch;
|
||||
jest.spyOn(appHooks, "useAppDispatch").mockReturnValue(dispatch);
|
||||
jest.useFakeTimers().clearAllTimers();
|
||||
});
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { screen, fireEvent, waitFor, act } from "@testing-library/react";
|
||||
import { PeopleSearch, User } from "@/components/Attendees/PeopleSearch";
|
||||
import { searchUsers } from "@/features/User/userAPI";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import {
|
||||
User,
|
||||
PeopleSearch,
|
||||
} from "../../src/components/Attendees/PeopleSearch";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import { searchUsers } from "../../src/features/User/userAPI";
|
||||
|
||||
jest.mock("../../src/features/User/userAPI");
|
||||
jest.mock("@/features/User/userAPI");
|
||||
const mockedSearchUsers = searchUsers as jest.MockedFunction<
|
||||
typeof searchUsers
|
||||
>;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { screen, fireEvent, waitFor, act } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import RepeatEvent from "../../src/components/Event/EventRepeat";
|
||||
import EventPopover from "../../src/features/Events/EventModal";
|
||||
import { RepetitionObject } from "../../src/features/Events/EventsTypes";
|
||||
import RepeatEvent from "@/components/Event/EventRepeat";
|
||||
import * as eventThunks from "@/features/Calendars/services";
|
||||
import EventPopover from "@/features/Events/EventModal";
|
||||
import { RepetitionObject } from "@/features/Events/EventsTypes";
|
||||
import { DateSelectArg } from "@fullcalendar/core";
|
||||
import { formatDateToYYYYMMDDTHHMMSS } from "../../src/utils/dateUtils";
|
||||
import * as eventThunks from "../../src/features/Calendars/CalendarSlice";
|
||||
import * as apiUtils from "../../src/utils/apiUtils";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
|
||||
const baseRepetition: RepetitionObject = {
|
||||
freq: "",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { ResponsiveDialog } from "@/components/Dialog";
|
||||
import { Button, TextField, TwakeMuiThemeProvider } from "@linagora/twake-mui";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { ResponsiveDialog } from "../../src/components/Dialog";
|
||||
import { Button, TextField } from "@linagora/twake-mui";
|
||||
import { TwakeMuiThemeProvider } from "@linagora/twake-mui";
|
||||
|
||||
describe("ResponsiveDialog", () => {
|
||||
const mockOnClose = jest.fn();
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// __test__/features/calendars/calendarApi.test.ts
|
||||
|
||||
import {
|
||||
addSharedCalendar,
|
||||
exportCalendar,
|
||||
@@ -9,12 +7,12 @@ import {
|
||||
postCalendar,
|
||||
proppatchCalendar,
|
||||
removeCalendar,
|
||||
} from "../../../src/features/Calendars/CalendarApi";
|
||||
import { clientConfig } from "../../../src/features/User/oidcAuth";
|
||||
import { api } from "../../../src/utils/apiUtils";
|
||||
} from "@/features/Calendars/CalendarApi";
|
||||
import { clientConfig } from "@/features/User/oidcAuth";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
clientConfig.url = "https://example.com";
|
||||
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
jest.mock("@/utils/apiUtils");
|
||||
|
||||
describe("Calendar API", () => {
|
||||
afterEach(() => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { screen, fireEvent, waitFor } from "@testing-library/react";
|
||||
import CalendarPopover from "../../../src/components/Calendar/CalendarModal";
|
||||
import CalendarPopover from "@/components/Calendar/CalendarModal";
|
||||
import { getSecretLink } from "@/features/Calendars/CalendarApi";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import * as eventThunks from "@/features/Calendars/services";
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import * as eventThunks from "../../../src/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { getSecretLink } from "../../../src/features/Calendars/CalendarApi";
|
||||
|
||||
jest.mock("../../../src/features/Calendars/CalendarApi", () => ({
|
||||
jest.mock("@/features/Calendars/CalendarApi", () => ({
|
||||
getSecretLink: jest.fn(),
|
||||
}));
|
||||
|
||||
@@ -108,7 +108,7 @@ describe("CalendarPopover (editing mode)", () => {
|
||||
link: "/calendars/user/cal1",
|
||||
name: "Work Calendar",
|
||||
description: "Team meetings",
|
||||
color: "#33B679",
|
||||
color: { light: "#33B679" },
|
||||
owner: "alice",
|
||||
ownerEmails: ["alice@example.com"],
|
||||
visibility: "public",
|
||||
@@ -181,7 +181,7 @@ describe("CalendarPopover (editing mode)", () => {
|
||||
calId: "user1/cal1",
|
||||
calLink: "/calendars/user/cal1",
|
||||
patch: {
|
||||
color: "#33B679",
|
||||
color: { light: "#33B679" },
|
||||
desc: "Team meetings",
|
||||
name: "Updated Calendar",
|
||||
},
|
||||
@@ -213,7 +213,7 @@ describe("CalendarPopover - Tabs Scenarios", () => {
|
||||
link: "/calendars/user1/cal1.json",
|
||||
name: "Work Calendar",
|
||||
description: "Team meetings",
|
||||
color: "#33B679",
|
||||
color: { light: "#33B679" },
|
||||
owner: "alice",
|
||||
ownerEmails: ["alice@example.com"],
|
||||
visibility: "public",
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
import * as calAPI from "@/features/Calendars/CalendarApi";
|
||||
import reducer, {
|
||||
addEvent,
|
||||
removeEvent,
|
||||
createCalendar,
|
||||
updateEventLocal,
|
||||
removeEvent,
|
||||
removeTempCal,
|
||||
getTempCalendarsListAsync,
|
||||
putEventAsync,
|
||||
updateEventLocal,
|
||||
} from "@/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
addSharedCalendarAsync,
|
||||
createCalendarAsync,
|
||||
deleteEventAsync,
|
||||
getCalendarDetailAsync,
|
||||
getCalendarsListAsync,
|
||||
getEventAsync,
|
||||
patchCalendarAsync,
|
||||
removeCalendarAsync,
|
||||
getTempCalendarsListAsync,
|
||||
moveEventAsync,
|
||||
patchACLCalendarAsync,
|
||||
createCalendarAsync,
|
||||
addSharedCalendarAsync,
|
||||
deleteEventAsync,
|
||||
} from "../../../src/features/Calendars/CalendarSlice";
|
||||
import { getCalendarsListAsync } from "../../../src/features/Calendars/services/getCalendarsListAsync";
|
||||
import { getCalendarDetailAsync } from "../../../src/features/Calendars/services/getCalendarDetailAsync";
|
||||
|
||||
import * as calAPI from "../../../src/features/Calendars/CalendarApi";
|
||||
import * as userAPI from "../../../src/features/User/userAPI";
|
||||
|
||||
patchCalendarAsync,
|
||||
putEventAsync,
|
||||
removeCalendarAsync,
|
||||
} from "@/features/Calendars/services";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import * as userAPI from "@/features/User/userAPI";
|
||||
import userReducer, { setUserData } from "@/features/User/userSlice";
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
|
||||
import { setUserData } from "../../../src/features/User/userSlice";
|
||||
import userReducer from "../../../src/features/User/userSlice";
|
||||
|
||||
jest.mock("../../../src/features/Calendars/CalendarApi");
|
||||
jest.mock("../../../src/features/User/userAPI");
|
||||
jest.mock("../../../src/features/Events/EventApi");
|
||||
jest.mock("../../../src/features/Events/eventUtils");
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
jest.mock("@/features/Calendars/CalendarApi");
|
||||
jest.mock("@/features/User/userAPI");
|
||||
jest.mock("@/features/Events/EventApi");
|
||||
jest.mock("@/features/Events/eventUtils");
|
||||
jest.mock("@/utils/apiUtils");
|
||||
|
||||
describe("CalendarSlice", () => {
|
||||
const initialState = {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import CalendarApp from "@/components/Calendar/Calendar";
|
||||
import * as calendarUtils from "@/components/Calendar/utils/calendarUtils";
|
||||
import { updateSlotLabelVisibility } from "@/components/Calendar/utils/calendarUtils";
|
||||
import EventPreviewModal from "@/features/Events/EventDisplayPreview";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import * as SettingsSlice from "@/features/Settings/SettingsSlice";
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import CalendarApp from "../../../src/components/Calendar/Calendar";
|
||||
import { updateSlotLabelVisibility } from "../../../src/components/Calendar/utils/calendarUtils";
|
||||
import EventPreviewModal from "../../../src/features/Events/EventDisplayPreview";
|
||||
import * as SettingsSlice from "../../../src/features/Settings/SettingsSlice";
|
||||
import * as calendarUtils from "../../../src/components/Calendar/utils/calendarUtils";
|
||||
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
describe("Calendar - Timezone Integration", () => {
|
||||
@@ -199,7 +199,6 @@ describe("EventDisplayPreview - Timezone Display", () => {
|
||||
onClose={mockOnClose}
|
||||
eventId="allDayEvent"
|
||||
calId="user1/cal1"
|
||||
event={allDayEvent}
|
||||
/>,
|
||||
baseState
|
||||
);
|
||||
@@ -236,7 +235,6 @@ describe("EventDisplayPreview - Timezone Display", () => {
|
||||
eventId="event1"
|
||||
calId="user1/cal1"
|
||||
onClose={mockOnClose}
|
||||
event={baseEvent}
|
||||
/>,
|
||||
state
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { screen, fireEvent, waitFor, cleanup } from "@testing-library/react";
|
||||
import { TimezoneSelector } from "../../../src/components/Calendar/TimezoneSelector";
|
||||
import { TimezoneSelector } from "@/components/Calendar/TimezoneSelector";
|
||||
import { cleanup, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
describe("TimezoneSelector", () => {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import reducer from "../../../../src/features/Calendars/CalendarSlice";
|
||||
import * as fetchSyncTokenChanges from "@/features/Calendars/api/fetchSyncTokenChanges";
|
||||
import reducer from "@/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
refreshCalendarWithSyncToken,
|
||||
SyncTokenUpdates,
|
||||
} from "../../../../src/features/Calendars/services/refreshCalendar";
|
||||
import { Calendar } from "../../../../src/features/Calendars/CalendarTypes";
|
||||
import { CalendarEvent } from "../../../../src/features/Events/EventsTypes";
|
||||
import * as fetchSyncTokenChanges from "../../../../src/features/Calendars/api/fetchSyncTokenChanges";
|
||||
import * as EventApi from "../../../../src/features/Events/EventApi";
|
||||
} from "@/features/Calendars/services/refreshCalendar";
|
||||
import * as EventApi from "@/features/Events/EventApi";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
|
||||
jest.mock("../../../../src/features/Calendars/api/fetchSyncTokenChanges");
|
||||
jest.mock("../../../../src/features/Events/EventApi");
|
||||
jest.mock("@/features/Calendars/api/fetchSyncTokenChanges");
|
||||
jest.mock("@/features/Events/EventApi");
|
||||
|
||||
describe("refreshCalendarWithSyncToken", () => {
|
||||
const mockCalendar: Calendar = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EventErrorHandler } from "../../../src/components/Error/EventErrorHandler";
|
||||
import { EventErrorHandler } from "@/components/Error/EventErrorHandler";
|
||||
|
||||
describe("EventErrorHandler", () => {
|
||||
it("calls the callback when a new error is reported", () => {
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import {
|
||||
putEvent,
|
||||
moveEvent,
|
||||
deleteEvent,
|
||||
importEventFromFile,
|
||||
moveEvent,
|
||||
putEvent,
|
||||
searchEvent,
|
||||
} from "../../../src/features/Events/EventApi";
|
||||
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
|
||||
import { calendarEventToJCal } from "../../../src/features/Events/eventUtils";
|
||||
import { clientConfig } from "../../../src/features/User/oidcAuth";
|
||||
import { api } from "../../../src/utils/apiUtils";
|
||||
} from "@/features/Events/EventApi";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import { calendarEventToJCal } from "@/features/Events/eventUtils";
|
||||
import { clientConfig } from "@/features/User/oidcAuth";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
|
||||
clientConfig.url = "https://example.com";
|
||||
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
jest.mock("@/utils/apiUtils");
|
||||
|
||||
const day = new Date();
|
||||
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
import * as appHooks from "@/app/hooks";
|
||||
import { AppDispatch } from "@/app/store";
|
||||
import { InfoRow } from "@/components/Event/InfoRow";
|
||||
import { LONG_DATE_FORMAT } from "@/components/Event/utils/dateTimeFormatters";
|
||||
import {
|
||||
stringAvatar,
|
||||
stringToColor,
|
||||
} from "@/components/Event/utils/eventUtils";
|
||||
import * as calendarSlice from "@/features/Calendars/CalendarSlice";
|
||||
import * as eventThunks from "@/features/Calendars/services";
|
||||
import EventPreviewModal from "@/features/Events/EventDisplayPreview";
|
||||
import EventUpdateModal from "@/features/Events/EventUpdateModal";
|
||||
import {
|
||||
screen,
|
||||
fireEvent,
|
||||
waitFor,
|
||||
act,
|
||||
cleanup,
|
||||
fireEvent,
|
||||
screen,
|
||||
waitFor,
|
||||
} from "@testing-library/react";
|
||||
import * as eventThunks from "../../../src/features/Calendars/CalendarSlice";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import EventUpdateModal from "../../../src/features/Events/EventUpdateModal";
|
||||
import EventPreviewModal from "../../../src/features/Events/EventDisplayPreview";
|
||||
import { InfoRow } from "../../../src/components/Event/InfoRow";
|
||||
import {
|
||||
stringToColor,
|
||||
stringAvatar,
|
||||
} from "../../../src/components/Event/utils/eventUtils";
|
||||
import * as appHooks from "../../../src/app/hooks";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import dayjs from "dayjs";
|
||||
import { LONG_DATE_FORMAT } from "../../../src/components/Event/utils/dateTimeFormatters";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
describe("Event Preview Display", () => {
|
||||
const mockOnClose = jest.fn();
|
||||
@@ -747,7 +748,7 @@ describe("Event Preview Display", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
const dispatch = jest.fn() as ThunkDispatch<any, any, any>;
|
||||
const dispatch = jest.fn() as AppDispatch;
|
||||
jest.spyOn(appHooks, "useAppDispatch").mockReturnValue(dispatch);
|
||||
});
|
||||
|
||||
@@ -1831,7 +1832,7 @@ describe("Event Full Display", () => {
|
||||
(promise as any).unwrap = () => promise;
|
||||
return () => promise as any;
|
||||
});
|
||||
const spyRemove = jest.spyOn(eventThunks, "removeEvent");
|
||||
const spyRemove = jest.spyOn(calendarSlice, "removeEvent");
|
||||
|
||||
const testDate = new Date("2025-01-15T10:00:00.000Z");
|
||||
const testEndDate = new Date("2025-01-15T11:00:00.000Z");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as eventThunks from "@/features/Calendars/services";
|
||||
import EventPopover from "@/features/Events/EventModal";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
import { DateSelectArg } from "@fullcalendar/core";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import * as eventThunks from "../../../src/features/Calendars/CalendarSlice";
|
||||
import EventPopover from "../../../src/features/Events/EventModal";
|
||||
import { api } from "../../../src/utils/apiUtils";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
jest.mock("@/utils/apiUtils");
|
||||
|
||||
describe("EventPopover", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
import { screen, fireEvent, waitFor, act } from "@testing-library/react";
|
||||
import * as eventThunks from "../../../src/features/Calendars/CalendarSlice";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import EventUpdateModal from "../../../src/features/Events/EventUpdateModal";
|
||||
import { EditModeDialog } from "../../../src/components/Event/EditModeDialog";
|
||||
import * as EventApi from "../../../src/features/Events/EventApi";
|
||||
import { RootState } from "@/app/store";
|
||||
import {
|
||||
createEventHandlers,
|
||||
EventHandlersProps,
|
||||
} from "../../../src/components/Calendar/handlers/eventHandlers";
|
||||
import EventPreviewModal from "../../../src/features/Events/EventDisplayPreview";
|
||||
} from "@/components/Calendar/handlers/eventHandlers";
|
||||
import { EditModeDialog } from "@/components/Event/EditModeDialog";
|
||||
import * as eventThunks from "@/features/Calendars/services";
|
||||
import * as EventApi from "@/features/Events/EventApi";
|
||||
import EventPreviewModal from "@/features/Events/EventDisplayPreview";
|
||||
import EventUpdateModal from "@/features/Events/EventUpdateModal";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import preview from "jest-preview";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
jest.mock("../../../src/components/Event/utils/eventUtils", () => {
|
||||
const actual = jest.requireActual(
|
||||
"../../../src/components/Event/utils/eventUtils"
|
||||
);
|
||||
jest.mock("@/components/Event/utils/eventUtils", () => {
|
||||
const actual = jest.requireActual("@/components/Event/utils/eventUtils");
|
||||
return {
|
||||
...actual,
|
||||
refreshCalendars: jest.fn(() => Promise.resolve()),
|
||||
refreshSingularCalendar: jest.fn(() => Promise.resolve()),
|
||||
};
|
||||
});
|
||||
import preview from "jest-preview";
|
||||
const mockOnClose = jest.fn();
|
||||
const day = new Date("2025-03-15T10:00:00Z");
|
||||
|
||||
@@ -102,7 +101,7 @@ const basePreloadedState = {
|
||||
pending: false,
|
||||
templist: {},
|
||||
},
|
||||
};
|
||||
} as unknown as RootState;
|
||||
|
||||
describe("EditModeDialog Component", () => {
|
||||
beforeEach(() => {
|
||||
@@ -946,7 +945,7 @@ describe("handleRSVP function", () => {
|
||||
|
||||
const {
|
||||
handleRSVP,
|
||||
} = require("../../../src/components/Event/eventHandlers/eventHandlers");
|
||||
} = require("@/components/Event/eventHandlers/eventHandlers");
|
||||
|
||||
jest.spyOn(eventThunks, "putEventAsync").mockImplementation((payload) => {
|
||||
const promise = Promise.resolve(payload);
|
||||
@@ -992,7 +991,7 @@ describe("handleDelete function", () => {
|
||||
|
||||
const {
|
||||
handleDelete,
|
||||
} = require("../../../src/components/Event/eventHandlers/eventHandlers");
|
||||
} = require("@/components/Event/eventHandlers/eventHandlers");
|
||||
|
||||
jest
|
||||
.spyOn(eventThunks, "deleteEventAsync")
|
||||
@@ -1028,7 +1027,7 @@ describe("handleDelete function", () => {
|
||||
|
||||
const {
|
||||
handleDelete,
|
||||
} = require("../../../src/components/Event/eventHandlers/eventHandlers");
|
||||
} = require("@/components/Event/eventHandlers/eventHandlers");
|
||||
|
||||
jest
|
||||
.spyOn(eventThunks, "deleteEventInstanceAsync")
|
||||
@@ -1059,7 +1058,7 @@ describe("handleDelete function", () => {
|
||||
|
||||
const {
|
||||
handleDelete,
|
||||
} = require("../../../src/components/Event/eventHandlers/eventHandlers");
|
||||
} = require("@/components/Event/eventHandlers/eventHandlers");
|
||||
|
||||
jest
|
||||
.spyOn(eventThunks, "deleteEventAsync")
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { screen, fireEvent, waitFor, act } from "@testing-library/react";
|
||||
import * as eventUtils from "@/components/Event/utils/eventUtils";
|
||||
import * as CalendarApi from "@/features/Calendars/CalendarApi";
|
||||
import * as EventApi from "@/features/Events/EventApi";
|
||||
import EventUpdateModal from "@/features/Events/EventUpdateModal";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import EventUpdateModal from "../../../src/features/Events/EventUpdateModal";
|
||||
import * as EventApi from "../../../src/features/Events/EventApi";
|
||||
import * as CalendarApi from "../../../src/features/Calendars/CalendarApi";
|
||||
import * as eventUtils from "../../../src/components/Event/utils/eventUtils";
|
||||
|
||||
jest.mock("../../../src/features/Events/EventApi");
|
||||
jest.mock("../../../src/features/Calendars/CalendarApi");
|
||||
jest.mock("@/features/Events/EventApi");
|
||||
jest.mock("@/features/Calendars/CalendarApi");
|
||||
|
||||
describe("EventUpdateModal Timezone Handling", () => {
|
||||
const mockOnClose = jest.fn();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { screen, fireEvent } from "@testing-library/react";
|
||||
import ImportAlert from "@/features/Events/ImportAlert";
|
||||
import { fireEvent, screen } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import ImportAlert from "../../../src/features/Events/ImportAlert";
|
||||
import { clearError } from "../../../src/features/Calendars/CalendarSlice";
|
||||
|
||||
// Mock the ErrorSnackbar component since we want to test ImportAlert logic,
|
||||
// but we can also test integration if we don't mock it.
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import * as appHooks from "@/app/hooks";
|
||||
import CalendarLayout from "@/components/Calendar/CalendarLayout";
|
||||
import * as calendarUtils from "@/components/Calendar/utils/calendarUtils";
|
||||
import * as eventUtils from "@/components/Event/utils/eventUtils";
|
||||
import * as CalendarSlice from "@/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import * as eventThunks from "@/features/Calendars/services";
|
||||
import EventPreviewModal from "@/features/Events/EventDisplayPreview";
|
||||
import EventPopover from "@/features/Events/EventModal";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import EventUpdateModal from "@/features/Events/EventUpdateModal";
|
||||
import * as userApi from "@/features/User/userAPI";
|
||||
import { DateSelectArg } from "@fullcalendar/core";
|
||||
import { jest } from "@jest/globals";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import "@testing-library/jest-dom";
|
||||
import { screen, waitFor, fireEvent, act } from "@testing-library/react";
|
||||
import * as appHooks from "../../../src/app/hooks";
|
||||
import * as eventUtils from "../../../src/components/Event/utils/eventUtils";
|
||||
import * as userApi from "../../../src/features/User/userAPI";
|
||||
import * as calendarUtils from "../../../src/components/Calendar/utils/calendarUtils";
|
||||
import * as eventThunks from "../../../src/features/Calendars/CalendarSlice";
|
||||
import EventPreviewModal from "../../../src/features/Events/EventDisplayPreview";
|
||||
import EventPopover from "../../../src/features/Events/EventModal";
|
||||
import EventUpdateModal from "../../../src/features/Events/EventUpdateModal";
|
||||
import CalendarLayout from "../../../src/components/Calendar/CalendarLayout";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { SpiedFunction } from "jest-mock";
|
||||
import { Calendar } from "../../../src/features/Calendars/CalendarTypes";
|
||||
import { CalendarEvent } from "../../../src/features/Events/EventsTypes";
|
||||
import { DateSelectArg } from "@fullcalendar/core";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
describe("Update tempcalendars called with correct params", () => {
|
||||
const today = new Date();
|
||||
@@ -612,7 +613,7 @@ describe("Update tempcalendars called with correct params", () => {
|
||||
});
|
||||
|
||||
it("should call emptyEventsCal with correct params before refreshing", async () => {
|
||||
const emptyEventsCalSpy = jest.spyOn(eventThunks, "emptyEventsCal");
|
||||
const emptyEventsCalSpy = jest.spyOn(CalendarSlice, "emptyEventsCal");
|
||||
|
||||
const preloadedState = createPreloadedState(true);
|
||||
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import {
|
||||
CalendarEvent,
|
||||
RepetitionObject,
|
||||
} from "../../../src/features/Events/EventsTypes";
|
||||
import { CalendarEvent, RepetitionObject } from "@/features/Events/EventsTypes";
|
||||
import {
|
||||
calendarEventToJCal,
|
||||
parseCalendarEvent,
|
||||
combineMasterDateWithFormTime,
|
||||
detectRecurringEventChanges,
|
||||
normalizeRepetition,
|
||||
normalizeTimezone,
|
||||
detectRecurringEventChanges,
|
||||
} from "../../../src/features/Events/eventUtils";
|
||||
import { TIMEZONES } from "../../../src/utils/timezone-data";
|
||||
parseCalendarEvent,
|
||||
} from "@/features/Events/eventUtils";
|
||||
|
||||
describe("parseCalendarEvent", () => {
|
||||
const baseColor = { light: "#00FF00" };
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import SearchBar from "@/components/Menubar/EventSearchBar";
|
||||
import * as searchThunk from "@/features/Search/SearchSlice";
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import SearchBar from "../../../src/components/Menubar/EventSearchBar";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import * as searchThunk from "../../../src/features/Search/SearchSlice";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
describe("EventSearchBar", () => {
|
||||
const today = new Date();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SearchResultsPage from "@/features/Search/SearchResultsPage";
|
||||
import { screen } from "@testing-library/react";
|
||||
import SearchResultsPage from "../../../src/features/Search/SearchResultsPage";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
describe("SearchResultsPage", () => {
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// SearchSlice.test.ts
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import * as EventApi from "@/features/Events/EventApi";
|
||||
import searchResultReducer, {
|
||||
searchEventsAsync,
|
||||
setResults,
|
||||
setHits,
|
||||
} from "../../../src/features/Search/SearchSlice";
|
||||
import * as EventApi from "../../../src/features/Events/EventApi";
|
||||
setResults,
|
||||
} from "@/features/Search/SearchSlice";
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
|
||||
jest.mock("../../../src/features/Events/EventApi");
|
||||
jest.mock("@/features/Events/EventApi");
|
||||
|
||||
describe("SearchSlice", () => {
|
||||
let store: any;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import SettingsPage from "../../../src/features/Settings/SettingsPage";
|
||||
import SettingsPage from "@/features/Settings/SettingsPage";
|
||||
import settingsReducer, {
|
||||
setIsBrowserDefaultTimeZone,
|
||||
setTimeZone,
|
||||
} from "../../../src/features/Settings/SettingsSlice";
|
||||
} from "@/features/Settings/SettingsSlice";
|
||||
import userReducer, {
|
||||
getOpenPaasUserDataAsync,
|
||||
setTimezone as setUserTimeZone,
|
||||
} from "../../../src/features/User/userSlice";
|
||||
import { api } from "../../../src/utils/apiUtils";
|
||||
import { browserDefaultTimeZone } from "../../../src/utils/timezone";
|
||||
} from "@/features/User/userSlice";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
import { browserDefaultTimeZone } from "@/utils/timezone";
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
jest.mock("@/utils/apiUtils");
|
||||
|
||||
describe("Timezone synchronization after getOpenPaasUserDataAsync", () => {
|
||||
let apiGetSpy: jest.SpyInstance;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import SettingsPage from "@/features/Settings/SettingsPage";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
import "@testing-library/jest-dom";
|
||||
import SettingsPage from "../../../src/features/Settings/SettingsPage";
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import { api } from "../../../src/utils/apiUtils";
|
||||
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
jest.mock("@/utils/apiUtils");
|
||||
|
||||
describe("SettingsPage", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as appHooks from "@/app/hooks";
|
||||
import { AppDispatch } from "@/app/store";
|
||||
import HandleLogin from "@/features/User/HandleLogin";
|
||||
import * as oidcAuth from "@/features/User/oidcAuth";
|
||||
import { clientConfig } from "@/features/User/oidcAuth";
|
||||
import * as apiUtils from "@/utils/apiUtils";
|
||||
import { screen, waitFor } from "@testing-library/react";
|
||||
import thunk, { ThunkDispatch } from "redux-thunk";
|
||||
import HandleLogin from "../../../src/features/User/HandleLogin";
|
||||
import * as oidcAuth from "../../../src/features/User/oidcAuth";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
import { clientConfig } from "../../../src/features/User/oidcAuth";
|
||||
import * as apiUtils from "../../../src/utils/apiUtils";
|
||||
import * as appHooks from "../../../src/app/hooks";
|
||||
import { push } from "redux-first-history";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
clientConfig.url = "https://example.com";
|
||||
|
||||
@@ -14,7 +14,7 @@ describe("HandleLogin", () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.spyOn(apiUtils, "redirectTo").mockImplementation(() => {});
|
||||
const dispatch = jest.fn() as ThunkDispatch<any, any, any>;
|
||||
const dispatch = jest.fn() as AppDispatch;
|
||||
jest.spyOn(appHooks, "useAppDispatch").mockReturnValue(dispatch);
|
||||
sessionStorage.clear();
|
||||
});
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
// __test__/features/user/CallbackResume.test.tsx
|
||||
import { render, waitFor } from "@testing-library/react";
|
||||
import { CallbackResume } from "../../../src/features/User/LoginCallback";
|
||||
import { useAppDispatch } from "../../../src/app/hooks";
|
||||
import * as oidcAuth from "../../../src/features/User/oidcAuth";
|
||||
import { push } from "redux-first-history";
|
||||
import { useAppDispatch } from "@/app/hooks";
|
||||
import { getCalendarsListAsync } from "@/features/Calendars/services/getCalendarsListAsync";
|
||||
import { CallbackResume } from "@/features/User/LoginCallback";
|
||||
import * as oidcAuth from "@/features/User/oidcAuth";
|
||||
import {
|
||||
getOpenPaasUserDataAsync,
|
||||
setTokens,
|
||||
setUserData,
|
||||
getOpenPaasUserDataAsync,
|
||||
} from "../../../src/features/User/userSlice";
|
||||
import { getCalendarsListAsync } from "../../../src/features/Calendars/services/getCalendarsListAsync";
|
||||
} from "@/features/User/userSlice";
|
||||
import { render, waitFor } from "@testing-library/react";
|
||||
import { push } from "redux-first-history";
|
||||
import { renderWithProviders } from "../../utils/Renderwithproviders";
|
||||
|
||||
// Mocks
|
||||
jest.mock("../../../src/app/hooks", () => ({
|
||||
jest.mock("@/app/hooks", () => ({
|
||||
useAppDispatch: jest.fn(),
|
||||
useAppSelector: jest.fn(() => ({})),
|
||||
}));
|
||||
|
||||
jest.mock("../../../src/features/User/oidcAuth", () => ({
|
||||
jest.mock("@/features/User/oidcAuth", () => ({
|
||||
Callback: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock("../../../src/features/User/userSlice", () => {
|
||||
jest.mock("@/features/User/userSlice", () => {
|
||||
const mockGetUser = Object.assign(
|
||||
jest.fn(() => ({ type: "GET_USER_ID" })),
|
||||
{
|
||||
@@ -39,23 +38,20 @@ jest.mock("../../../src/features/User/userSlice", () => {
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock(
|
||||
"../../../src/features/Calendars/services/getCalendarsListAsync",
|
||||
() => {
|
||||
const mockGetCalendars = Object.assign(
|
||||
jest.fn(() => ({ type: "GET_CALENDARS" })),
|
||||
{
|
||||
pending: { type: "GET_CALENDARS/pending" },
|
||||
fulfilled: { type: "GET_CALENDARS/fulfilled" },
|
||||
rejected: { type: "GET_CALENDARS/rejected" },
|
||||
}
|
||||
);
|
||||
jest.mock("@/features/Calendars/services/getCalendarsListAsync", () => {
|
||||
const mockGetCalendars = Object.assign(
|
||||
jest.fn(() => ({ type: "GET_CALENDARS" })),
|
||||
{
|
||||
pending: { type: "GET_CALENDARS/pending" },
|
||||
fulfilled: { type: "GET_CALENDARS/fulfilled" },
|
||||
rejected: { type: "GET_CALENDARS/rejected" },
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
getCalendarsListAsync: mockGetCalendars,
|
||||
};
|
||||
}
|
||||
);
|
||||
return {
|
||||
getCalendarsListAsync: mockGetCalendars,
|
||||
};
|
||||
});
|
||||
|
||||
describe("CallbackResume", () => {
|
||||
const dispatch = jest.fn();
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// __tests__/auth.test.ts
|
||||
import * as client from "openid-client";
|
||||
import {
|
||||
Auth,
|
||||
Callback,
|
||||
clientConfig,
|
||||
getClientConfig,
|
||||
Auth,
|
||||
Logout,
|
||||
Callback,
|
||||
} from "../../../src/features/User/oidcAuth";
|
||||
import * as apiUtils from "../../../src/utils/apiUtils";
|
||||
} from "@/features/User/oidcAuth";
|
||||
import * as apiUtils from "@/utils/apiUtils";
|
||||
import * as client from "openid-client";
|
||||
|
||||
clientConfig.url = "https://example.com";
|
||||
const localAdress = "https://local.exemple.com";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { clientConfig } from "../../../src/features/User/oidcAuth";
|
||||
import { clientConfig } from "@/features/User/oidcAuth";
|
||||
import {
|
||||
getOpenPaasUser,
|
||||
updateUserConfigurations,
|
||||
} from "../../../src/features/User/userAPI";
|
||||
import { api } from "../../../src/utils/apiUtils";
|
||||
} from "@/features/User/userAPI";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
jest.mock("@/utils/apiUtils");
|
||||
|
||||
clientConfig.url = "https://example.com";
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { cleanup, render, waitFor, act } from "@testing-library/react";
|
||||
import { Provider } from "react-redux";
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import { setSelectedCalendars } from "@/utils/storage/setSelectedCalendars";
|
||||
import { createWebSocketConnection } from "@/websocket/connection/createConnection";
|
||||
import { registerToCalendars } from "@/websocket/operations/registerToCalendars";
|
||||
import { unregisterToCalendars } from "@/websocket/operations/unregisterToCalendars";
|
||||
import { WebSocketGate } from "@/websocket/WebSocketGate";
|
||||
import { setSelectedCalendars } from "@/utils/storage/setSelectedCalendars";
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import { act, cleanup, render, waitFor } from "@testing-library/react";
|
||||
import { Provider } from "react-redux";
|
||||
|
||||
jest.mock("@/websocket/connection/createConnection");
|
||||
jest.mock("@/websocket/operations/registerToCalendars");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { waitFor } from "@testing-library/dom";
|
||||
import { fetchWebSocketTicket } from "@/websocket/api/fetchWebSocketTicket";
|
||||
import { createWebSocketConnection } from "@/websocket/connection/createConnection";
|
||||
import { WS_INBOUND_EVENTS } from "@/websocket/protocols";
|
||||
import { waitFor } from "@testing-library/dom";
|
||||
import { setupWebsocket } from "./utils/setupWebsocket";
|
||||
|
||||
jest.mock("@/websocket/api/fetchWebSocketTicket");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { updateCalendars } from "@/websocket/messaging/updateCalendars";
|
||||
import { refreshCalendarWithSyncToken } from "@/features/Calendars/services/refreshCalendar";
|
||||
import { RootState, store } from "@/app/store";
|
||||
import { WS_INBOUND_EVENTS } from "@/websocket/protocols";
|
||||
import { refreshCalendarWithSyncToken } from "@/features/Calendars/services/refreshCalendar";
|
||||
import { getDisplayedCalendarRange } from "@/utils/CalendarRangeManager";
|
||||
import { updateCalendars } from "@/websocket/messaging/updateCalendars";
|
||||
import { WS_INBOUND_EVENTS } from "@/websocket/protocols";
|
||||
import { waitFor } from "@testing-library/dom";
|
||||
|
||||
jest.mock("@/features/Calendars/services/refreshCalendar");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WS_INBOUND_EVENTS } from "@/websocket/protocols";
|
||||
import { parseMessage } from "@/websocket/messaging/parseMessage";
|
||||
import { WS_INBOUND_EVENTS } from "@/websocket/protocols";
|
||||
|
||||
describe("parseMessage", () => {
|
||||
it("should return empty set for non-object messages", () => {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// src/websocket/__tests__/unregisterToCalendars.test.ts
|
||||
|
||||
import { unregisterToCalendars } from "@/websocket/operations/unregisterToCalendars";
|
||||
|
||||
describe("unregisterToCalendars", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
getDisplayedDate,
|
||||
setDisplayedDateAndRange,
|
||||
calendarRangeManager,
|
||||
getDisplayedCalendarRange,
|
||||
} from "../../src/utils/CalendarRangeManager";
|
||||
getDisplayedDate,
|
||||
setDisplayedDateAndRange,
|
||||
} from "@/utils/CalendarRangeManager";
|
||||
|
||||
describe("CalendarRangeManager", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { AppStore, RootState } from "@/app/store";
|
||||
import { setupStore } from "@/app/store";
|
||||
import { TwakeMuiThemeProvider } from "@linagora/twake-mui";
|
||||
import type { RenderOptions } from "@testing-library/react";
|
||||
import { render } from "@testing-library/react";
|
||||
import React, { PropsWithChildren } from "react";
|
||||
import { Provider } from "react-redux";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
import { I18nContext } from "twake-i18n";
|
||||
import { TwakeMuiThemeProvider } from "@linagora/twake-mui";
|
||||
import type { AppStore, RootState } from "../../src/app/store";
|
||||
import { setupStore } from "../../src/app/store";
|
||||
interface ExtendedRenderOptions extends Omit<RenderOptions, "queries"> {
|
||||
preloadedState?: Partial<RootState>;
|
||||
store?: AppStore;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getInitials, stringToGradient } from "../../src/utils/avatarUtils";
|
||||
import { getInitials, stringToGradient } from "@/utils/avatarUtils";
|
||||
|
||||
jest.mock("@linagora/twake-mui", () => ({
|
||||
nameToColor: jest.fn((name: string) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCalendarVisibility } from "../../src/components/Calendar/utils/calendarUtils";
|
||||
import { getCalendarVisibility } from "@/components/Calendar/utils/calendarUtils";
|
||||
|
||||
interface AclEntry {
|
||||
privilege: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCalendarRange } from "../../src/utils/dateUtils";
|
||||
import { getCalendarRange } from "@/utils/dateUtils";
|
||||
|
||||
describe("getCalendarRange", () => {
|
||||
it("Nov 2025 (5 weeks): 2025-10-27 to 2025-11-30", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { findCalendarById } from "../../src/utils/findCalendarById";
|
||||
import { Calendar } from "../../src/features/Calendars/CalendarTypes";
|
||||
import { RootState } from "../../src/app/store";
|
||||
import { RootState } from "@/app/store";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { findCalendarById } from "@/utils";
|
||||
|
||||
describe("findCalendarById", () => {
|
||||
const mockCalendar1: Calendar = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getUserDisplayName } from "../../src/utils/userUtils";
|
||||
import { userData } from "../../src/features/User/userDataTypes";
|
||||
import { userData } from "@/features/User/userDataTypes";
|
||||
import { getUserDisplayName } from "@/utils/userUtils";
|
||||
|
||||
describe("userUtils", () => {
|
||||
describe("getUserDisplayName", () => {
|
||||
|
||||
+13
-13
@@ -1,18 +1,19 @@
|
||||
import { TwakeMuiThemeProvider } from "@linagora/twake-mui";
|
||||
import { Suspense, useEffect } from "react";
|
||||
import { Route, Routes } from "react-router-dom";
|
||||
import { HistoryRouter as Router } from "redux-first-history/rr6";
|
||||
import { CallbackResume } from "./features/User/LoginCallback";
|
||||
import { history } from "./app/store";
|
||||
import "./App.styl";
|
||||
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 { TwakeMuiThemeProvider } from "@linagora/twake-mui";
|
||||
import { useAppDispatch, useAppSelector } from "./app/hooks";
|
||||
import { push } from "redux-first-history";
|
||||
import { HistoryRouter as Router } from "redux-first-history/rr6";
|
||||
import "./App.styl";
|
||||
import { useAppDispatch, useAppSelector } from "./app/hooks";
|
||||
import { history } from "./app/store";
|
||||
import CalendarLayout from "./components/Calendar/CalendarLayout";
|
||||
import { Error as ErrorPage } from "./components/Error/Error";
|
||||
import { ErrorSnackbar } from "./components/Error/ErrorSnackbar";
|
||||
import { Loading } from "./components/Loading/Loading";
|
||||
import { AVAILABLE_LANGUAGES } from "./features/Settings/constants";
|
||||
import HandleLogin from "./features/User/HandleLogin";
|
||||
import { CallbackResume } from "./features/User/LoginCallback";
|
||||
import { WebSocketGate } from "./websocket/WebSocketGate";
|
||||
|
||||
import {
|
||||
enGB,
|
||||
@@ -21,12 +22,11 @@ import {
|
||||
vi as viLocale,
|
||||
} from "date-fns/locale";
|
||||
|
||||
import I18n from "twake-i18n";
|
||||
import en from "./locales/en.json";
|
||||
import fr from "./locales/fr.json";
|
||||
import ru from "./locales/ru.json";
|
||||
import vi from "./locales/vi.json";
|
||||
import I18n from "twake-i18n";
|
||||
import { WebSocketGate } from "./websocket/WebSocketGate";
|
||||
|
||||
const locale = { en, fr, ru, vi };
|
||||
const dateLocales = { en: enGB, fr: frLocale, ru: ruLocale, vi: viLocale };
|
||||
@@ -75,7 +75,7 @@ function App() {
|
||||
<Route path="/" element={<HandleLogin />} />
|
||||
<Route path="/calendar" element={<CalendarLayout />} />
|
||||
<Route path="/callback" element={<CallbackResume />} />
|
||||
<Route path="/error" element={<Error />} />
|
||||
<Route path="/error" element={<ErrorPage />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
<ErrorSnackbar error={error} type="user" />
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import type { RootState, AppDispatch } from "./store";
|
||||
import type { AppDispatch, RootState } from "./store";
|
||||
|
||||
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
|
||||
export const useAppSelector = useSelector.withTypes<RootState>();
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
import eventsCalendar from "@/features/Calendars/CalendarSlice";
|
||||
import searchResultReducer from "@/features/Search/SearchSlice";
|
||||
import settingsReducer from "@/features/Settings/SettingsSlice";
|
||||
import userReducer from "@/features/User/userSlice";
|
||||
import { combineReducers, configureStore } from "@reduxjs/toolkit";
|
||||
import userReducer from "../features/User/userSlice";
|
||||
import settingsReducer from "../features/Settings/SettingsSlice";
|
||||
import searchResultReducer from "../features/Search/SearchSlice";
|
||||
import eventsCalendar from "../features/Calendars/CalendarSlice";
|
||||
import { createReduxHistoryContext } from "redux-first-history";
|
||||
import { createBrowserHistory } from "history";
|
||||
import { createReduxHistoryContext } from "redux-first-history";
|
||||
|
||||
const { createReduxHistory, routerMiddleware, routerReducer } =
|
||||
createReduxHistoryContext({ history: createBrowserHistory() });
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
import { createAttendee } from "@/features/User/models/attendee.mapper";
|
||||
import { useEffect, useState } from "react";
|
||||
import { userAttendee } from "../../features/User/models/attendee";
|
||||
import { createAttendee } from "../../features/User/models/attendee.mapper";
|
||||
import {
|
||||
ExtendedAutocompleteRenderInputParams,
|
||||
PeopleSearch,
|
||||
User,
|
||||
ExtendedAutocompleteRenderInputParams,
|
||||
} from "./PeopleSearch";
|
||||
|
||||
export default function UserSearch({
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
import { getAccessiblePair } from "@/components/Calendar/utils/calendarColorsUtils";
|
||||
import { stringAvatar } from "@/components/Event/utils/eventUtils";
|
||||
import { SnackbarAlert } from "@/components/Loading/SnackBarAlert";
|
||||
import { searchUsers } from "@/features/User/userAPI";
|
||||
import {
|
||||
Autocomplete,
|
||||
type AutocompleteRenderInputParams,
|
||||
Avatar,
|
||||
Chip,
|
||||
CircularProgress,
|
||||
ListItem,
|
||||
ListItemAvatar,
|
||||
ListItemText,
|
||||
PaperProps,
|
||||
PopperProps,
|
||||
TextField,
|
||||
useTheme,
|
||||
type AutocompleteRenderInputParams,
|
||||
} from "@linagora/twake-mui";
|
||||
import { stringAvatar } from "../Event/utils/eventUtils";
|
||||
import PeopleOutlineOutlinedIcon from "@mui/icons-material/PeopleOutlineOutlined";
|
||||
import {
|
||||
type ReactNode,
|
||||
HTMLAttributes,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useState,
|
||||
HTMLAttributes,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { searchUsers } from "../../features/User/userAPI";
|
||||
import PeopleOutlineOutlinedIcon from "@mui/icons-material/PeopleOutlineOutlined";
|
||||
import { Chip, useTheme } from "@linagora/twake-mui";
|
||||
import { getAccessiblePair } from "../Calendar/utils/calendarColorsUtils";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { SnackbarAlert } from "../Loading/SnackBarAlert";
|
||||
import { PopperProps, PaperProps } from "@linagora/twake-mui";
|
||||
|
||||
export interface User {
|
||||
email: string;
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
|
||||
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
|
||||
import {
|
||||
Box,
|
||||
IconButton,
|
||||
TextField,
|
||||
Button,
|
||||
Typography,
|
||||
InputAdornment,
|
||||
Backdrop,
|
||||
CircularProgress,
|
||||
} from "@linagora/twake-mui";
|
||||
import { useState, useEffect } from "react";
|
||||
import {
|
||||
exportCalendar,
|
||||
getSecretLink,
|
||||
} from "../../features/Calendars/CalendarApi";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import { FieldWithLabel } from "../Event/components/FieldWithLabel";
|
||||
import { SnackbarAlert } from "../Loading/SnackBarAlert";
|
||||
} from "@/features/Calendars/CalendarApi";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
CircularProgress,
|
||||
IconButton,
|
||||
InputAdornment,
|
||||
TextField,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
|
||||
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { ErrorSnackbar } from "../Error/ErrorSnackbar";
|
||||
import { FieldWithLabel } from "../Event/components/FieldWithLabel";
|
||||
import { SnackbarAlert } from "../Loading/SnackBarAlert";
|
||||
|
||||
export function AccessTab({ calendar }: { calendar: Calendar }) {
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,52 +1,51 @@
|
||||
import FullCalendar from "@fullcalendar/react";
|
||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||
import interactionPlugin from "@fullcalendar/interaction";
|
||||
import { CalendarApi, DateSelectArg } from "@fullcalendar/core";
|
||||
import "./Calendar.styl";
|
||||
import "./CustomCalendar.styl";
|
||||
import { MutableRefObject, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import EventPopover from "../../features/Events/EventModal";
|
||||
import { CalendarEvent } from "../../features/Events/EventsTypes";
|
||||
import CalendarSelection from "./CalendarSelection";
|
||||
import { getCalendarDetailAsync } from "../../features/Calendars/services/getCalendarDetailAsync";
|
||||
import ImportAlert from "../../features/Events/ImportAlert";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { getCalendarDetailAsync } from "@/features/Calendars/services";
|
||||
import EventPreviewModal from "@/features/Events/EventDisplayPreview";
|
||||
import EventPopover from "@/features/Events/EventModal";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import ImportAlert from "@/features/Events/ImportAlert";
|
||||
import SearchResultsPage from "@/features/Search/SearchResultsPage";
|
||||
import { setTimeZone } from "@/features/Settings/SettingsSlice";
|
||||
import { setDisplayedDateAndRange } from "@/utils/CalendarRangeManager";
|
||||
import {
|
||||
formatDateToYYYYMMDDTHHMMSS,
|
||||
getCalendarRange,
|
||||
} from "@/utils/dateUtils";
|
||||
import { push } from "redux-first-history";
|
||||
import EventPreviewModal from "../../features/Events/EventDisplayPreview";
|
||||
import AddIcon from "@mui/icons-material/Add";
|
||||
import { TempCalendarsInput } from "./TempCalendarsInput";
|
||||
import { Button, Box, radius } from "@linagora/twake-mui";
|
||||
import {
|
||||
updateSlotLabelVisibility,
|
||||
eventToFullCalendarFormat,
|
||||
extractEvents,
|
||||
} from "./utils/calendarUtils";
|
||||
import { useCalendarEventHandlers } from "./hooks/useCalendarEventHandlers";
|
||||
import { useCalendarViewHandlers } from "./hooks/useCalendarViewHandlers";
|
||||
import { EditModeDialog } from "../Event/EditModeDialog";
|
||||
import { EventErrorHandler } from "../Error/EventErrorHandler";
|
||||
import { EventErrorSnackbar } from "../Error/ErrorSnackbar";
|
||||
import momentTimezonePlugin from "@fullcalendar/moment-timezone";
|
||||
import { TimezoneSelector } from "./TimezoneSelector";
|
||||
import { MiniCalendar } from "./MiniCalendar";
|
||||
import { User } from "../Attendees/PeopleSearch";
|
||||
import { useTheme } from "@linagora/twake-mui";
|
||||
import { updateDarkColor } from "./utils/calendarColorsUtils";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import { setSelectedCalendars as setSelectedCalendarsToStorage } from "@/utils/storage/setSelectedCalendars";
|
||||
import { browserDefaultTimeZone } from "@/utils/timezone";
|
||||
import { CalendarApi, DateSelectArg } from "@fullcalendar/core";
|
||||
import frLocale from "@fullcalendar/core/locales/fr";
|
||||
import ruLocale from "@fullcalendar/core/locales/ru";
|
||||
import viLocale from "@fullcalendar/core/locales/vi";
|
||||
import SearchResultsPage from "../../features/Search/SearchResultsPage";
|
||||
import { setTimeZone } from "../../features/Settings/SettingsSlice";
|
||||
import { browserDefaultTimeZone } from "@/utils/timezone";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import { setSelectedCalendars as setSelectedCalendarsToStorage } from "@/utils/storage/setSelectedCalendars";
|
||||
import { setDisplayedDateAndRange } from "@/utils/CalendarRangeManager";
|
||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
||||
import interactionPlugin from "@fullcalendar/interaction";
|
||||
import momentTimezonePlugin from "@fullcalendar/moment-timezone";
|
||||
import FullCalendar from "@fullcalendar/react";
|
||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||
import { Box, Button, radius, useTheme } from "@linagora/twake-mui";
|
||||
import AddIcon from "@mui/icons-material/Add";
|
||||
import { MutableRefObject, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { push } from "redux-first-history";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { User } from "../Attendees/PeopleSearch";
|
||||
import { EventErrorSnackbar } from "../Error/ErrorSnackbar";
|
||||
import { EventErrorHandler } from "../Error/EventErrorHandler";
|
||||
import { EditModeDialog } from "../Event/EditModeDialog";
|
||||
import "./Calendar.styl";
|
||||
import CalendarSelection from "./CalendarSelection";
|
||||
import "./CustomCalendar.styl";
|
||||
import { useCalendarEventHandlers } from "./hooks/useCalendarEventHandlers";
|
||||
import { useCalendarViewHandlers } from "./hooks/useCalendarViewHandlers";
|
||||
import { MiniCalendar } from "./MiniCalendar";
|
||||
import { TempCalendarsInput } from "./TempCalendarsInput";
|
||||
import { TimezoneSelector } from "./TimezoneSelector";
|
||||
import { updateDarkColor } from "./utils/calendarColorsUtils";
|
||||
import {
|
||||
eventToFullCalendarFormat,
|
||||
extractEvents,
|
||||
updateSlotLabelVisibility,
|
||||
} from "./utils/calendarUtils";
|
||||
|
||||
const localeMap: Record<string, any> = {
|
||||
fr: frLocale,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { MenuItem } from "@linagora/twake-mui";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import React from "react";
|
||||
import { CalendarName } from "./CalendarName";
|
||||
|
||||
export function CalendarItemList(
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import SettingsPage from "@/features/Settings/SettingsPage";
|
||||
import { getCalendarRange } from "@/utils/dateUtils";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { ErrorSnackbar } from "../Error/ErrorSnackbar";
|
||||
import { refreshCalendars } from "../Event/utils/eventUtils";
|
||||
import { Menubar, MenubarProps } from "../Menubar/Menubar";
|
||||
import CalendarApp from "./Calendar";
|
||||
import { useAppDispatch } from "../../app/hooks";
|
||||
import { getCalendarRange } from "../../utils/dateUtils";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import { refreshCalendars } from "../Event/utils/eventUtils";
|
||||
import { ErrorSnackbar } from "../Error/ErrorSnackbar";
|
||||
|
||||
import SettingsPage from "../../features/Settings/SettingsPage";
|
||||
|
||||
export default function CalendarLayout() {
|
||||
const calendarRef = useRef<any>(null);
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { Button, Tab, Tabs } from "@linagora/twake-mui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
createCalendarAsync,
|
||||
importEventFromFileAsync,
|
||||
patchACLCalendarAsync,
|
||||
patchCalendarAsync,
|
||||
} from "../../features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
} from "@/features/Calendars/services";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import { Button, Tab, Tabs } from "@linagora/twake-mui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { ResponsiveDialog } from "../Dialog";
|
||||
import { AccessTab } from "./AccessTab";
|
||||
import { ImportTab } from "./ImportTab";
|
||||
import { SettingsTab } from "./SettingsTab";
|
||||
import { defaultColors } from "./utils/calendarColorsUtils";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { extractEventBaseUuid } from "../../utils/extractEventBaseUuid";
|
||||
|
||||
function CalendarPopover({
|
||||
open,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { Box, Typography } from "@linagora/twake-mui";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import SquareRoundedIcon from "@mui/icons-material/SquareRounded";
|
||||
export function CalendarName({ calendar }: { calendar: Calendar }) {
|
||||
return (
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { getCalendars } from "@/features/Calendars/CalendarApi";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { addSharedCalendarAsync } from "@/features/Calendars/services";
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
IconButton,
|
||||
Typography,
|
||||
TextField,
|
||||
Typography,
|
||||
useTheme,
|
||||
} from "@linagora/twake-mui";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { stringAvatar } from "../Event/utils/eventUtils";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import { useState } from "react";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import { getCalendars } from "../../features/Calendars/CalendarApi";
|
||||
import { addSharedCalendarAsync } from "../../features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { PeopleSearch, User } from "../Attendees/PeopleSearch";
|
||||
import { ResponsiveDialog } from "../Dialog";
|
||||
import { stringAvatar } from "../Event/utils/eventUtils";
|
||||
import { ColorPicker } from "./CalendarColorPicker";
|
||||
import { defaultColors, getAccessiblePair } from "./utils/calendarColorsUtils";
|
||||
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { removeCalendarAsync } from "@/features/Calendars/services";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import { trimLongTextWithoutSpace } from "@/utils/textUtils";
|
||||
import {
|
||||
Accordion,
|
||||
AccordionDetails,
|
||||
AccordionSummary,
|
||||
Typography,
|
||||
IconButton,
|
||||
Checkbox,
|
||||
Divider,
|
||||
IconButton,
|
||||
ListItem,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import AddIcon from "@mui/icons-material/Add";
|
||||
import { useState, useMemo, useEffect } from "react";
|
||||
import CalendarPopover from "./CalendarModal";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
||||
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
||||
import CalendarSearch from "./CalendarSearch";
|
||||
import { removeCalendarAsync } from "../../features/Calendars/CalendarSlice";
|
||||
import { DeleteCalendarDialog } from "./DeleteCalendarDialog";
|
||||
import { trimLongTextWithoutSpace } from "../../utils/textUtils";
|
||||
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { extractEventBaseUuid } from "../../utils/extractEventBaseUuid";
|
||||
import CalendarPopover from "./CalendarModal";
|
||||
import CalendarSearch from "./CalendarSearch";
|
||||
import { DeleteCalendarDialog } from "./DeleteCalendarDialog";
|
||||
|
||||
function CalendarAccordion({
|
||||
title,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogTitle,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogActions,
|
||||
Button,
|
||||
DialogTitle,
|
||||
} from "@linagora/twake-mui";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import { useI18n } from "twake-i18n";
|
||||
|
||||
export function DeleteCalendarDialog({
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { useAppSelector } from "@/app/hooks";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -6,16 +8,12 @@ import {
|
||||
MenuItem,
|
||||
Select,
|
||||
TextField,
|
||||
ToggleButton,
|
||||
ToggleButtonGroup,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { CalendarItemList } from "./CalendarItemList";
|
||||
import { SettingsTab } from "./SettingsTab";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { extractEventBaseUuid } from "../../utils/extractEventBaseUuid";
|
||||
|
||||
export function ImportTab({
|
||||
userId,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
|
||||
import { DateCalendar } from "@mui/x-date-pickers";
|
||||
import moment from "moment";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { getCalendarDetailAsync } from "@/features/Calendars/services";
|
||||
import { setView } from "@/features/Settings/SettingsSlice";
|
||||
import {
|
||||
computeStartOfTheWeek,
|
||||
formatDateToYYYYMMDDTHHMMSS,
|
||||
getCalendarRange,
|
||||
} from "../../utils/dateUtils";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import { getCalendarDetailAsync } from "../../features/Calendars/services/getCalendarDetailAsync";
|
||||
} from "@/utils/dateUtils";
|
||||
import { DateCalendar } from "@mui/x-date-pickers";
|
||||
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import moment from "moment";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { setView } from "../../features/Settings/SettingsSlice";
|
||||
|
||||
export function MiniCalendar({
|
||||
calendarRef,
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
import FormatListBulletedIcon from "@mui/icons-material/FormatListBulleted";
|
||||
import LockOutlineIcon from "@mui/icons-material/LockOutline";
|
||||
import PublicIcon from "@mui/icons-material/Public";
|
||||
import { useAppSelector } from "@/app/hooks";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
TextField,
|
||||
ToggleButton,
|
||||
ToggleButtonGroup,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import LockOutlineIcon from "@mui/icons-material/LockOutline";
|
||||
import PublicIcon from "@mui/icons-material/Public";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import { AddDescButton } from "../Event/AddDescButton";
|
||||
import { ColorPicker } from "./CalendarColorPicker";
|
||||
import { extractEventBaseUuid } from "../../utils/extractEventBaseUuid";
|
||||
|
||||
export function SettingsTab({
|
||||
name,
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import { useTheme } from "@linagora/twake-mui";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { removeTempCal } from "@/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { getTempCalendarsListAsync } from "@/features/Calendars/services";
|
||||
import { setView } from "@/features/Settings/SettingsSlice";
|
||||
import { TextField, useTheme } from "@linagora/twake-mui";
|
||||
import { useRef } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import {
|
||||
getTempCalendarsListAsync,
|
||||
removeTempCal,
|
||||
} from "../../features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import { setView } from "../../features/Settings/SettingsSlice";
|
||||
import { TextField } from "@linagora/twake-mui";
|
||||
import { User, PeopleSearch } from "../Attendees/PeopleSearch";
|
||||
import { PeopleSearch, User } from "../Attendees/PeopleSearch";
|
||||
import { getAccessiblePair } from "./utils/calendarColorsUtils";
|
||||
|
||||
const requestControllers = new Map<string, AbortController>();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { browserDefaultTimeZone } from "@/utils/timezone";
|
||||
import { TIMEZONES } from "@/utils/timezone-data";
|
||||
import { Button, Popover } from "@linagora/twake-mui";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import moment from "moment";
|
||||
import { MouseEvent, useMemo, useState } from "react";
|
||||
import { browserDefaultTimeZone } from "../../utils/timezone";
|
||||
import { TIMEZONES } from "../../utils/timezone-data";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { TimezoneAutocomplete } from "../Timezone/TimezoneAutocomplete";
|
||||
|
||||
interface TimezoneSelectProps {
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
import { DateSelectArg } from "@fullcalendar/core";
|
||||
import { CalendarApi } from "@fullcalendar/core";
|
||||
import { CalendarEvent } from "../../../features/Events/EventsTypes";
|
||||
import { Calendar } from "../../../features/Calendars/CalendarTypes";
|
||||
import { getDeltaInMilliseconds } from "../../../utils/dateUtils";
|
||||
import { User } from "@/components/Attendees/PeopleSearch";
|
||||
import { formatLocalDateTime } from "@/components/Event/utils/dateTimeFormatters";
|
||||
import { refreshCalendars } from "@/components/Event/utils/eventUtils";
|
||||
import { updateEventLocal } from "@/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
getCalendarDetailAsync,
|
||||
getEventAsync,
|
||||
putEventAsync,
|
||||
updateEventInstanceAsync,
|
||||
updateEventLocal,
|
||||
updateSeriesAsync,
|
||||
} from "../../../features/Calendars/CalendarSlice";
|
||||
import { getCalendarDetailAsync } from "../../../features/Calendars/services/getCalendarDetailAsync";
|
||||
import { formatDateToYYYYMMDDTHHMMSS } from "../../../utils/dateUtils";
|
||||
import { getEvent } from "../../../features/Events/EventApi";
|
||||
import { refreshCalendars } from "../../Event/utils/eventUtils";
|
||||
} from "@/features/Calendars/services";
|
||||
import { getEvent } from "@/features/Events/EventApi";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
import { createAttendee } from "@/features/User/models/attendee.mapper";
|
||||
import {
|
||||
formatDateToYYYYMMDDTHHMMSS,
|
||||
getDeltaInMilliseconds,
|
||||
} from "@/utils/dateUtils";
|
||||
import { CalendarApi, DateSelectArg } from "@fullcalendar/core";
|
||||
import { updateTempCalendar } from "../utils/calendarUtils";
|
||||
import { User } from "../../Attendees/PeopleSearch";
|
||||
import { formatLocalDateTime } from "../../Event/utils/dateTimeFormatters";
|
||||
import { userAttendee } from "../../../features/User/models/attendee";
|
||||
import { createAttendee } from "../../../features/User/models/attendee.mapper";
|
||||
|
||||
export interface EventHandlersProps {
|
||||
setSelectedRange: (range: DateSelectArg | null) => void;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from "react";
|
||||
import { EventErrorHandler } from "@/components/Error/EventErrorHandler";
|
||||
import { EventChip } from "@/components/Event/EventChip/EventChip";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
import { CalendarApi, NowIndicatorContentArg } from "@fullcalendar/core";
|
||||
import React from "react";
|
||||
import { createMouseHandlers } from "./mouseHandlers";
|
||||
import { userAttendee } from "../../../features/User/models/attendee";
|
||||
import { Calendar } from "../../../features/Calendars/CalendarTypes";
|
||||
import { EventErrorHandler } from "../../Error/EventErrorHandler";
|
||||
import { EventChip } from "../../Event/EventChip/EventChip";
|
||||
|
||||
export interface ViewHandlersProps {
|
||||
calendarRef: React.RefObject<CalendarApi | null>;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { AppDispatch } from "@/app/store";
|
||||
import { updateCalColor } from "@/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { darken, getContrastRatio, lighten, Theme } from "@linagora/twake-mui";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import { updateCalColor } from "../../../features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "../../../features/Calendars/CalendarTypes";
|
||||
|
||||
export function updateDarkColor(
|
||||
calendars: Record<string, Calendar>,
|
||||
theme: Theme,
|
||||
dispatch: ThunkDispatch<any, any, any>
|
||||
dispatch: AppDispatch
|
||||
) {
|
||||
Object.values(calendars).forEach((cal) => {
|
||||
if (!cal?.color?.light || typeof cal.color.light !== "string") return;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { CalendarEvent } from "../../../features/Events/EventsTypes";
|
||||
import { Calendar } from "../../../features/Calendars/CalendarTypes";
|
||||
import { formatDateToYYYYMMDDTHHMMSS } from "../../../utils/dateUtils";
|
||||
import { getCalendarDetailAsync } from "../../../features/Calendars/services/getCalendarDetailAsync";
|
||||
import { detectDateTimeFormat } from "@/components/Event/utils/dateTimeHelpers";
|
||||
import { refreshSingularCalendar } from "@/components/Event/utils/eventUtils";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { getCalendarDetailAsync } from "@/features/Calendars/services";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import { formatDateToYYYYMMDDTHHMMSS } from "@/utils/dateUtils";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import { SlotLabelContentArg } from "@fullcalendar/core";
|
||||
import moment from "moment-timezone";
|
||||
import { refreshSingularCalendar } from "../../Event/utils/eventUtils";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import moment from "moment-timezone";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { detectDateTimeFormat } from "../../Event/utils/dateTimeHelpers";
|
||||
import { extractEventBaseUuid } from "../../../utils/extractEventBaseUuid";
|
||||
|
||||
function convertEventDateTimeToISO(
|
||||
datetime: string,
|
||||
|
||||
@@ -18,7 +18,7 @@ A highly reusable dialog component that supports both normal and expanded (fulls
|
||||
## Basic Usage
|
||||
|
||||
```tsx
|
||||
import { ResponsiveDialog } from "../../components/Dialog";
|
||||
import { ResponsiveDialog } from "@/components/Dialog";
|
||||
import { useState } from "react";
|
||||
|
||||
function MyComponent() {
|
||||
@@ -199,7 +199,7 @@ All `sx` props are **merged** with base styles, not overridden:
|
||||
Full type inference and validation:
|
||||
|
||||
```tsx
|
||||
import { ResponsiveDialog } from "../../components/Dialog";
|
||||
import { ResponsiveDialog } from "@/components/Dialog";
|
||||
|
||||
// All props are type-checked
|
||||
<ResponsiveDialog
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {
|
||||
Box,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentProps,
|
||||
DialogProps,
|
||||
DialogTitle,
|
||||
DialogTitleProps,
|
||||
DialogProps,
|
||||
IconButton,
|
||||
Stack,
|
||||
SxProps,
|
||||
Theme,
|
||||
Box,
|
||||
} from "@linagora/twake-mui";
|
||||
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
|
||||
import ReplayIcon from "@mui/icons-material/Replay";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -8,9 +7,10 @@ import {
|
||||
Stack,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
|
||||
import ReplayIcon from "@mui/icons-material/Replay";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { push } from "redux-first-history";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import { useI18n } from "twake-i18n";
|
||||
|
||||
export function Error() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Snackbar, Alert, Button } from "@linagora/twake-mui";
|
||||
import { useAppDispatch } from "../../app/hooks";
|
||||
import { clearError as calendarClearError } from "../../features/Calendars/CalendarSlice";
|
||||
import { clearError as userClearError } from "../../features/User/userSlice";
|
||||
import { useAppDispatch } from "@/app/hooks";
|
||||
import { clearError as calendarClearError } from "@/features/Calendars/CalendarSlice";
|
||||
import { clearError as userClearError } from "@/features/User/userSlice";
|
||||
import { Alert, Button, Snackbar } from "@linagora/twake-mui";
|
||||
import { useI18n } from "twake-i18n";
|
||||
|
||||
export function ErrorSnackbar({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Box, Button, TextField } from "@linagora/twake-mui";
|
||||
import { Description as DescriptionIcon } from "@mui/icons-material";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { FieldWithLabel } from "./components/FieldWithLabel";
|
||||
import { Description as DescriptionIcon } from "@mui/icons-material";
|
||||
|
||||
export function AddDescButton({
|
||||
showDescription,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import {
|
||||
Button,
|
||||
ButtonGroup,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
Radio,
|
||||
RadioGroup,
|
||||
} from "@linagora/twake-mui";
|
||||
import { CalendarEvent } from "../../features/Events/EventsTypes";
|
||||
import { useState } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EventErrorHandler } from "@/components/Error/EventErrorHandler";
|
||||
import { Card, Typography } from "@linagora/twake-mui";
|
||||
import { useRef, useEffect } from "react";
|
||||
import { EventErrorHandler } from "../../Error/EventErrorHandler";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
export function ErrorEventChip({
|
||||
event,
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
CardHeader,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { useRef } from "react";
|
||||
import { stringAvatar } from "../utils/eventUtils";
|
||||
import { ErrorEventChip } from "./ErrorEventChip";
|
||||
import {
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
IconDisplayConfig,
|
||||
useCompactMode,
|
||||
} from "./EventChipUtils";
|
||||
import { SimpleEventChip } from "./SimpleEventChip";
|
||||
|
||||
const PRIVATE_CLASSIFICATIONS = ["PRIVATE", "CONFIDENTIAL"];
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { EventErrorHandler } from "@/components/Error/EventErrorHandler";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
import { getContrastRatio } from "@linagora/twake-mui";
|
||||
import CancelIcon from "@mui/icons-material/Cancel";
|
||||
import HelpOutlineIcon from "@mui/icons-material/HelpOutline";
|
||||
import LockOutlineIcon from "@mui/icons-material/LockOutline";
|
||||
import { Box, getContrastRatio } from "@linagora/twake-mui";
|
||||
import moment from "moment";
|
||||
import React, { useLayoutEffect, useState } from "react";
|
||||
import { Calendar } from "../../../features/Calendars/CalendarTypes";
|
||||
import { userAttendee } from "../../../features/User/models/attendee";
|
||||
import { EventErrorHandler } from "../../Error/EventErrorHandler";
|
||||
import { EVENT_DURATION } from "./EventChip";
|
||||
|
||||
const COMPACT_WIDTH_THRESHOLD = 100;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import { Card, Typography } from "@linagora/twake-mui";
|
||||
|
||||
export function SimpleEventChip({ title }: { title: string }) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import { MenuItem } from "@linagora/twake-mui";
|
||||
import { CalendarEvent } from "../../features/Events/EventsTypes";
|
||||
import { useI18n } from "twake-i18n";
|
||||
|
||||
export default function EventDuplication({
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import React from "react";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import { RepetitionObject } from "@/features/Events/EventsTypes";
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
import iconCamera from "@/static/images/icon-camera.svg";
|
||||
import {
|
||||
addVideoConferenceToDescription,
|
||||
generateMeetingLink,
|
||||
} from "@/utils/videoConferenceUtils";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -6,45 +13,33 @@ import {
|
||||
FormControl,
|
||||
FormControlLabel,
|
||||
IconButton,
|
||||
InputLabel,
|
||||
MenuItem,
|
||||
Select,
|
||||
SelectChangeEvent,
|
||||
TextField,
|
||||
ToggleButtonGroup,
|
||||
ToggleButton,
|
||||
ToggleButtonGroup,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import {
|
||||
Description as DescriptionIcon,
|
||||
Public as PublicIcon,
|
||||
VideocamOutlined as VideocamOutlinedIcon,
|
||||
ContentCopy as CopyIcon,
|
||||
Close as DeleteIcon,
|
||||
ContentCopy as CopyIcon,
|
||||
Public as PublicIcon,
|
||||
} from "@mui/icons-material";
|
||||
import iconCamera from "../../static/images/icon-camera.svg";
|
||||
import LockOutlineIcon from "@mui/icons-material/LockOutline";
|
||||
import AttendeeSelector from "../Attendees/AttendeeSearch";
|
||||
import RepeatEvent from "./EventRepeat";
|
||||
import { RepetitionObject } from "../../features/Events/EventsTypes";
|
||||
import { userAttendee } from "../../features/User/models/attendee";
|
||||
import { Calendar } from "../../features/Calendars/CalendarTypes";
|
||||
import {
|
||||
generateMeetingLink,
|
||||
addVideoConferenceToDescription,
|
||||
} from "../../utils/videoConferenceUtils";
|
||||
import { TimezoneAutocomplete } from "../Timezone/TimezoneAutocomplete";
|
||||
import { CalendarItemList } from "../Calendar/CalendarItemList";
|
||||
import React from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { FieldWithLabel } from "./components/FieldWithLabel";
|
||||
import { DateTimeFields } from "./components/DateTimeFields";
|
||||
import { useAllDayToggle } from "./hooks/useAllDayToggle";
|
||||
import { splitDateTime, combineDateTime } from "./utils/dateTimeHelpers";
|
||||
import {} from "./utils/dateRules";
|
||||
import {} from "./utils/dateTimeFormatters";
|
||||
import { validateEventForm } from "./utils/formValidation";
|
||||
import AttendeeSelector from "../Attendees/AttendeeSearch";
|
||||
import { CalendarItemList } from "../Calendar/CalendarItemList";
|
||||
import { SnackbarAlert } from "../Loading/SnackBarAlert";
|
||||
import { TimezoneAutocomplete } from "../Timezone/TimezoneAutocomplete";
|
||||
import { AddDescButton } from "./AddDescButton";
|
||||
import { DateTimeFields } from "./components/DateTimeFields";
|
||||
import { FieldWithLabel } from "./components/FieldWithLabel";
|
||||
import RepeatEvent from "./EventRepeat";
|
||||
import { useAllDayToggle } from "./hooks/useAllDayToggle";
|
||||
import { combineDateTime, splitDateTime } from "./utils/dateTimeHelpers";
|
||||
import { validateEventForm } from "./utils/formValidation";
|
||||
|
||||
interface EventFormFieldsProps {
|
||||
// Form state
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { RepetitionObject } from "@/features/Events/EventsTypes";
|
||||
import {
|
||||
FormControl,
|
||||
Select,
|
||||
SelectChangeEvent,
|
||||
MenuItem,
|
||||
Box,
|
||||
Stack,
|
||||
Typography,
|
||||
TextField,
|
||||
Checkbox,
|
||||
FormControl,
|
||||
FormControlLabel,
|
||||
FormGroup,
|
||||
MenuItem,
|
||||
Radio,
|
||||
RadioGroup,
|
||||
Select,
|
||||
SelectChangeEvent,
|
||||
Stack,
|
||||
TextField,
|
||||
Typography,
|
||||
} from "@linagora/twake-mui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { RepetitionObject } from "../../features/Events/EventsTypes";
|
||||
import { useI18n } from "twake-i18n";
|
||||
|
||||
export default function RepeatEvent({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Box, Link, Typography } from "@linagora/twake-mui";
|
||||
import React from "react";
|
||||
import { Box, Typography, Link } from "@linagora/twake-mui";
|
||||
|
||||
type InfoRowProps = {
|
||||
icon: React.ReactNode;
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
import React, { useMemo } from "react";
|
||||
import { Box, Typography } from "@linagora/twake-mui";
|
||||
import { TextFieldProps } from "@linagora/twake-mui";
|
||||
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
||||
import { DatePickerFieldProps } from "@mui/x-date-pickers/DatePicker";
|
||||
import { TimePicker } from "@mui/x-date-pickers/TimePicker";
|
||||
import { TimePickerFieldProps } from "@mui/x-date-pickers/TimePicker";
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import { Box, TextFieldProps, Typography } from "@linagora/twake-mui";
|
||||
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||
import {
|
||||
DatePicker,
|
||||
DatePickerFieldProps,
|
||||
} from "@mui/x-date-pickers/DatePicker";
|
||||
import { PickerValue } from "@mui/x-date-pickers/internals";
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import {
|
||||
TimePicker,
|
||||
TimePickerFieldProps,
|
||||
} from "@mui/x-date-pickers/TimePicker";
|
||||
import dayjs, { Dayjs } from "dayjs";
|
||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { LONG_DATE_FORMAT } from "../utils/dateTimeFormatters";
|
||||
import "dayjs/locale/fr";
|
||||
import "dayjs/locale/en";
|
||||
import "dayjs/locale/fr";
|
||||
import "dayjs/locale/ru";
|
||||
import "dayjs/locale/vi";
|
||||
|
||||
import { PickerValue } from "@mui/x-date-pickers/internals";
|
||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||
import React, { useMemo } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { LONG_DATE_FORMAT } from "../utils/dateTimeFormatters";
|
||||
import { dtDate, dtTime, toDateTime } from "../utils/dateTimeHelpers";
|
||||
import { ReadOnlyDateField } from "./ReadOnlyPickerField";
|
||||
import { EditableTimeField } from "./EditableTimeField";
|
||||
import { ReadOnlyDateField } from "./ReadOnlyPickerField";
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import React, { useState, useRef, useEffect, useCallback } from "react";
|
||||
import { TextField } from "@linagora/twake-mui";
|
||||
import {
|
||||
useParsedFormat,
|
||||
usePickerActionsContext,
|
||||
usePickerContext,
|
||||
useSplitFieldProps,
|
||||
} from "@mui/x-date-pickers/hooks";
|
||||
import { PickerFieldProps } from "@mui/x-date-pickers/models";
|
||||
import { TimePickerFieldProps } from "@mui/x-date-pickers/TimePicker";
|
||||
import {
|
||||
PickerFieldAdapter,
|
||||
PickerValidationScope,
|
||||
useValidation,
|
||||
validateTime,
|
||||
} from "@mui/x-date-pickers/validation";
|
||||
import {
|
||||
useSplitFieldProps,
|
||||
useParsedFormat,
|
||||
usePickerContext,
|
||||
usePickerActionsContext,
|
||||
} from "@mui/x-date-pickers/hooks";
|
||||
import { PickerFieldProps } from "@mui/x-date-pickers/models";
|
||||
import { TimePickerFieldProps } from "@mui/x-date-pickers/TimePicker";
|
||||
import dayjs, { Dayjs } from "dayjs";
|
||||
import { Dayjs } from "dayjs";
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { parseTimeInput } from "../utils/dateTimeHelpers";
|
||||
|
||||
type FieldType = "date" | "time" | "date-time";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Box, SxProps, Theme, Typography } from "@linagora/twake-mui";
|
||||
import React from "react";
|
||||
import { Box, Typography, SxProps, Theme } from "@linagora/twake-mui";
|
||||
|
||||
/**
|
||||
* Helper component for field with label
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import React from "react";
|
||||
import { TextField } from "@linagora/twake-mui";
|
||||
import { DatePickerFieldProps } from "@mui/x-date-pickers/DatePicker";
|
||||
import {
|
||||
useParsedFormat,
|
||||
usePickerContext,
|
||||
useSplitFieldProps,
|
||||
} from "@mui/x-date-pickers/hooks";
|
||||
import { PickerFieldProps } from "@mui/x-date-pickers/models";
|
||||
import {
|
||||
PickerFieldAdapter,
|
||||
PickerValidationScope,
|
||||
useValidation,
|
||||
validateDate,
|
||||
} from "@mui/x-date-pickers/validation";
|
||||
import {
|
||||
useSplitFieldProps,
|
||||
useParsedFormat,
|
||||
usePickerContext,
|
||||
} from "@mui/x-date-pickers/hooks";
|
||||
import { PickerFieldProps } from "@mui/x-date-pickers/models";
|
||||
import { DatePickerFieldProps } from "@mui/x-date-pickers/DatePicker";
|
||||
|
||||
type FieldType = "date" | "time" | "date-time";
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import { AppDispatch } from "@/app/store";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
updateEventInstanceAsync,
|
||||
putEventAsync,
|
||||
deleteEventInstanceAsync,
|
||||
deleteEventAsync,
|
||||
} from "../../../features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "../../../features/Calendars/CalendarTypes";
|
||||
import { updateSeriesPartstat } from "../../../features/Events/EventApi";
|
||||
import { CalendarEvent } from "../../../features/Events/EventsTypes";
|
||||
import { PartStat } from "../../../features/User/models/attendee";
|
||||
import { createAttendee } from "../../../features/User/models/attendee.mapper";
|
||||
import { userData } from "../../../features/User/userDataTypes";
|
||||
import { buildFamilyName } from "../../../utils/buildFamilyName";
|
||||
import { getCalendarRange } from "../../../utils/dateUtils";
|
||||
deleteEventInstanceAsync,
|
||||
putEventAsync,
|
||||
updateEventInstanceAsync,
|
||||
} from "@/features/Calendars/services";
|
||||
import { updateSeriesPartstat } from "@/features/Events/EventApi";
|
||||
import { CalendarEvent } from "@/features/Events/EventsTypes";
|
||||
import { PartStat } from "@/features/User/models/attendee";
|
||||
import { createAttendee } from "@/features/User/models/attendee.mapper";
|
||||
import { userData } from "@/features/User/userDataTypes";
|
||||
import { buildFamilyName } from "@/utils/buildFamilyName";
|
||||
import { getCalendarRange } from "@/utils/dateUtils";
|
||||
import { refreshCalendars } from "../utils/eventUtils";
|
||||
|
||||
function updateEventAttendees(
|
||||
@@ -70,7 +70,7 @@ function updateEventAttendees(
|
||||
}
|
||||
|
||||
async function handleSoloRSVP(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
dispatch: AppDispatch,
|
||||
calendar: Calendar,
|
||||
event: CalendarEvent
|
||||
) {
|
||||
@@ -78,7 +78,7 @@ async function handleSoloRSVP(
|
||||
}
|
||||
|
||||
async function handleAllRSVP(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
dispatch: AppDispatch,
|
||||
event: CalendarEvent,
|
||||
userEmail: string,
|
||||
rsvp: PartStat,
|
||||
@@ -90,7 +90,7 @@ async function handleAllRSVP(
|
||||
}
|
||||
|
||||
async function handleDefaultRSVP(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
dispatch: AppDispatch,
|
||||
calendar: Calendar,
|
||||
newEvent: CalendarEvent
|
||||
) {
|
||||
@@ -98,7 +98,7 @@ async function handleDefaultRSVP(
|
||||
}
|
||||
|
||||
export async function handleRSVP(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
dispatch: AppDispatch,
|
||||
calendar: Calendar,
|
||||
user: userData | undefined,
|
||||
event: CalendarEvent,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from "react";
|
||||
import { combineDateTime } from "../utils/dateTimeHelpers";
|
||||
import { getRoundedCurrentTime } from "../utils/dateTimeFormatters";
|
||||
|
||||
/**
|
||||
* Parameters for all-day toggle hook
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import moment from "moment-timezone";
|
||||
import dayjs, { Dayjs } from "dayjs";
|
||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||
import moment from "moment-timezone";
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { AppDispatch } from "@/app/store";
|
||||
import { emptyEventsCal } from "@/features/Calendars/CalendarSlice";
|
||||
import { Calendar } from "@/features/Calendars/CalendarTypes";
|
||||
import {
|
||||
getCalendarDetailAsync,
|
||||
getCalendarsListAsync,
|
||||
refreshCalendarWithSyncToken,
|
||||
} from "@/features/Calendars/services";
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
import { getInitials, stringToGradient } from "@/utils/avatarUtils";
|
||||
import { formatDateToYYYYMMDDTHHMMSS } from "@/utils/dateUtils";
|
||||
import { Avatar, Badge, Box, Typography } from "@linagora/twake-mui";
|
||||
import CancelIcon from "@mui/icons-material/Cancel";
|
||||
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
||||
import { Avatar, Badge, Box, Typography } from "@linagora/twake-mui";
|
||||
import { stringToGradient, getInitials } from "../../../utils/avatarUtils";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import { emptyEventsCal } from "../../../features/Calendars/CalendarSlice";
|
||||
import { getCalendarsListAsync } from "../../../features/Calendars/services/getCalendarsListAsync";
|
||||
import { getCalendarDetailAsync } from "../../../features/Calendars/services/getCalendarDetailAsync";
|
||||
import { Calendar } from "../../../features/Calendars/CalendarTypes";
|
||||
import { userAttendee } from "../../../features/User/models/attendee";
|
||||
import { refreshCalendarWithSyncToken } from "../../../features/Calendars/services/refreshCalendar";
|
||||
import { formatDateToYYYYMMDDTHHMMSS } from "../../../utils/dateUtils";
|
||||
import { AppDispatch } from "../../../app/store";
|
||||
|
||||
export function renderAttendeeBadge(
|
||||
a: userAttendee,
|
||||
@@ -139,7 +140,7 @@ export async function refreshCalendars(
|
||||
}
|
||||
|
||||
export async function refreshSingularCalendar(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
dispatch: AppDispatch,
|
||||
calendar: Calendar,
|
||||
calendarRange: { start: Date; end: Date },
|
||||
calType?: "temp"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Alert, Snackbar } from "@linagora/twake-mui";
|
||||
import type { AlertColor } from "@linagora/twake-mui";
|
||||
import { Alert, Snackbar } from "@linagora/twake-mui";
|
||||
|
||||
export function SnackbarAlert({
|
||||
open,
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { searchEventsAsync } from "@/features/Search/SearchSlice";
|
||||
import { setView } from "@/features/Settings/SettingsSlice";
|
||||
import { userAttendee } from "@/features/User/models/attendee";
|
||||
import { createAttendee } from "@/features/User/models/attendee.mapper";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -14,22 +20,16 @@ import {
|
||||
Stack,
|
||||
TextField,
|
||||
Typography,
|
||||
type AutocompleteRenderInputParams,
|
||||
} from "@linagora/twake-mui";
|
||||
import { type AutocompleteRenderInputParams } from "@linagora/twake-mui";
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
import HighlightOffIcon from "@mui/icons-material/HighlightOff";
|
||||
import SearchIcon from "@mui/icons-material/Search";
|
||||
import TuneIcon from "@mui/icons-material/Tune";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import { searchEventsAsync } from "../../features/Search/SearchSlice";
|
||||
import { setView } from "../../features/Settings/SettingsSlice";
|
||||
import { userAttendee } from "../../features/User/models/attendee";
|
||||
import UserSearch from "../Attendees/AttendeeSearch";
|
||||
import { CalendarItemList } from "../Calendar/CalendarItemList";
|
||||
import { PeopleSearch, User } from "../Attendees/PeopleSearch";
|
||||
import { createAttendee } from "../../features/User/models/attendee.mapper";
|
||||
import { extractEventBaseUuid } from "../../utils/extractEventBaseUuid";
|
||||
import { CalendarItemList } from "../Calendar/CalendarItemList";
|
||||
|
||||
export default function SearchBar() {
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,33 +1,30 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import logo from "../../static/header-logo.svg";
|
||||
import AppsIcon from "@mui/icons-material/Apps";
|
||||
import RefreshIcon from "@mui/icons-material/Refresh";
|
||||
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
||||
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
||||
import SettingsIcon from "@mui/icons-material/Settings";
|
||||
import LogoutIcon from "@mui/icons-material/Logout";
|
||||
import "./Menubar.styl";
|
||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||
import { stringToGradient, getInitials } from "../../utils/avatarUtils";
|
||||
import { useAppDispatch, useAppSelector } from "@/app/hooks";
|
||||
import { setView } from "@/features/Settings/SettingsSlice";
|
||||
import { Logout } from "@/features/User/oidcAuth";
|
||||
import logo from "@/static/header-logo.svg";
|
||||
import { getInitials, stringToGradient } from "@/utils/avatarUtils";
|
||||
import { getUserDisplayName } from "@/utils/userUtils";
|
||||
import { CalendarApi } from "@fullcalendar/core";
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
ButtonGroup,
|
||||
Divider,
|
||||
FormControl,
|
||||
IconButton,
|
||||
Popover,
|
||||
Menu,
|
||||
MenuItem,
|
||||
ButtonGroup,
|
||||
Button,
|
||||
Popover,
|
||||
Select,
|
||||
FormControl,
|
||||
Typography,
|
||||
Box,
|
||||
Divider,
|
||||
} from "@linagora/twake-mui";
|
||||
import { push } from "redux-first-history";
|
||||
import { CalendarApi } from "@fullcalendar/core";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import { setView } from "../../features/Settings/SettingsSlice";
|
||||
import { getUserDisplayName } from "../../utils/userUtils";
|
||||
import AppsIcon from "@mui/icons-material/Apps";
|
||||
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
||||
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
||||
import LogoutIcon from "@mui/icons-material/Logout";
|
||||
import RefreshIcon from "@mui/icons-material/Refresh";
|
||||
import SettingsIcon from "@mui/icons-material/Settings";
|
||||
import { format } from "date-fns";
|
||||
import {
|
||||
enGB,
|
||||
@@ -35,8 +32,11 @@ import {
|
||||
ru as ruLocale,
|
||||
vi as viLocale,
|
||||
} from "date-fns/locale";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { push } from "redux-first-history";
|
||||
import { useI18n } from "twake-i18n";
|
||||
import SearchBar from "./EventSearchBar";
|
||||
import { Logout } from "../../features/User/oidcAuth";
|
||||
import "./Menubar.styl";
|
||||
const dateLocales = { en: enGB, fr: frLocale, ru: ruLocale, vi: viLocale };
|
||||
|
||||
export type AppIconProps = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { api } from "../../utils/apiUtils";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
|
||||
export async function getCalendars(
|
||||
userId: string,
|
||||
|
||||
@@ -1,40 +1,27 @@
|
||||
import { createAsyncThunk, createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { Calendar } from "./CalendarTypes";
|
||||
import { extractEventBaseUuid } from "@/utils/extractEventBaseUuid";
|
||||
import { browserDefaultTimeZone } from "@/utils/timezone";
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { CalendarEvent } from "../Events/EventsTypes";
|
||||
import { Calendar } from "./CalendarTypes";
|
||||
import {
|
||||
addSharedCalendar,
|
||||
getCalendar,
|
||||
getCalendars,
|
||||
postCalendar,
|
||||
proppatchCalendar,
|
||||
removeCalendar,
|
||||
updateAclCalendar,
|
||||
} from "./CalendarApi";
|
||||
import { getUserDetails } from "../User/userAPI";
|
||||
import { parseCalendarEvent } from "../Events/eventUtils";
|
||||
import {
|
||||
deleteEvent,
|
||||
deleteEventInstance,
|
||||
getEvent,
|
||||
importEventFromFile,
|
||||
moveEvent,
|
||||
putEvent,
|
||||
putEventWithOverrides,
|
||||
updateSeries,
|
||||
} from "../Events/EventApi";
|
||||
import {
|
||||
computeWeekRange,
|
||||
formatDateToYYYYMMDDTHHMMSS,
|
||||
} from "../../utils/dateUtils";
|
||||
import { User } from "../../components/Attendees/PeopleSearch";
|
||||
import { getCalendarVisibility } from "../../components/Calendar/utils/calendarUtils";
|
||||
import { importFile } from "../../utils/apiUtils";
|
||||
import { formatReduxError } from "../../utils/errorUtils";
|
||||
import { browserDefaultTimeZone } from "../../utils/timezone";
|
||||
import { getCalendarDetailAsync } from "./services/getCalendarDetailAsync";
|
||||
import { refreshCalendarWithSyncToken } from "./services/refreshCalendar";
|
||||
import { getCalendarsListAsync } from "./services/getCalendarsListAsync";
|
||||
import { extractEventBaseUuid } from "../../utils/extractEventBaseUuid";
|
||||
addSharedCalendarAsync,
|
||||
createCalendarAsync,
|
||||
deleteEventAsync,
|
||||
deleteEventInstanceAsync,
|
||||
getCalendarDetailAsync,
|
||||
getCalendarsListAsync,
|
||||
getEventAsync,
|
||||
getTempCalendarsListAsync,
|
||||
importEventFromFileAsync,
|
||||
moveEventAsync,
|
||||
patchACLCalendarAsync,
|
||||
patchCalendarAsync,
|
||||
putEventAsync,
|
||||
refreshCalendarWithSyncToken,
|
||||
removeCalendarAsync,
|
||||
updateEventInstanceAsync,
|
||||
updateSeriesAsync,
|
||||
} from "./services";
|
||||
|
||||
// Define error type for rejected actions
|
||||
export interface RejectedError {
|
||||
@@ -42,459 +29,6 @@ export interface RejectedError {
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export const getTempCalendarsListAsync = createAsyncThunk<
|
||||
Record<string, Calendar>,
|
||||
User,
|
||||
{ rejectValue: RejectedError }
|
||||
>("calendars/getTempCalendars", async (tempUser, { rejectWithValue }) => {
|
||||
try {
|
||||
const importedCalendars: Record<string, Calendar> = {};
|
||||
|
||||
const calendars = (await getCalendars(
|
||||
tempUser.openpaasId ?? "",
|
||||
"sharedPublic=true&"
|
||||
)) as Record<string, any>;
|
||||
|
||||
const rawCalendars = calendars._embedded?.["dav:calendar"];
|
||||
if (!rawCalendars || rawCalendars.length === 0) {
|
||||
const userName = tempUser.displayName || tempUser.email || "User";
|
||||
// Format: TRANSLATION:key|param1=value1
|
||||
const encodedName = encodeURIComponent(userName);
|
||||
throw new Error(
|
||||
`TRANSLATION:calendar.userDoesNotHavePublicCalendars|name=${encodedName}`
|
||||
);
|
||||
}
|
||||
|
||||
for (const cal of rawCalendars) {
|
||||
const name = cal["dav:name"];
|
||||
const description = cal["caldav:description"];
|
||||
const delegated = cal["calendarserver:delegatedsource"] ? true : false;
|
||||
const source = cal["calendarserver:source"]
|
||||
? cal["calendarserver:source"]._links.self.href
|
||||
: cal._links.self.href;
|
||||
const link = cal._links.self.href;
|
||||
|
||||
const id = source.replace("/calendars/", "").replace(".json", "");
|
||||
const visibility = getCalendarVisibility(cal["acl"]);
|
||||
const ownerData: any = await getUserDetails(id.split("/")[0]);
|
||||
|
||||
importedCalendars[id] = {
|
||||
id,
|
||||
name,
|
||||
link,
|
||||
owner: `${ownerData.firstname ? `${ownerData.firstname} ` : ""}${ownerData.lastname}`,
|
||||
ownerEmails: ownerData.emails,
|
||||
description,
|
||||
delegated,
|
||||
color: {
|
||||
light: tempUser.color?.light ?? "#a8a8a8ff",
|
||||
dark: tempUser.color?.dark ?? "#a8a8a8ff",
|
||||
},
|
||||
visibility,
|
||||
events: {},
|
||||
};
|
||||
}
|
||||
|
||||
return importedCalendars;
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const putEventAsync = createAsyncThunk<
|
||||
{ calId: string; events: CalendarEvent[]; calType?: "temp" },
|
||||
{ cal: Calendar; newEvent: CalendarEvent; calType?: "temp" },
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/putEvent",
|
||||
async ({ cal, newEvent, calType }, { rejectWithValue }) => {
|
||||
try {
|
||||
await putEvent(
|
||||
newEvent,
|
||||
cal.ownerEmails ? cal.ownerEmails[0] : undefined
|
||||
);
|
||||
const eventDate = new Date(newEvent.start);
|
||||
|
||||
const { start: weekStart, end: weekEnd } = computeWeekRange(eventDate);
|
||||
|
||||
const calEvents = (await getCalendar(cal.id, {
|
||||
start: formatDateToYYYYMMDDTHHMMSS(weekStart),
|
||||
end: formatDateToYYYYMMDDTHHMMSS(weekEnd),
|
||||
})) as Record<string, any>;
|
||||
const events: CalendarEvent[] = calEvents._embedded["dav:item"].flatMap(
|
||||
(eventdata: any) => {
|
||||
const vevents = eventdata.data[2] as any[][];
|
||||
const eventURL = eventdata._links.self.href;
|
||||
const valarm = eventdata.data[2][0][2][0];
|
||||
return vevents.map((vevent: any[]) => {
|
||||
return parseCalendarEvent(
|
||||
vevent[1],
|
||||
cal.color ?? {},
|
||||
cal.id,
|
||||
eventURL,
|
||||
valarm
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
calId: cal.id,
|
||||
events,
|
||||
calType,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const getEventAsync = createAsyncThunk<
|
||||
{ calId: string; event: CalendarEvent },
|
||||
CalendarEvent,
|
||||
{ rejectValue: RejectedError }
|
||||
>("calendars/getEvent", async (event, { rejectWithValue }) => {
|
||||
try {
|
||||
const response: CalendarEvent = await getEvent(event);
|
||||
return {
|
||||
calId: event.calId,
|
||||
event: response,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const patchCalendarAsync = createAsyncThunk<
|
||||
{
|
||||
calId: string;
|
||||
calLink: string;
|
||||
patch: { name: string; desc: string; color: Record<string, string> };
|
||||
},
|
||||
{
|
||||
calId: string;
|
||||
calLink: string;
|
||||
patch: { name: string; desc: string; color: Record<string, string> };
|
||||
},
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/patchCalendar",
|
||||
async ({ calId, calLink, patch }, { rejectWithValue }) => {
|
||||
try {
|
||||
await proppatchCalendar(calLink, patch);
|
||||
return {
|
||||
calId,
|
||||
calLink,
|
||||
patch,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const removeCalendarAsync = createAsyncThunk<
|
||||
{
|
||||
calId: string;
|
||||
},
|
||||
{
|
||||
calId: string;
|
||||
calLink: string;
|
||||
},
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/removeCalendar",
|
||||
async ({ calId, calLink }, { rejectWithValue }) => {
|
||||
try {
|
||||
await removeCalendar(calLink);
|
||||
return {
|
||||
calId,
|
||||
calLink,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const moveEventAsync = createAsyncThunk<
|
||||
{ calId: string; events: CalendarEvent[] },
|
||||
{ cal: Calendar; newEvent: CalendarEvent; newURL: string },
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/moveEvent",
|
||||
async ({ cal, newEvent, newURL }, { rejectWithValue }) => {
|
||||
try {
|
||||
await moveEvent(newEvent, newURL);
|
||||
|
||||
const eventDate = new Date(newEvent.start);
|
||||
const { start: weekStart, end: weekEnd } = computeWeekRange(eventDate);
|
||||
|
||||
const calEvents = (await getCalendar(cal.id, {
|
||||
start: formatDateToYYYYMMDDTHHMMSS(weekStart),
|
||||
end: formatDateToYYYYMMDDTHHMMSS(weekEnd),
|
||||
})) as Record<string, any>;
|
||||
const events: CalendarEvent[] = calEvents._embedded["dav:item"].flatMap(
|
||||
(eventdata: any) => {
|
||||
const vevents = eventdata.data[2] as any[][];
|
||||
const eventURL = eventdata._links.self.href;
|
||||
return vevents.map((vevent: any[]) => {
|
||||
return parseCalendarEvent(
|
||||
vevent[1],
|
||||
cal.color ?? {},
|
||||
cal.id,
|
||||
eventURL
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
calId: cal.id,
|
||||
events,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const patchACLCalendarAsync = createAsyncThunk<
|
||||
{
|
||||
calId: string;
|
||||
calLink: string;
|
||||
request: string;
|
||||
},
|
||||
{
|
||||
calId: string;
|
||||
calLink: string;
|
||||
request: string;
|
||||
},
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/requestACLCalendar",
|
||||
async ({ calId, calLink, request }, { rejectWithValue }) => {
|
||||
try {
|
||||
const response = await updateAclCalendar(calLink, request);
|
||||
return {
|
||||
calId,
|
||||
calLink,
|
||||
request,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteEventAsync = createAsyncThunk<
|
||||
{ calId: string; eventId: string },
|
||||
{ calId: string; eventId: string; eventURL: string },
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/delEvent",
|
||||
async ({ calId, eventId, eventURL }, { rejectWithValue }) => {
|
||||
try {
|
||||
await deleteEvent(eventURL);
|
||||
return { calId, eventId };
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteEventInstanceAsync = createAsyncThunk<
|
||||
{ calId: string; eventId: string },
|
||||
{ cal: Calendar; event: CalendarEvent },
|
||||
{ rejectValue: RejectedError }
|
||||
>("calendars/delEventInstance", async ({ cal, event }, { rejectWithValue }) => {
|
||||
try {
|
||||
await deleteEventInstance(event, cal.ownerEmails?.[0]);
|
||||
return { calId: cal.id, eventId: event.uid };
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const updateEventInstanceAsync = createAsyncThunk<
|
||||
{ calId: string; event: CalendarEvent },
|
||||
{ cal: Calendar; event: CalendarEvent },
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/updateEventInstance",
|
||||
async ({ cal, event }, { rejectWithValue }) => {
|
||||
try {
|
||||
await putEventWithOverrides(event, cal.ownerEmails?.[0]);
|
||||
return { calId: cal.id, event };
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const updateSeriesAsync = createAsyncThunk<
|
||||
void,
|
||||
{ cal: Calendar; event: CalendarEvent; removeOverrides?: boolean },
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/updateSeries",
|
||||
async ({ cal, event, removeOverrides = true }, { rejectWithValue }) => {
|
||||
try {
|
||||
await updateSeries(event, cal.ownerEmails?.[0], removeOverrides);
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const createCalendarAsync = createAsyncThunk<
|
||||
{
|
||||
userId: string;
|
||||
calId: string;
|
||||
color: Record<string, string>;
|
||||
name: string;
|
||||
desc: string;
|
||||
owner: string;
|
||||
ownerEmails: string[];
|
||||
},
|
||||
{
|
||||
userId: string;
|
||||
calId: string;
|
||||
color: Record<string, string>;
|
||||
name: string;
|
||||
desc: string;
|
||||
},
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/createCalendar",
|
||||
async ({ userId, calId, color, name, desc }, { rejectWithValue }) => {
|
||||
try {
|
||||
await postCalendar(userId, calId, color, name, desc);
|
||||
const ownerData: any = await getUserDetails(userId.split("/")[0]);
|
||||
|
||||
return {
|
||||
userId,
|
||||
calId,
|
||||
color,
|
||||
name,
|
||||
desc,
|
||||
owner: `${ownerData.firstname ? `${ownerData.firstname} ` : ""}${
|
||||
ownerData.lastname
|
||||
}`,
|
||||
ownerEmails: ownerData.emails,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const addSharedCalendarAsync = createAsyncThunk<
|
||||
{
|
||||
calId: string;
|
||||
color: Record<string, string>;
|
||||
link: string;
|
||||
name: string;
|
||||
desc: string;
|
||||
owner: string;
|
||||
ownerEmails: string[];
|
||||
},
|
||||
{ userId: string; calId: string; cal: Record<string, any> },
|
||||
{ rejectValue: RejectedError }
|
||||
>(
|
||||
"calendars/addSharedCalendar",
|
||||
async ({ userId, calId, cal }, { rejectWithValue }) => {
|
||||
try {
|
||||
await addSharedCalendar(userId, calId, cal);
|
||||
const ownerData: any = await getUserDetails(
|
||||
cal.cal._links.self.href
|
||||
.replace("/calendars/", "")
|
||||
.replace(".json", "")
|
||||
.split("/")[0]
|
||||
);
|
||||
|
||||
return {
|
||||
calId: cal.cal._links.self.href
|
||||
.replace("/calendars/", "")
|
||||
.replace(".json", ""),
|
||||
color: cal.color,
|
||||
link: `/calendars/${userId}/${calId}.json`,
|
||||
desc: cal.cal["caldav:description"],
|
||||
name:
|
||||
ownerData.id !== userId && cal.cal["dav:name"] === "#default"
|
||||
? `${ownerData.firstname ? `${ownerData.firstname} ` : ""}${
|
||||
ownerData.lastname
|
||||
}` + "'s calendar"
|
||||
: cal.cal["dav:name"],
|
||||
owner: `${ownerData.firstname ? `${ownerData.firstname} ` : ""}${
|
||||
ownerData.lastname
|
||||
}`,
|
||||
ownerEmails: ownerData.emails,
|
||||
};
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export const importEventFromFileAsync = createAsyncThunk<
|
||||
void,
|
||||
{
|
||||
calLink: string;
|
||||
file: File;
|
||||
},
|
||||
{ rejectValue: RejectedError }
|
||||
>("calendars/importEvent", async ({ calLink, file }, { rejectWithValue }) => {
|
||||
try {
|
||||
const id = ((await importFile(file)) as Record<string, string>)._id;
|
||||
const response = await importEventFromFile(id, calLink);
|
||||
} catch (err: any) {
|
||||
return rejectWithValue({
|
||||
message: formatReduxError(err),
|
||||
status: err.response?.status,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const CalendarSlice = createSlice({
|
||||
name: "calendars",
|
||||
initialState: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { api } from "../../../utils/apiUtils";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
import { Calendar } from "../CalendarTypes";
|
||||
import { DavSyncResponse } from "./types";
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user