Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Add story
Browse files Browse the repository at this point in the history
  • Loading branch information
sophstad committed Nov 28, 2023
1 parent a27c0fc commit 685f471
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import WithToastContext from "test_utils/toast-decorator";
import { CustomMeta, CustomStoryObj } from "test_utils/types";
import CustomCreatedTickets from "./CustomCreatedTickets";

export default {
component: CustomCreatedTickets,
decorators: [(Story: () => JSX.Element) => WithToastContext(Story)],
} satisfies CustomMeta<typeof CustomCreatedTickets>;

export const Default: CustomStoryObj<typeof CustomCreatedTickets> = {
render: (args) => <CustomCreatedTickets {...args} />,
argTypes: {},
args: {
execution: 0,
taskId: "123",
tickets: [
{
confidenceScore: 0.25,
issueKey: "DEVPROD-1",
jiraTicket: {
key: "key",
fields: {
summary: "Issue Summary",
status: {
id: "id",
name: "Done",
},
created: "2020-01-27",
updated: "2023-11-28",
assigneeDisplayName: "sophie.stadler",
assignedTeam: "evg-ui",
},
},
url: "https://spruce.mongodb.com",
},
{
confidenceScore: 0.5,
issueKey: "DEVPROD-2",
jiraTicket: {
key: "key",
fields: {
summary: "Issue Summary",
status: {
id: "id",
name: "In Progress",
},
created: "2020-01-28",
updated: "2023-11-29",
assigneeDisplayName: "mohamed.khelif",
assignedTeam: "evg-ui",
},
},
url: "https://spruce.mongodb.com",
},
],
},
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import styled from "@emotion/styled";
import { size } from "constants/tokens";
import { IssueLink } from "gql/generated/types";
import { AnnotationTicketRow } from "../AnnotationTicketsTable/AnnotationTicketRow";
import { TicketsTitle } from "../BBComponents";
Expand All @@ -19,19 +21,27 @@ const CustomCreatedTickets: React.FC<CustomCreatedTicketProps> = ({
<FileTicketButton taskId={taskId} execution={execution} />
{tickets?.length > 0 && (
<>
<TicketsTitle>Tickets Created From This Task</TicketsTitle>
{tickets.map(({ confidenceScore, issueKey, jiraTicket, url }) => (
<AnnotationTicketRow
confidenceScore={confidenceScore}
issueKey={issueKey}
jiraTicket={jiraTicket}
key={issueKey}
url={url}
/>
))}
<TicketsTitle margin>Tickets Created From This Task</TicketsTitle>
<TicketContainer>
{tickets.map(({ confidenceScore, issueKey, jiraTicket, url }) => (
<AnnotationTicketRow
confidenceScore={confidenceScore}
issueKey={issueKey}
jiraTicket={jiraTicket}
key={issueKey}
url={url}
/>
))}
</TicketContainer>
</>
)}
</>
);

const TicketContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${size.s};
`;

export default CustomCreatedTickets;

0 comments on commit 685f471

Please sign in to comment.