Skip to content

Commit 6b13d31

Browse files
committed
run ui page refinements
Signed-off-by: Nick Mitchell <[email protected]>
1 parent 342c385 commit 6b13d31

File tree

4 files changed

+137
-43
lines changed

4 files changed

+137
-43
lines changed

pdl-live-react/package-lock.json

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

pdl-live-react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"start": "npm run tauri dev"
2424
},
2525
"dependencies": {
26+
"@patternfly/react-code-editor": "^6.1.0",
2627
"@patternfly/react-core": "^6.1.0",
2728
"@tauri-apps/api": "^2.3.0",
2829
"@tauri-apps/plugin-cli": "^2.2.0",

pdl-live-react/src/page/Run.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@import "../view/term/RunTerminal.css";
2+
3+
.pdl-run-page-section {
4+
.pdl-run-split-item-card-header,
5+
.pdl-run-split-item-card-body {
6+
padding-inline-start: 0;
7+
padding-right: 0;
8+
}
9+
}

pdl-live-react/src/page/Run.tsx

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,32 @@ import { invoke } from "@tauri-apps/api/core"
33
import { Terminal } from "@xterm/xterm"
44
import { FitAddon } from "@xterm/addon-fit"
55
import { ClipboardAddon } from "@xterm/addon-clipboard"
6+
import { CodeEditor, Language } from "@patternfly/react-code-editor"
67
import {
78
Button,
8-
Panel,
9-
PanelHeader,
10-
PanelMain,
11-
PanelMainBody,
9+
Card,
10+
CardBody,
11+
CardHeader,
12+
CardTitle,
1213
PageSection,
13-
Split,
14-
SplitItem,
14+
Flex,
15+
FlexItem,
1516
TextArea,
1617
Toolbar,
18+
ToolbarContent,
1719
ToolbarItem,
1820
} from "@patternfly/react-core"
1921

2022
import Page from "./Page"
21-
import "../view/term/RunTerminal.css"
23+
import "./Run.css"
2224

2325
export default function Run() {
24-
const [input, setInput] = useState("")
26+
const [input, setInput] = useState(`text:
27+
- text:
28+
- '{"key": "value"}'
29+
parser: json
30+
def: foo
31+
- \${ foo.key }`)
2532
const [error, setError] = useState(false)
2633

2734
const ref = createRef<HTMLDivElement>()
@@ -34,7 +41,6 @@ export default function Run() {
3441
const term = new Terminal({
3542
fontFamily:
3643
'"Red Hat Mono", RedHatMono, "Courier New", Courier, monospace',
37-
fontSize: 12,
3844
convertEol: true,
3945
})
4046
setTerm(term)
@@ -77,49 +83,55 @@ export default function Run() {
7783

7884
return (
7985
<Page breadcrumb1="Run">
80-
<PageSection>
81-
<Split hasGutter>
82-
<SplitItem isFilled>
83-
<Panel>
84-
<PanelHeader>Program</PanelHeader>
85-
<PanelMain>
86-
<PanelMainBody>
87-
<TextArea
86+
<PageSection className="pdl-run-page-section">
87+
<Flex>
88+
<FlexItem flex={{ default: "flex_1" }}>
89+
<Card isPlain>
90+
<CardHeader className="pdl-run-split-item-card-header">
91+
<CardTitle>Program</CardTitle>
92+
</CardHeader>
93+
<CardBody className="pdl-run-split-item-card-body">
94+
<div style={{ height: "600px" }}>
95+
<CodeEditor
96+
options={{ fontSize: 16 }}
8897
aria-label="text area to provide PDL program source"
89-
validated={!!error ? "error" : undefined}
90-
value={input}
91-
style={{ height: "600px" }}
92-
onChange={(_event, value) => {
98+
code={input}
99+
isDarkTheme
100+
isFullHeight
101+
language="yaml"
102+
onChange={(value) => {
93103
setError(null)
94104
setInput(value)
95105
term.clear()
96106
}}
97107
/>
98-
</PanelMainBody>
99-
</PanelMain>
100-
</Panel>
101-
</SplitItem>
108+
</div>
109+
</CardBody>
110+
</Card>
111+
</FlexItem>
102112

103-
<SplitItem>
104-
<Panel>
105-
<PanelHeader>Output</PanelHeader>
106-
<PanelMain>
107-
<PanelMainBody>
108-
<div
109-
className="pdl-run-terminal"
110-
ref={ref}
111-
style={{ height: "600px" }}
112-
/>
113-
</PanelMainBody>
114-
</PanelMain>
115-
</Panel>
116-
</SplitItem>
117-
</Split>
113+
<FlexItem flex={{ default: "flex_1" }}>
114+
<Card isPlain>
115+
<CardHeader className="pdl-run-split-item-card-header">
116+
<CardTitle>Output</CardTitle>
117+
</CardHeader>
118+
<CardBody className="pdl-run-split-item-card-body">
119+
<div
120+
className="pdl-run-terminal"
121+
ref={ref}
122+
style={{ height: "600px" }}
123+
/>
124+
</CardBody>
125+
</Card>
126+
</FlexItem>
127+
</Flex>
118128

119129
<Toolbar>
120-
<ToolbarItem>
121-
<Button onClick={run}>Run</Button>
122-
</ToolbarItem>
130+
<ToolbarContent>
131+
<ToolbarItem>
132+
<Button onClick={run}>Run</Button>
133+
</ToolbarItem>
134+
</ToolbarContent>
123135
</Toolbar>
124136
</PageSection>
125137
</Page>

0 commit comments

Comments
 (0)