Skip to content

Commit c545b0a

Browse files
committed
Work on the debug pane's content
1 parent d784d38 commit c545b0a

11 files changed

Lines changed: 202 additions & 26 deletions

dist/hyperapp-devtools.js

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

dist/hyperapp-devtools.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import "./DebugPaneContent.scss";
2+
import { State, Actions, Run } from "../api";
3+
export interface DebugPaneContentProps {
4+
state: State;
5+
actions: Actions;
6+
runs: Run[];
7+
}
8+
export declare function DebugPaneContent(props: DebugPaneContentProps): JSX.Element;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import "./ObjectDetailsPane.scss";
2+
import { State, Actions } from "../api";
3+
export interface ObjectDetailsPaneProps {
4+
state: State;
5+
actions: Actions;
6+
}
7+
export declare function ObjectDetailsPane(props: ObjectDetailsPaneProps): JSX.Element;

examples/hyperapp-devtools.js

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

src/components/DebugPane.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,4 @@
66
background: #fefefe;
77
border: 1px solid black;
88
color: black;
9-
10-
.debug-content {
11-
flex-grow: 1;
12-
13-
pre {
14-
margin: 0rem;
15-
}
16-
}
179
}

src/components/DebugPane.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import { State, Actions, PaneDisplay } from "../api"
44

55
import { DebuggerOptions } from "./DebuggerOptions"
66
import { DebugPaneToolbar } from "./DebugPaneToolbar"
7+
import { DebugPaneContent } from "./DebugPaneContent"
78

89
import "./DebugPane.scss"
10+
import { getRuns } from "../selectors"
911

1012
export interface DebugPaneProps {
1113
state: State
@@ -15,13 +17,12 @@ export interface DebugPaneProps {
1517
export function DebugPane(props: DebugPaneProps) {
1618
const { state, actions } = props
1719

20+
const runs = getRuns(state)
1821
return (
1922
<div class="debug-pane">
2023
{DebugPaneToolbar({ state, actions })}
2124
{DebuggerOptions({ state, actions })}
22-
<div class="debug-content scrollable">
23-
<pre class="scrollable-content">{JSON.stringify(state, null, 2)}</pre>
24-
</div>
25+
{DebugPaneContent({ state, actions, runs })}
2526
</div>
2627
)
2728
}

src/components/DebugPaneContent.scss

Whitespace-only changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { h } from "hyperapp"
2+
3+
import "./DebugPaneContent.scss"
4+
5+
import { State, Actions, Run } from "../api"
6+
import { ObjectDetailsPane } from "./ObjectDetailsPane"
7+
import { RunsPane } from "./RunsPane"
8+
9+
export interface DebugPaneContentProps {
10+
state: State
11+
actions: Actions
12+
runs: Run[]
13+
}
14+
15+
export function DebugPaneContent(props: DebugPaneContentProps) {
16+
const { state, actions, runs } = props
17+
if (runs.length === 0) {
18+
return (
19+
<div class="debug-pane-content">
20+
<p>No debug information found, please debug this project.</p>
21+
</div>
22+
)
23+
}
24+
return (
25+
<div class="debug-pane-content">
26+
{RunsPane({ state, actions, runs })}
27+
{ObjectDetailsPane({ state, actions })}
28+
</div>
29+
)
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.object-details-pane {
2+
flex-grow: 1;
3+
4+
pre {
5+
margin: 0rem;
6+
}
7+
}

0 commit comments

Comments
 (0)