Skip to content

Commit

Permalink
bump to next version (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
escottalexander authored Nov 4, 2024
2 parents 10874e1 + e019d8c commit 42a5127
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-parrots-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eth-tech-tree": patch
---

sort challenges, grey out challenges that don't exist, other styling changes
10 changes: 6 additions & 4 deletions src/utils/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function getNodeLabel(node: TreeNode, depth: string = ""): string {
if (isHeader) {
return `${depth} ${chalk.blue(label)}`;
} else if (!unlocked) {
return `${depth} ${label} 🔒`;
return `${depth} ${chalk.dim(label)}`;
} else if (isChallenge) {
return `${depth} ${label} ${completed ? "🏆" : "🗝️"}`;
return `${depth} ${label} ${completed ? "🏆" : ""}`;
} else if (isQuiz) {
return `${depth} ${label} 📜`;
} else if (isCapstoneProject) {
Expand All @@ -60,7 +60,7 @@ async function selectNode(node: TreeNode): Promise<void> {
// - Show instructions for completing the challenge including a simple command to test their code
// submit project, check if project passes tests then send proof of completion to the BG server, if it passes, mark the challenge as completed
if (node.type !== "header" && !node.unlocked) {
console.log("This challenge is locked because it doesn't exist yet... 😅");
console.log("This challenge doesn't exist yet. 🤔 Consider contributing to the project here: https://github.com/BuidlGuidl/eth-tech-tree-challenges");
await pressEnterToContinue();
console.clear();
await startVisualization(header);
Expand Down Expand Up @@ -233,12 +233,14 @@ export function buildTree(): TreeNode {
return { label, name, level, type, actions, completed, childrenNames, parentName, unlocked, message: description };
});
const nestedChallenges = nestingMagic(transformedChallenges);

const sortedByUnlocked = nestedChallenges.sort((a: TreeNode, b: TreeNode) => {return a.unlocked ? -1 : 1});

tree.push({
type: "header",
label: `${tag} ${chalk.green(`(${completedCount}/${filteredChallenges.length})`)}`,
name: `${tag.toLowerCase()}`,
children: nestedChallenges,
children: sortedByUnlocked,
recursive: true
});
}
Expand Down

0 comments on commit 42a5127

Please sign in to comment.