Skip to content

Commit aea1003

Browse files
committed
fix: refine welcome page content in react ui
Signed-off-by: Nick Mitchell <[email protected]>
1 parent 7fd5ef4 commit aea1003

File tree

10 files changed

+205
-18
lines changed

10 files changed

+205
-18
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ import "./Page.css"
1919

2020
const notFilled = { isFilled: false }
2121
const withPadding = { default: "padding" as const }
22+
const withoutPadding = { default: "noPadding" as const }
2223

2324
type Props = PropsWithChildren<
2425
PageBreadcrumbProps & {
26+
/** Should the page content use default padding? [default: true] */
27+
padding?: boolean
28+
2529
/** The trace content */
2630
value?: string
2731
}
@@ -35,7 +39,7 @@ export default function PDLPage(props: Props) {
3539
const [searchParams] = useSearchParams()
3640
const showingDetail = searchParams.has("detail")
3741

38-
const { value, children } = props
42+
const { padding = true, value, children } = props
3943

4044
return (
4145
<Page
@@ -58,7 +62,10 @@ export default function PDLPage(props: Props) {
5862
breadcrumb={<PageBreadcrumbs {...props} />}
5963
>
6064
{children && (
61-
<PageSection padding={withPadding} aria-label="Non-viewer content">
65+
<PageSection
66+
padding={padding ? withPadding : withoutPadding}
67+
aria-label="Non-viewer content"
68+
>
6269
{children}
6370
</PageSection>
6471
)}

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

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Content } from "@patternfly/react-core"
2+
3+
export default function Intro() {
4+
return (
5+
<Content component="p" isEditorial>
6+
PDL is a declarative language designed for developers to create reliable,
7+
composable LLM prompts and integrate them into software systems. It
8+
provides a structured way to specify prompt templates, enforce validation,
9+
and compose LLM calls with traditional rule-based systems.
10+
</Content>
11+
)
12+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { Button, Content, Flex } from "@patternfly/react-core"
2+
3+
import ExternalLinkSquareAltIcon from "@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon"
4+
5+
export default function Links() {
6+
return (
7+
<Content component="p">
8+
<Flex>
9+
<Button
10+
variant="link"
11+
icon={<ExternalLinkSquareAltIcon />}
12+
iconPosition="end"
13+
>
14+
<a
15+
target="_blank"
16+
href="https://ibm.github.io/prompt-declaration-language"
17+
>
18+
Home Page
19+
</a>
20+
</Button>
21+
<Button
22+
variant="link"
23+
icon={<ExternalLinkSquareAltIcon />}
24+
iconPosition="end"
25+
>
26+
<a
27+
target="_blank"
28+
href="https://github.com/IBM/prompt-declaration-language"
29+
>
30+
GitHub
31+
</a>
32+
</Button>
33+
</Flex>
34+
</Content>
35+
)
36+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Gallery } from "@patternfly/react-core"
2+
3+
import Demos from "./tiles/Demos"
4+
import Upload from "./tiles/Upload"
5+
import MyTraces from "./tiles/MyTraces"
6+
7+
export default function Tiles() {
8+
return (
9+
<Gallery hasGutter>
10+
<Upload />
11+
<MyTraces />
12+
<Demos />
13+
</Gallery>
14+
)
15+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import {
2+
Panel,
3+
PanelHeader,
4+
PanelMain,
5+
PanelMainBody,
6+
Title,
7+
} from "@patternfly/react-core"
8+
import Page from "../Page"
9+
10+
import Intro from "./Intro"
11+
import Links from "./Links"
12+
import Tiles from "./Tiles"
13+
14+
export default function Welcome() {
15+
return (
16+
<Page breadcrumb1="Welcome" padding={false}>
17+
<Panel>
18+
<PanelHeader>
19+
<Title headingLevel="h1">Prompt Declaration Language (PDL)</Title>
20+
</PanelHeader>
21+
22+
<PanelMain>
23+
<PanelMainBody>
24+
<Intro />
25+
<Links />
26+
<Tiles />
27+
</PanelMainBody>
28+
</PanelMain>
29+
</Panel>
30+
</Page>
31+
)
32+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Link } from "react-router"
2+
import {
3+
Button,
4+
Card,
5+
CardBody,
6+
CardFooter,
7+
CardHeader,
8+
CardTitle,
9+
Flex,
10+
} from "@patternfly/react-core"
11+
12+
import demos from "../../../demos/demos"
13+
14+
export default function Demos() {
15+
return (
16+
<Card isLarge>
17+
<CardHeader>
18+
<CardTitle>View a Demo</CardTitle>
19+
</CardHeader>
20+
<CardBody>You may view one of the built-in PDL demos.</CardBody>
21+
<CardFooter>
22+
<Flex>
23+
{demos.map((demo) => (
24+
<Button key={demo.name} isInline variant="link">
25+
<Link to={"/demos/" + encodeURIComponent(demo.name)}>
26+
{demo.name}
27+
</Link>
28+
</Button>
29+
))}
30+
</Flex>
31+
</CardFooter>
32+
</Card>
33+
)
34+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Link } from "react-router"
2+
import {
3+
Button,
4+
Card,
5+
CardBody,
6+
CardFooter,
7+
CardHeader,
8+
CardTitle,
9+
Flex,
10+
} from "@patternfly/react-core"
11+
12+
import { getMyTraces } from "../../MyTraces"
13+
14+
export default function MyTraces() {
15+
const myTraces = getMyTraces()
16+
17+
return (
18+
myTraces.length > 0 && (
19+
<Card isLarge>
20+
<CardHeader>
21+
<CardTitle>My Traces</CardTitle>
22+
</CardHeader>
23+
<CardBody>
24+
You may view one of your previously uploaded traces.
25+
</CardBody>
26+
<CardFooter>
27+
<Flex>
28+
{myTraces.map(({ title, filename }) => (
29+
<Button key={filename} isInline variant="link">
30+
<Link to={"/my/" + encodeURIComponent(title)}>{title}</Link>
31+
</Button>
32+
))}
33+
</Flex>
34+
</CardFooter>
35+
</Card>
36+
)
37+
)
38+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Link } from "react-router"
2+
import {
3+
Button,
4+
Card,
5+
CardBody,
6+
CardFooter,
7+
CardHeader,
8+
CardTitle,
9+
} from "@patternfly/react-core"
10+
11+
export default function Upload() {
12+
return (
13+
<Card isLarge>
14+
<CardHeader>
15+
<CardTitle>Upload Trace</CardTitle>
16+
</CardHeader>
17+
<CardBody>
18+
You may upload a trace from your computer to visualize the program
19+
execution.
20+
</CardBody>
21+
<CardFooter>
22+
<Button isInline variant="link">
23+
<Link to="/upload">Choose Trace File</Link>
24+
</Button>
25+
</CardFooter>
26+
</Card>
27+
)
28+
}

pdl-live-react/src/routes/PdlRoutes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Demo = lazy(() => import("../page/Demo"))
55
const About = lazy(() => import("../page/About"))
66
const Local = lazy(() => import("../page/Local"))
77
const MyTrace = lazy(() => import("../page/MyTrace"))
8-
const Welcome = lazy(() => import("../page/Welcome"))
8+
const Welcome = lazy(() => import("../page/welcome/Welcome"))
99
const Uploader = lazy(() => import("../page/Uploader"))
1010
const PageNotFound = lazy(() => import("../page/PageNotFound"))
1111

0 commit comments

Comments
 (0)