@@ -6,7 +6,6 @@ import { Link, useParams } from "react-router";
66import { Exercise , useGetExercisesQuery } from "./api/queries/get_exercises" ;
77import { useGetUserQuery } from "./api/queries/get_user" ;
88import { useGetUserProgressQuery } from "./api/queries/get_user_progress" ;
9- import { useGetUserUpdateTimeQuery } from "./api/queries/get_user_update_time" ;
109import Spinner from "./components/Spinner" ;
1110
1211type UserProblemSetStatus = string ;
@@ -24,7 +23,7 @@ function Dashboard() {
2423 isLoading : isUserProgressLoading ,
2524 isRefetchError : isUserProgressRefetching ,
2625 refetch : refetchUserProgress ,
27- } = useGetUserProgressQuery ( user ?. id ) ;
26+ } = useGetUserProgressQuery ( user ?. login ) ;
2827
2928 const parsedUserProgress = useMemo ( ( ) => {
3029 if ( isUserProgressLoading || userProgress == null ) {
@@ -74,32 +73,6 @@ function Dashboard() {
7473 await refetchUserProgress ( )
7574 } , [ refetchUserProgress ] )
7675
77- const {
78- data : latestActionRun
79- } = useGetUserUpdateTimeQuery ( user ?. id )
80-
81- const formatTimeWithTimezone = useCallback ( ( dateObj : Date ) => {
82- const formatter = new Intl . DateTimeFormat ( 'en-GB' , {
83- day : '2-digit' ,
84- month : 'short' ,
85- year : 'numeric' ,
86- hour : '2-digit' ,
87- minute : '2-digit' ,
88- hour12 : false ,
89- timeZone : Intl . DateTimeFormat ( ) . resolvedOptions ( ) . timeZone
90- } ) ;
91-
92- return formatter . format ( dateObj )
93- } , [ ] )
94-
95- const expectedNextUpdateTime = useMemo ( ( ) => {
96- if ( latestActionRun == null ) {
97- return null
98- }
99- const expectedTime = new Date ( latestActionRun . getTime ( ) + 30 * 60 * 1000 )
100- return expectedTime
101- } , [ latestActionRun ] )
102-
10376 return (
10477 < div className = "lg:w-[40%] my-16 mx-auto md:w-[60%] w-[80%]" >
10578 < h3 className = "text-2xl font-bold mb-4" > Git Mastery Progress Dashboard</ h3 >
@@ -116,12 +89,6 @@ function Dashboard() {
11689 </ div >
11790 < p className = "text-gray-700 font-semibold" > Find your progress for the various Git Mastery exercises.</ p >
11891 < p className = "text-gray-700" > To view all exercises, visit the < a className = "text-blue-800 underline" href = "https://git-mastery.github.io/exercises" > exercises directory</ a > .</ p >
119- { latestActionRun != null && expectedNextUpdateTime != null && (
120- < p className = "mt-2 italic" > Last updated on { formatTimeWithTimezone ( latestActionRun ) } .
121- < br /> Next update around { formatTimeWithTimezone ( expectedNextUpdateTime ) }
122- < br /> If there is a discrepancy, open a ticket with the Git-Mastery team < a className = "text-blue-800 underline" href = "https://github.com/git-mastery/git-mastery" > here</ a >
123- </ p >
124- ) }
12592 </ div >
12693 < div >
12794 { ( isUserLoading || isUserProgressLoading || isUserProgressRefetching || isProblemSetsLoading ) ? (
@@ -134,7 +101,19 @@ function Dashboard() {
134101 < p className = "mb-4 text-red-700" > User < strong > { username } </ strong > does not exist</ p >
135102 < Link to = "/" className = "hover:cursor-pointer border-1 border-red-700 bg-red-700 text-white rounded-sm px-4 py-2 font-semibold" > ← Return to search</ Link >
136103 </ div >
137- ) : (
104+ ) : userProgress == null ? (
105+ < div className = "text-center" >
106+ < p className = "mb-4 text-red-700" >
107+ No progress repository found for < strong > { username } </ strong > .
108+ </ p >
109+ < Link
110+ to = "/"
111+ className = "hover:cursor-pointer border-1 border-red-700 bg-red-700 text-white rounded-sm px-4 py-2 font-semibold"
112+ >
113+ ← Return to search
114+ </ Link >
115+ </ div >
116+ ) : (
138117 exerciseGroups . size === 0 ? (
139118 < div className = "text-center" >
140119 < p className = "mb-4" > You have not completed any exercises yet</ p >
0 commit comments