Skip to content

Commit 2c2fa8c

Browse files
authored
fix(web): pull request embed chip shows the state icon (pingdotgg#12951)
1 parent 33cb911 commit 2c2fa8c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎apps/web/src/components/contextChipParts.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "react";
1010

1111
import { cn } from "~/lib/utils";
12-
import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons";
12+
import { PULL_REQUEST_STATE_PRESENTATION } from "~/components/pullRequest/pullRequestIcons";
1313
import { PierreEntryIcon } from "./chat/PierreEntryIcon";
1414
import {
1515
COMPOSER_INLINE_CHIP_ICON_CLASS_NAME,
@@ -123,6 +123,9 @@ export function PullRequestChip(props: {
123123
onOpen: (event: MouseEvent<HTMLElement>, url: string) => void;
124124
}) {
125125
const previewTarget = usePullRequestPreviewTarget(props.environmentId, props.metadata.url);
126+
const displayState =
127+
props.metadata.state === "open" && props.metadata.isDraft ? "draft" : props.metadata.state;
128+
const StateIcon = PULL_REQUEST_STATE_PRESENTATION[displayState].Icon;
126129
const button = (
127130
<Button
128131
variant="chip"
@@ -136,9 +139,7 @@ export function PullRequestChip(props: {
136139
data-markdown-copy={props.copyMarkdown}
137140
onClick={(event) => props.onOpen(event, props.metadata.url)}
138141
>
139-
<PullRequestGlyph.pullRequest
140-
className={cn(COMPOSER_INLINE_CHIP_ICON_CLASS_NAME, "size-3.5")}
141-
/>
142+
<StateIcon className={cn(COMPOSER_INLINE_CHIP_ICON_CLASS_NAME, "size-3.5")} />
142143
<span className={props.labelClassName}>{props.label}</span>
143144
</Button>
144145
);

0 commit comments

Comments
 (0)