Raid Group calendar working
This commit is contained in:
38
src/ui/calendar/RaidGroupCalendarLoader.tsx
Normal file
38
src/ui/calendar/RaidGroupCalendarLoader.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import DangerMessage from "@/components/message/DangerMessage";
|
||||
import { useGetGameCalendar, useGetRaidGroupCalendar } from "@/hooks/CalendarHooks";
|
||||
import CalendarDisplay from "./CalendarDisplay";
|
||||
|
||||
|
||||
export default function RaidGroupCalendarLoader({
|
||||
gameId,
|
||||
raidGroupId
|
||||
}:{
|
||||
gameId: string;
|
||||
raidGroupId: string;
|
||||
}){
|
||||
const gameCalendarQuery = useGetGameCalendar(gameId);
|
||||
const raidGroupCalendarQuery = useGetRaidGroupCalendar(raidGroupId);
|
||||
|
||||
|
||||
if(raidGroupCalendarQuery.status === "error"){
|
||||
return (<DangerMessage>Error {raidGroupCalendarQuery.error.message}</DangerMessage>);
|
||||
}
|
||||
else if(gameCalendarQuery.status === "error"){
|
||||
return (<DangerMessage>Error {gameCalendarQuery.error.message}</DangerMessage>);
|
||||
}
|
||||
else if((raidGroupCalendarQuery.status === "pending") || (gameCalendarQuery.status === "pending")){
|
||||
return (
|
||||
<div>
|
||||
Loading...
|
||||
</div>
|
||||
);
|
||||
}
|
||||
else{
|
||||
return (
|
||||
<CalendarDisplay
|
||||
raidGroupId={raidGroupId}
|
||||
calendarEvents={[...raidGroupCalendarQuery.data, ...gameCalendarQuery.data]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user