Planning fixed
This commit is contained in:
@@ -11,7 +11,7 @@ export default async function Page() {
|
||||
me.status === "Error" ||
|
||||
!me.data ||
|
||||
!hasPermissions(me.data.roles, {
|
||||
events: ["get"],
|
||||
blogs: ["get"],
|
||||
})
|
||||
) {
|
||||
redirect("/dashboard");
|
||||
|
||||
@@ -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
|
||||
? [
|
||||
const plugins: Plugins = [
|
||||
createEventsServicePlugin(),
|
||||
createDragAndDropPlugin(),
|
||||
createResizePlugin(),
|
||||
createEventRecurrencePlugin(),
|
||||
]
|
||||
: [];
|
||||
];
|
||||
if (isConnected && modifiable) {
|
||||
plugins.push(createDragAndDropPlugin());
|
||||
plugins.push(createResizePlugin());
|
||||
}
|
||||
const [eventSelected, setEventSelected] = useState<ICalendarEvent | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user