Skip to content

Commit a4a8cef

Browse files
committed
Clean up wordings
1 parent 1b166b3 commit a4a8cef

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/Dashboard.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,30 @@ function Dashboard() {
4444
}, [userProgress, isUserProgressLoading])
4545

4646
const {
47-
data: problemSets,
47+
data: exercises,
4848
isLoading: isProblemSetsLoading,
4949
} = useGetExercisesQuery();
5050

51-
const problemSetGroups = useMemo(() => {
52-
if (isProblemSetsLoading || problemSets == null) {
51+
const exerciseGroups = useMemo(() => {
52+
if (isProblemSetsLoading || exercises == null) {
5353
return new Map<string, Exercise[]>();
5454
}
5555

5656
const repoGroups = new Map<string, Exercise[]>();
57-
for (const repo of problemSets) {
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, [])
63-
}
64-
repoGroups.get(tag)!.push(repo)
57+
for (const exercise of exercises) {
58+
for (const tag of exercise.tags) {
59+
if (parsedUserProgress.has(exercise.exercise_name)) {
60+
if (!repoGroups.has(tag)) {
61+
repoGroups.set(tag, [])
6562
}
63+
repoGroups.get(tag)!.push(exercise)
6664
}
6765
}
6866
}
6967

7068
const sortedGroups = new Map([...repoGroups.entries()].sort())
7169
return sortedGroups
72-
}, [problemSets, isProblemSetsLoading, parsedUserProgress])
70+
}, [exercises, isProblemSetsLoading, parsedUserProgress])
7371

7472
const refreshUserProgress = useCallback(async () => {
7573
await refetchUserProgress()
@@ -89,8 +87,8 @@ function Dashboard() {
8987
</div>
9088
<button type="button" className="hover:cursor-pointer" onClick={refreshUserProgress}><MdOutlineRefresh size={24} color="text-gray-500" /></button>
9189
</div>
92-
<p className="text-gray-700 font-semibold">Find your progress for the various Git Mastery problem sets.</p>
93-
<p className="text-gray-700">To view all problem sets, visit the <a className="text-blue-800 underline" href="https://github.com/git-mastery/problems-directory">problems directory</a>.</p>
90+
<p className="text-gray-700 font-semibold">Find your progress for the various Git Mastery exercises.</p>
91+
<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>
9492
</div>
9593
<div>
9694
{(isUserLoading || isUserProgressLoading || isUserProgressRefetching || isProblemSetsLoading) ? (
@@ -104,13 +102,13 @@ function Dashboard() {
104102
<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>
105103
</div>
106104
) : (
107-
problemSetGroups.size === 0 ? (
105+
exerciseGroups.size === 0 ? (
108106
<div className="text-center">
109-
<p className="mb-4">You have not completed any problem sets yet</p>
110-
<a href="https://github.com/git-mastery/problems-directory" target="_blank" className="hover:cursor-pointer border-1 border-blue-800 bg-blue-800 text-white rounded-sm px-4 py-2 font-semibold">Go to problems directory ↗</a>
107+
<p className="mb-4">You have not completed any exercises yet</p>
108+
<a href="https://git-mastery.github.io/exercises" target="_blank" className="hover:cursor-pointer border-1 border-blue-800 bg-blue-800 text-white rounded-sm px-4 py-2 font-semibold">Go to exercises directory ↗</a>
111109
</div>
112110
) : (
113-
Array.from(problemSetGroups)
111+
Array.from(exerciseGroups)
114112
.map(([key, value]) => {
115113
return (
116114
<div key={key} className="not-last:mb-4">
@@ -127,7 +125,7 @@ function Dashboard() {
127125
.filter(exercise => parsedUserProgress.has(exercise.exercise_name))
128126
.map((exercise, idx) => (
129127
<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>
128+
<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>
131129
<td className="border border-gray-300 px-4 py-2 text-left">{parsedUserProgress.get(exercise.exercise_name)}</td>
132130
</tr>
133131
))}

0 commit comments

Comments
 (0)