Skip to content

Commit d5b2d46

Browse files
OttoAllmendingerllm-git
andcommitted
feat(webui): add PSBT editor
- Add Playwright as dev dependency and configure test environment - Extract common styles to separate module for reusability - Implement PSBT output editing (add/remove) in parser component - Add comprehensive E2E tests for parser functionality - Auto-expand tree to outputs level when PSBT is loaded Co-authored-by: llm-git <llm-git@ttll.de>
1 parent 1097f91 commit d5b2d46

11 files changed

Lines changed: 556 additions & 60 deletions

File tree

package-lock.json

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/webui/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"build:wasm": "bash scripts/build-wasm.sh",
1616
"build": "npm run build:wasm && npm run extract-samples && webpack --mode production --progress --config ./webpack.config.js",
1717
"typecheck": "tsc --noEmit",
18-
"test": "echo \"Error: no test specified\"",
18+
"test": "playwright test",
1919
"dev": "npm run build:wasm && npm run extract-samples && webpack serve --mode development --progress --hot --config ./webpack.config.js",
2020
"fmt": "prettier --write '{src,webpack}/**/*.{tsx,ts,js}'",
2121
"check-fmt": "prettier --check '{src,webpack}/**/*.{tsx,ts,js}'",
@@ -33,6 +33,7 @@
3333
"newtype-ts": "^0.3.5"
3434
},
3535
"devDependencies": {
36+
"@playwright/test": "^1.58.2",
3637
"css-loader": "^7.1.2",
3738
"gh-pages": "^6.1.1",
3839
"html-webpack-plugin": "^5.6.0",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { defineConfig } from "@playwright/test";
2+
3+
export default defineConfig({
4+
testDir: "./tests",
5+
timeout: 30_000,
6+
use: {
7+
baseURL: "http://localhost:9090",
8+
headless: true,
9+
},
10+
webServer: {
11+
command: "npx webpack serve --mode development --port 9090",
12+
port: 9090,
13+
timeout: 60_000,
14+
reuseExistingServer: true,
15+
},
16+
projects: [
17+
{
18+
name: "chromium",
19+
use: { browserName: "chromium" },
20+
},
21+
],
22+
});

packages/webui/src/index.ts

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,60 +12,7 @@ import "./wasm-utxo/addresses";
1212
import "./wasm-solana/transaction";
1313
import "./wasm-utxo/parser";
1414

15-
// Common styles used across components
16-
export const commonStyles = `
17-
* {
18-
box-sizing: border-box;
19-
}
20-
21-
:host {
22-
display: block;
23-
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
24-
color: var(--fg, #c9d1d9);
25-
line-height: 1.5;
26-
}
27-
28-
a {
29-
color: var(--accent, #58a6ff);
30-
text-decoration: none;
31-
}
32-
33-
a:hover {
34-
text-decoration: underline;
35-
}
36-
37-
button, input, textarea, select {
38-
font-family: inherit;
39-
}
40-
41-
h1, h2, h3 {
42-
margin: 0 0 1rem;
43-
font-weight: 500;
44-
}
45-
46-
h1 {
47-
font-size: 1.5rem;
48-
color: var(--fg, #c9d1d9);
49-
}
50-
51-
h2 {
52-
font-size: 1.25rem;
53-
}
54-
55-
.breadcrumb {
56-
font-size: 0.875rem;
57-
margin-bottom: 1.5rem;
58-
color: var(--muted, #8b949e);
59-
}
60-
61-
.breadcrumb a {
62-
color: var(--accent, #58a6ff);
63-
}
64-
65-
.breadcrumb span {
66-
color: var(--fg, #c9d1d9);
67-
}
68-
`;
15+
import { commonStyles } from "./styles";
6916

7017
/**
7118
* Home page component - navigation hub for all demos.

packages/webui/src/styles.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/** Common styles shared across all web components. */
2+
export const commonStyles = `
3+
* {
4+
box-sizing: border-box;
5+
}
6+
7+
:host {
8+
display: block;
9+
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
10+
color: var(--fg, #c9d1d9);
11+
line-height: 1.5;
12+
}
13+
14+
a {
15+
color: var(--accent, #58a6ff);
16+
text-decoration: none;
17+
}
18+
19+
a:hover {
20+
text-decoration: underline;
21+
}
22+
23+
button, input, textarea, select {
24+
font-family: inherit;
25+
}
26+
27+
h1, h2, h3 {
28+
margin: 0 0 1rem;
29+
font-weight: 500;
30+
}
31+
32+
h1 {
33+
font-size: 1.5rem;
34+
color: var(--fg, #c9d1d9);
35+
}
36+
37+
h2 {
38+
font-size: 1.25rem;
39+
}
40+
41+
.breadcrumb {
42+
font-size: 0.875rem;
43+
margin-bottom: 1.5rem;
44+
color: var(--muted, #8b949e);
45+
}
46+
47+
.breadcrumb a {
48+
color: var(--accent, #58a6ff);
49+
}
50+
51+
.breadcrumb span {
52+
color: var(--fg, #c9d1d9);
53+
}
54+
`;

packages/webui/src/wasm-solana/transaction/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { BaseComponent, defineComponent, h, css, fragment, type Child } from "../../lib/html";
99
import { setParams } from "../../lib/router";
10-
import { commonStyles } from "../../index";
10+
import { commonStyles } from "../../styles";
1111
import {
1212
Transaction,
1313
parseTransaction,

packages/webui/src/wasm-utxo/addresses/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { BaseComponent, defineComponent, h, css, fragment, type Child } from "../../lib/html";
99
import { setParams } from "../../lib/router";
10-
import { commonStyles } from "../../index";
10+
import { commonStyles } from "../../styles";
1111
import { address, type CoinName, type AddressFormat } from "@bitgo/wasm-utxo";
1212

1313
const { toOutputScriptWithCoin, fromOutputScriptWithCoin } = address;

0 commit comments

Comments
 (0)