Planning fixed
This commit is contained in:
@@ -11,7 +11,7 @@ export default async function Page() {
|
|||||||
me.status === "Error" ||
|
me.status === "Error" ||
|
||||||
!me.data ||
|
!me.data ||
|
||||||
!hasPermissions(me.data.roles, {
|
!hasPermissions(me.data.roles, {
|
||||||
events: ["get"],
|
blogs: ["get"],
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
redirect("/dashboard");
|
redirect("/dashboard");
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ import { createEventsServicePlugin } from "@schedule-x/events-service";
|
|||||||
import { createDragAndDropPlugin } from "@schedule-x/drag-and-drop";
|
import { createDragAndDropPlugin } from "@schedule-x/drag-and-drop";
|
||||||
import { createResizePlugin } from "@schedule-x/resize";
|
import { createResizePlugin } from "@schedule-x/resize";
|
||||||
import { createEventRecurrencePlugin } from "@schedule-x/event-recurrence";
|
import { createEventRecurrencePlugin } from "@schedule-x/event-recurrence";
|
||||||
import { createViewDay, createViewWeek } from "@schedule-x/calendar";
|
import {
|
||||||
|
createViewDay,
|
||||||
|
createViewWeek,
|
||||||
|
PluginBase,
|
||||||
|
} from "@schedule-x/calendar";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { Dialog, DialogProps } from "@radix-ui/react-dialog";
|
import { Dialog, DialogProps } from "@radix-ui/react-dialog";
|
||||||
@@ -29,6 +33,8 @@ import { UseFormReturn } from "react-hook-form";
|
|||||||
import mapFrequencyToRrule from "@/lib/mapFrequencyToRrule";
|
import mapFrequencyToRrule from "@/lib/mapFrequencyToRrule";
|
||||||
import { useToast } from "@/hooks/use-toast";
|
import { useToast } from "@/hooks/use-toast";
|
||||||
|
|
||||||
|
type Plugins = PluginBase<string>[];
|
||||||
|
|
||||||
const Planning: React.FC<{
|
const Planning: React.FC<{
|
||||||
events: ICalendarEvent[];
|
events: ICalendarEvent[];
|
||||||
mutate?: KeyedMutator<ApiResponse<ICalendarEvent[]>>;
|
mutate?: KeyedMutator<ApiResponse<ICalendarEvent[]>>;
|
||||||
@@ -37,15 +43,14 @@ const Planning: React.FC<{
|
|||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
const isConnected = getCookie("auth_token");
|
const isConnected = getCookie("auth_token");
|
||||||
const plugins =
|
const plugins: Plugins = [
|
||||||
isConnected && modifiable
|
createEventsServicePlugin(),
|
||||||
? [
|
createEventRecurrencePlugin(),
|
||||||
createEventsServicePlugin(),
|
];
|
||||||
createDragAndDropPlugin(),
|
if (isConnected && modifiable) {
|
||||||
createResizePlugin(),
|
plugins.push(createDragAndDropPlugin());
|
||||||
createEventRecurrencePlugin(),
|
plugins.push(createResizePlugin());
|
||||||
]
|
}
|
||||||
: [];
|
|
||||||
const [eventSelected, setEventSelected] = useState<ICalendarEvent | null>(
|
const [eventSelected, setEventSelected] = useState<ICalendarEvent | null>(
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user