Planning fixed

This commit is contained in:
cdricms
2025-02-26 17:40:12 +01:00
parent 5ef6b82b83
commit 3e53c67a4d
2 changed files with 16 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ export default async function Page() {
me.status === "Error" ||
!me.data ||
!hasPermissions(me.data.roles, {
events: ["get"],
blogs: ["get"],
})
) {
redirect("/dashboard");

View File

@@ -8,7 +8,11 @@ import { createEventsServicePlugin } from "@schedule-x/events-service";
import { createDragAndDropPlugin } from "@schedule-x/drag-and-drop";
import { createResizePlugin } from "@schedule-x/resize";
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 { format } from "date-fns";
import { Dialog, DialogProps } from "@radix-ui/react-dialog";
@@ -29,6 +33,8 @@ import { UseFormReturn } from "react-hook-form";
import mapFrequencyToRrule from "@/lib/mapFrequencyToRrule";
import { useToast } from "@/hooks/use-toast";
type Plugins = PluginBase<string>[];
const Planning: React.FC<{
events: ICalendarEvent[];
mutate?: KeyedMutator<ApiResponse<ICalendarEvent[]>>;
@@ -37,15 +43,14 @@ const Planning: React.FC<{
const { toast } = useToast();
const { resolvedTheme } = useTheme();
const isConnected = getCookie("auth_token");
const plugins =
isConnected && modifiable
? [
createEventsServicePlugin(),
createDragAndDropPlugin(),
createResizePlugin(),
createEventRecurrencePlugin(),
]
: [];
const plugins: Plugins = [
createEventsServicePlugin(),
createEventRecurrencePlugin(),
];
if (isConnected && modifiable) {
plugins.push(createDragAndDropPlugin());
plugins.push(createResizePlugin());
}
const [eventSelected, setEventSelected] = useState<ICalendarEvent | null>(
null,
);