diff --git a/src/components/UserProgress/UserProgressModal.tsx b/src/components/UserProgress/UserProgressModal.tsx index 109e86f05..47b0151c5 100644 --- a/src/components/UserProgress/UserProgressModal.tsx +++ b/src/components/UserProgress/UserProgressModal.tsx @@ -58,7 +58,8 @@ export function UserProgressModal(props: ProgressMapProps) { resourceId: string ) { const { error, response } = await httpGet( - `${import.meta.env.PUBLIC_API_URL + `${ + import.meta.env.PUBLIC_API_URL }/v1-get-user-progress/${userId}?resourceType=${resourceType}&resourceId=${resourceId}` ); if (error || !response) { @@ -128,10 +129,11 @@ export function UserProgressModal(props: ProgressMapProps) { }); }, [userId]); - const user = useMemo(() => userResponse, [userResponse]) + const user = useMemo(() => userResponse, [userResponse]); const userProgressTotal = user?.progress?.total || 0; const userDone = user?.progress?.done?.length || 0; - const progressPercentage = Math.round((userDone / userProgressTotal) * 100) || 0 + const progressPercentage = + Math.round((userDone / userProgressTotal) * 100) || 0; const userLearning = user?.progress?.learning?.length || 0; const userSkipped = user?.progress?.skipped?.length || 0; @@ -147,21 +149,34 @@ export function UserProgressModal(props: ProgressMapProps) { class="popup-body relative rounded-lg bg-white pt-[1px] shadow" >
-
-

- {user?.user.name}'s Progress -

-

- You are looking at {user?.user.name}'s progress. -

+
+ {isLoading && ( +
+ +
+ )} + {!isLoading && ( + <> +

+ {user?.user.name}'s Progress +

+

+ You are looking at {user?.user.name}'s progress. +

+ + )}

{progressPercentage}% Done @@ -172,8 +187,9 @@ export function UserProgressModal(props: ProgressMapProps) {