Skip to content

Commit 9f7aa03

Browse files
Addressed a lot of UI feedback (#69)
2 parents 37be37b + 7ae1792 commit 9f7aa03

17 files changed

+1054
-474
lines changed

.changeset/gorgeous-keys-swim.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eth-tech-tree": patch
3+
---
4+
5+
Major UI overhaul. Everything should still work similarly to last release.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"license": "MIT",
3333
"devDependencies": {
3434
"@rollup/plugin-typescript": "11.1.0",
35-
"@types/inquirer": "9.0.3",
3635
"@types/ncp": "2.0.5",
3736
"@types/node": "18.16.0",
3837
"rollup": "3.21.0",
@@ -42,6 +41,7 @@
4241
},
4342
"dependencies": {
4443
"@changesets/cli": "^2.26.2",
44+
"@inquirer/prompts": "^7.1.0",
4545
"@types/terminal-kit": "^2.5.6",
4646
"ansi-escapes": "^7.0.0",
4747
"arg": "5.0.2",
@@ -50,8 +50,6 @@
5050
"dotenv": "^16.4.5",
5151
"execa": "7.1.1",
5252
"handlebars": "^4.7.7",
53-
"inquirer": "9.2.0",
54-
"inquirer-tree-prompt": "^1.1.2",
5553
"listr2": "^8.2.5",
5654
"merge-packages": "^0.1.6",
5755
"ncp": "^2.0.0",

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export default {
99
sourcemap: true,
1010
},
1111
plugins: [autoExternal(), typescript({ exclude: ["challenges/**"] })],
12+
external: ["@inquirer/core"],
1213
};

src/actions/setup-challenge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from "path";
55
import fs from "fs";
66
import { createFirstGitCommit } from "../tasks/create-first-git-commit";
77
import { fetchChallenges } from "../modules/api";
8-
import { loadChallenges } from "../utils/stateManager";
8+
import { loadChallenges } from "../utils/state-manager";
99
import { IChallenge } from "../types";
1010
import { BASE_REPO, BASE_BRANCH, BASE_COMMIT } from "../config";
1111
import { DefaultRenderer, Listr, ListrTaskWrapper, SimpleRenderer } from "listr2";

src/actions/submit-challenge.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
import inquirer from "inquirer";
2-
import { loadUserState } from "../utils/stateManager";
1+
import { loadUserState } from "../utils/state-manager";
32
import { submitChallengeToServer } from "../modules/api";
43
import chalk from "chalk";
4+
import { input } from "@inquirer/prompts";
55

66
export async function submitChallenge(name: string, contractAddress?: string) {
77
const { address: userAddress } = loadUserState();
88
if (!contractAddress) {
99
// Prompt the user for the contract address
10-
const questions = [
11-
{
12-
type: "input",
13-
name: "address",
14-
message: "Completed challenge contract address on Sepolia:",
15-
validate: (value: string) => /^0x[a-fA-F0-9]{40}$/.test(value),
16-
},
17-
];
18-
const answers = await inquirer.prompt(questions);
19-
const { address } = answers;
20-
contractAddress = address;
10+
const question = {
11+
message: "Completed challenge contract address on Sepolia:",
12+
validate: (value: string) => /^0x[a-fA-F0-9]{40}$/.test(value),
13+
};
14+
const answer = await input(question);
15+
contractAddress = answer;
2116
}
2217

2318
console.log("Submitting challenge...");

src/cli.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { promptForMissingUserState } from "./tasks/prompt-for-missing-user-state";
22
import { renderIntroMessage } from "./tasks/render-intro-message";
33
import type { Args, IUser } from "./types";
4-
import { startVisualization } from "./utils/tree";
5-
import { loadUserState, saveChallenges } from "./utils/stateManager";
4+
import { loadUserState, saveChallenges } from "./utils/state-manager";
65
import { fetchChallenges } from "./modules/api";
76
import { parseCommandArgumentsAndOptions, promptForMissingCommandArgs } from "./tasks/parse-command-arguments-and-options";
87
import { handleCommand } from "./tasks/handle-command";
8+
import { TechTree } from ".";
99

1010

1111

@@ -19,7 +19,9 @@ export async function cli(args: Args) {
1919
await renderIntroMessage();
2020
await init(userState);
2121
// Navigate tree
22-
await startVisualization();
22+
const techTree = new TechTree();
23+
24+
await techTree.start();
2325
}
2426
}
2527

0 commit comments

Comments
 (0)