2024-09-18 22:27:07 +03:00
|
|
|
import useEvents from './useEvents.js';
|
|
|
|
import useSpeakers from './useSpeakers.js';
|
|
|
|
import useTracks from './useTracks.js';
|
|
|
|
import useEventTypes from './useEventTypes.js';
|
|
|
|
import useHalls from './useHalls.js';
|
|
|
|
import useSlots from './useSlots.js';
|
2024-09-19 01:57:05 +03:00
|
|
|
import { calculateProgress } from '../utils.js';
|
2024-09-18 22:27:07 +03:00
|
|
|
|
|
|
|
export default function useSchedule(conferenceId) {
|
|
|
|
const {
|
|
|
|
data: events,
|
|
|
|
isLoading: eventsLoading,
|
|
|
|
isValidating: eventsValidating,
|
|
|
|
} = useEvents(conferenceId);
|
|
|
|
|
|
|
|
const {
|
|
|
|
data: speakers,
|
|
|
|
isLoading: speakersLoading,
|
|
|
|
isValidating: speakersValidating,
|
|
|
|
} = useSpeakers(conferenceId);
|
|
|
|
|
|
|
|
const {
|
|
|
|
data: tracks,
|
|
|
|
isLoading: tracksLoading,
|
|
|
|
isValidating: tracksValidating,
|
|
|
|
} = useTracks(conferenceId);
|
|
|
|
|
|
|
|
const {
|
|
|
|
data: eventTypes,
|
|
|
|
isLoading: eventTypesLoading,
|
|
|
|
isValidating: eventTypesValidating,
|
|
|
|
} = useEventTypes(conferenceId);
|
|
|
|
|
|
|
|
const {
|
|
|
|
data: halls,
|
|
|
|
isLoading: hallsLoading,
|
|
|
|
isValidating: hallsValidating,
|
|
|
|
} = useHalls(conferenceId);
|
|
|
|
|
|
|
|
const {
|
|
|
|
data: slots,
|
|
|
|
isLoading: slotsLoading,
|
|
|
|
isValidating: slotsValidating,
|
|
|
|
} = useSlots(conferenceId);
|
|
|
|
|
2024-09-19 01:57:05 +03:00
|
|
|
const {
|
|
|
|
isStarted: isLoading,
|
|
|
|
remainingProgress: loadingProgress,
|
|
|
|
} = calculateProgress(eventsLoading, speakersLoading, tracksLoading, eventTypesLoading, hallsLoading, slotsLoading);
|
|
|
|
|
|
|
|
const {
|
|
|
|
isStarted: isValidating,
|
|
|
|
remainingProgress: validatingProgress,
|
|
|
|
} = calculateProgress(eventsValidating, speakersValidating, tracksValidating, eventTypesValidating, hallsValidating, slotsValidating);
|
2024-09-18 22:27:07 +03:00
|
|
|
|
|
|
|
return {
|
|
|
|
events,
|
|
|
|
speakers,
|
|
|
|
tracks,
|
|
|
|
eventTypes,
|
|
|
|
halls,
|
|
|
|
slots,
|
|
|
|
isLoading,
|
2024-09-19 01:57:05 +03:00
|
|
|
loadingProgress,
|
2024-09-18 22:27:07 +03:00
|
|
|
isValidating,
|
2024-09-19 01:57:05 +03:00
|
|
|
validatingProgress,
|
2024-09-18 22:27:07 +03:00
|
|
|
};
|
|
|
|
}
|