-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(promts): skeleton UI for promts (#5726)
* wip * WIP * WIP * add the prompt type * add initial listing * feat: temporary prompt * final changes * add aria role
- Loading branch information
1 parent
72ca917
commit 12901fd
Showing
18 changed files
with
1,300 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from "react"; | ||
import { useLoaderData } from "react-router"; | ||
|
||
import { Flex, Heading, View } from "@arizeai/components"; | ||
|
||
import { promptLoaderQuery$data } from "./__generated__/promptLoaderQuery.graphql"; | ||
|
||
export function PromptPage() { | ||
const loaderData = useLoaderData() as promptLoaderQuery$data; | ||
return ( | ||
<Flex direction="column" height="100%"> | ||
<View | ||
padding="size-200" | ||
borderBottomWidth="thin" | ||
borderBottomColor="dark" | ||
flex="none" | ||
> | ||
<Flex direction="row" justifyContent="space-between"> | ||
<Heading level={1}>{loaderData.prompt.name}</Heading> | ||
</Flex> | ||
</View> | ||
</Flex> | ||
); | ||
} |
112 changes: 112 additions & 0 deletions
112
app/src/pages/prompt/__generated__/promptLoaderQuery.graphql.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./promptLoader"; | ||
export * from "./PromptPage"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { fetchQuery, graphql } from "react-relay"; | ||
import { LoaderFunctionArgs } from "react-router-dom"; | ||
|
||
import RelayEnvironment from "@phoenix/RelayEnvironment"; | ||
|
||
import { promptLoaderQuery } from "./__generated__/promptLoaderQuery.graphql"; | ||
|
||
/** | ||
* Loads in the necessary page data for the dataset page | ||
*/ | ||
export async function promptLoader(args: LoaderFunctionArgs) { | ||
const { promptId } = args.params; | ||
return await fetchQuery<promptLoaderQuery>( | ||
RelayEnvironment, | ||
graphql` | ||
query promptLoaderQuery($id: GlobalID!) { | ||
prompt: node(id: $id) { | ||
__typename | ||
id | ||
... on Prompt { | ||
name | ||
} | ||
} | ||
} | ||
`, | ||
{ | ||
id: promptId as string, | ||
} | ||
).toPromise(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from "react"; | ||
import { useLoaderData } from "react-router"; | ||
|
||
import { Button, Flex, Heading, Icon, Icons, View } from "@arizeai/components"; | ||
|
||
import { promptsLoaderQuery$data } from "./__generated__/promptsLoaderQuery.graphql"; | ||
import { PromptsTable } from "./PromptsTable"; | ||
|
||
export function PromptsPage() { | ||
const loaderData = useLoaderData() as promptsLoaderQuery$data; | ||
return ( | ||
<Flex direction="column" height="100%"> | ||
<View | ||
padding="size-200" | ||
borderBottomWidth="thin" | ||
borderBottomColor="dark" | ||
flex="none" | ||
> | ||
<Flex direction="row" justifyContent="space-between"> | ||
<Heading level={1}>Prompts</Heading> | ||
<Button | ||
variant="default" | ||
size="compact" | ||
icon={<Icon svg={<Icons.PlusOutline />} />} | ||
> | ||
Prompt Template | ||
</Button> | ||
</Flex> | ||
</View> | ||
<PromptsTable query={loaderData} /> | ||
</Flex> | ||
); | ||
} |
Oops, something went wrong.