diff --git a/src/hooks/CalendarHooks.ts b/src/hooks/CalendarHooks.ts
index b28982d..c96ca43 100644
--- a/src/hooks/CalendarHooks.ts
+++ b/src/hooks/CalendarHooks.ts
@@ -165,3 +165,22 @@ export function useDeleteRaidGroupCalendarEvent(raidGroupId: string){
}
});
}
+
+export function useGetRaidInstanceCalendarEvents(raidGroupId?: string){
+ return useQuery({
+ queryKey: ["raidInstanceCalendarEvents", raidGroupId],
+ queryFn: async () => {
+ const response = await api.get(`/calendar/raidGroup/${raidGroupId}/raidInstance`);
+
+ if(response.status !== 200){
+ throw new Error("Failed to get raid instance calendar events");
+ }
+ else if(response.data.errors){
+ throw new Error(response.data.errors.join(", "));
+ }
+
+ return response.data as CalendarEvent[];
+ },
+ enabled: !!raidGroupId && raidGroupId !== ""
+ });
+}
diff --git a/src/ui/calendar/CalendarDisplay.tsx b/src/ui/calendar/CalendarDisplay.tsx
index 7c1aa3b..687234f 100644
--- a/src/ui/calendar/CalendarDisplay.tsx
+++ b/src/ui/calendar/CalendarDisplay.tsx
@@ -56,6 +56,8 @@ export default function CalendarDisplay({
const showEditCalendarEventModal = (eventClickArg: EventClickArg) => {
const calendarEvent = calendarEvents.find((calEvent) => calEvent.calendarEventId === eventClickArg.event.id);
+ console.log("calendarEvent");
+ console.log(calendarEvent);
if(raidGroupId && calendarEvent?.gameId){
setDisableModal(true);
}
@@ -65,6 +67,9 @@ export default function CalendarDisplay({
else if(calendarEvent?.raidGroupId && !isRaidGroupAdmin(calendarEvent?.raidGroupId, raidGroupPermissions, accountPermissions) && !isRaidGroupLeader(calendarEvent?.raidGroupId, raidGroupPermissions, accountPermissions)){
setDisableModal(true);
}
+ else if(calendarEvent?.raidInstanceId){
+ setDisableModal(true);
+ }
setAlterCalendarEvent(calendarEvent);
setDisplayCalendarEventModal(true);
diff --git a/src/ui/calendar/RaidGroupCalendarLoader.tsx b/src/ui/calendar/RaidGroupCalendarLoader.tsx
index 6b95a6e..296f65d 100644
--- a/src/ui/calendar/RaidGroupCalendarLoader.tsx
+++ b/src/ui/calendar/RaidGroupCalendarLoader.tsx
@@ -1,5 +1,5 @@
import DangerMessage from "@/components/message/DangerMessage";
-import { useGetGameCalendar, useGetRaidGroupCalendar } from "@/hooks/CalendarHooks";
+import { useGetGameCalendar, useGetRaidGroupCalendar, useGetRaidInstanceCalendarEvents } from "@/hooks/CalendarHooks";
import CalendarDisplay from "./CalendarDisplay";
@@ -12,6 +12,7 @@ export default function RaidGroupCalendarLoader({
}){
const gameCalendarQuery = useGetGameCalendar(gameId);
const raidGroupCalendarQuery = useGetRaidGroupCalendar(raidGroupId);
+ const raidInstanceCalendarQuery = useGetRaidInstanceCalendarEvents(raidGroupId);
if(raidGroupCalendarQuery.status === "error"){
@@ -20,7 +21,10 @@ export default function RaidGroupCalendarLoader({
else if(gameCalendarQuery.status === "error"){
return (