fix(web): pull request embed chip shows the state icon (#12951)
This commit is contained in:
1 parent
33cb911ceb
commit
2c2fa8cd7d
1 file changed
+5
-4
@@ -9,7 +9,7 @@ import {
|
||||
} from "react";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons";
|
||||
import { PULL_REQUEST_STATE_PRESENTATION } from "~/components/pullRequest/pullRequestIcons";
|
||||
import { PierreEntryIcon } from "./chat/PierreEntryIcon";
|
||||
import {
|
||||
COMPOSER_INLINE_CHIP_ICON_CLASS_NAME,
|
||||
@@ -123,6 +123,9 @@ export function PullRequestChip(props: {
|
||||
onOpen: (event: MouseEvent<HTMLElement>, url: string) => void;
|
||||
}) {
|
||||
const previewTarget = usePullRequestPreviewTarget(props.environmentId, props.metadata.url);
|
||||
const displayState =
|
||||
props.metadata.state === "open" && props.metadata.isDraft ? "draft" : props.metadata.state;
|
||||
const StateIcon = PULL_REQUEST_STATE_PRESENTATION[displayState].Icon;
|
||||
const button = (
|
||||
<Button
|
||||
variant="chip"
|
||||
@@ -136,9 +139,7 @@ export function PullRequestChip(props: {
|
||||
data-markdown-copy={props.copyMarkdown}
|
||||
onClick={(event) => props.onOpen(event, props.metadata.url)}
|
||||
>
|
||||
<PullRequestGlyph.pullRequest
|
||||
className={cn(COMPOSER_INLINE_CHIP_ICON_CLASS_NAME, "size-3.5")}
|
||||
/>
|
||||
<StateIcon className={cn(COMPOSER_INLINE_CHIP_ICON_CLASS_NAME, "size-3.5")} />
|
||||
<span className={props.labelClassName}>{props.label}</span>
|
||||
</Button>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user