-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(annotations): annotations UI (#3914)
* WIP WIP WIP WIP WIP add delete annotation functionality WIP lint errors WIP * wire up the new span annotation form * WIP * WIP * add a border * cleanup
- Loading branch information
1 parent
42a6314
commit cd1a48f
Showing
14 changed files
with
1,496 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from "react"; | ||
|
||
import { ActionMenu, Flex, Icon, Icons, Item, Text } from "@arizeai/components"; | ||
|
||
type AnnotationActionMenuProps = { | ||
onDelete: () => void; | ||
isDisabled?: boolean; | ||
}; | ||
|
||
enum AnnotationAction { | ||
DELETE = "deleteAnnotation", | ||
} | ||
|
||
/** | ||
* A generic action menu for annotations that can be extended | ||
*/ | ||
export function AnnotationActionMenu(props: AnnotationActionMenuProps) { | ||
const { onDelete, isDisabled = false } = props; | ||
return ( | ||
<div | ||
// TODO: add this logic to the ActionMenu component | ||
onClick={(e) => { | ||
// prevent parent anchor link from being followed | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
}} | ||
> | ||
<ActionMenu | ||
align="end" | ||
buttonSize="compact" | ||
isDisabled={isDisabled} | ||
onAction={(action) => { | ||
switch (action) { | ||
case AnnotationAction.DELETE: | ||
onDelete(); | ||
break; | ||
} | ||
}} | ||
> | ||
<Item key={AnnotationAction.DELETE}> | ||
<Flex | ||
direction="row" | ||
gap="size-75" | ||
justifyContent="start" | ||
alignItems="center" | ||
> | ||
<Icon svg={<Icons.TrashOutline />} /> | ||
<Text>Delete</Text> | ||
</Flex> | ||
</Item> | ||
</ActionMenu> | ||
</div> | ||
); | ||
} |
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,38 @@ | ||
import React, { ReactNode, useState } from "react"; | ||
|
||
import { Button, DialogContainer, Icon, Icons } from "@arizeai/components"; | ||
|
||
import { EditSpanAnnotationsDialog } from "./EditSpanAnnotationsDialog"; | ||
|
||
export function EditSpanAnnotationsButton(props: { | ||
spanNodeId: string; | ||
projectId: string; | ||
}) { | ||
const { spanNodeId, projectId } = props; | ||
const [dialog, setDialog] = useState<ReactNode>(null); | ||
return ( | ||
<> | ||
<Button | ||
variant="default" | ||
icon={<Icon svg={<Icons.EditOutline />} />} | ||
onClick={() => | ||
setDialog( | ||
<EditSpanAnnotationsDialog | ||
spanNodeId={spanNodeId} | ||
projectId={projectId} | ||
/> | ||
) | ||
} | ||
> | ||
Annotate | ||
</Button> | ||
<DialogContainer | ||
type="slideOver" | ||
isDismissable | ||
onDismiss={() => setDialog(null)} | ||
> | ||
{dialog} | ||
</DialogContainer> | ||
</> | ||
); | ||
} |
Oops, something went wrong.