@@ -3,15 +3,15 @@ import { HiOutlineExternalLink } from "react-icons/hi";
33import { IoArrowBack } from "react-icons/io5" ;
44import { MdOutlineRefresh } from "react-icons/md" ;
55import { Link , useParams } from "react-router" ;
6- import { ProblemSet , useGetProblemSetsQuery } from "./api/queries/get_problem_sets " ;
6+ import { Exercise , useGetExercisesQuery } from "./api/queries/get_exercises " ;
77import { useGetUserQuery } from "./api/queries/get_user" ;
88import { useGetUserProgressQuery } from "./api/queries/get_user_progress" ;
99import Spinner from "./components/Spinner" ;
1010
1111type UserProblemSetStatus = string ;
1212
1313function Dashboard ( ) {
14- let { username } = useParams ( ) ;
14+ const { username } = useParams ( ) ;
1515
1616 const {
1717 data : user ,
@@ -46,22 +46,22 @@ function Dashboard() {
4646 const {
4747 data : problemSets ,
4848 isLoading : isProblemSetsLoading ,
49- } = useGetProblemSetsQuery ( ) ;
49+ } = useGetExercisesQuery ( ) ;
5050
5151 const problemSetGroups = useMemo ( ( ) => {
5252 if ( isProblemSetsLoading || problemSets == null ) {
53- return new Map < string , ProblemSet [ ] > ( ) ;
53+ return new Map < string , Exercise [ ] > ( ) ;
5454 }
5555
56- const repoGroups = new Map < string , ProblemSet [ ] > ( ) ;
56+ const repoGroups = new Map < string , Exercise [ ] > ( ) ;
5757 for ( const repo of problemSets ) {
58- for ( const topic of repo . topics ) {
59- if ( topic !== "problem-set" ) {
60- if ( parsedUserProgress . has ( repo . name ) ) {
61- if ( ! repoGroups . has ( topic ) ) {
62- repoGroups . set ( topic , [ ] )
58+ for ( const tag of repo . tags ) {
59+ if ( tag !== "problem-set" ) {
60+ if ( parsedUserProgress . has ( repo . exercise_name ) ) {
61+ if ( ! repoGroups . has ( tag ) ) {
62+ repoGroups . set ( tag , [ ] )
6363 }
64- repoGroups . get ( topic ) ! . push ( repo )
64+ repoGroups . get ( tag ) ! . push ( repo )
6565 }
6666 }
6767 }
@@ -124,11 +124,11 @@ function Dashboard() {
124124 </ thead >
125125 < tbody >
126126 { value
127- . filter ( problemSet => parsedUserProgress . has ( problemSet . name ) )
128- . map ( problemSet => (
129- < tr key = { problemSet . id } >
130- < td className = "border border-gray-300 px-4 py-2 text-left" > < a target = "_blank" href = { problemSet . html_url } > < code className = "underline text-blue-800" > { problemSet . name } </ code > </ a > </ td >
131- < td className = "border border-gray-300 px-4 py-2 text-left" > { parsedUserProgress . get ( problemSet . name ) } </ td >
127+ . filter ( exercise => parsedUserProgress . has ( exercise . exercise_name ) )
128+ . map ( ( exercise , idx ) => (
129+ < tr key = { idx } >
130+ < td className = "border border-gray-300 px-4 py-2 text-left" > < a target = "_blank" href = { `https://git-mastery.github.io/exercises/ ${ exercise . exercise_name . replace ( "_" , "-" ) } ` } > < code className = "underline text-blue-800" > { exercise . exercise_name } </ code > </ a > </ td >
131+ < td className = "border border-gray-300 px-4 py-2 text-left" > { parsedUserProgress . get ( exercise . exercise_name ) } </ td >
132132 </ tr >
133133 ) ) }
134134 </ tbody >
0 commit comments