diff --git a/src/Schedule.jsx b/src/Schedule.jsx
index ab2382e..50a3263 100644
--- a/src/Schedule.jsx
+++ b/src/Schedule.jsx
@@ -12,10 +12,11 @@ export default function Schedule({
speakers,
tracks,
isLoading,
+ loadingProgress,
} = useSchedule(conferenceId);
return (<>
- {isLoading &&
Loading...
}
+ {isLoading && Loading...
}
schedule goes here
{tracks && Object.entries(tracks).map(([trackId, track]) => (a, b) => sorter(a, b, item => Date.parse(item[
export const getSpeakerName = speaker => speaker.first_name.concat(' ').concat(speaker.last_name);
export const isTrackHidden = track => track.name.en === 'Other' || track.name.bg === 'Други';
+
+export function calculateProgress(...elements) {
+ const totalCount = elements.length;
+
+ if (totalCount === 0) {
+ return {
+ totalCount,
+ completeCount: 0,
+ incompleteCount: 0,
+ progress: 1,
+ remainingProgress: 0,
+ isComplete: true,
+ isIncomplete: false,
+ isStarted: true,
+ isNotStarted: false,
+ };
+ }
+
+ const completeCount = elements.filter(element => !!element).length;
+ const progress = completeCount / totalCount;
+
+ return {
+ totalCount,
+ completeCount,
+ incompleteCount: totalCount - completeCount,
+ progress,
+ remainingProgress: 1 - progress,
+ isComplete: completeCount === totalCount,
+ isIncomplete: completeCount < totalCount,
+ isStarted: completeCount > 0,
+ isNotStarted: completeCount === 0,
+ };
+}