Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions src/components/Insights/InsightJiraTicket/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,35 @@ export const InsightJiraTicket = (props: InsightJiraTicketProps) => {
});
};

const handleInsightTicketLink = (data: unknown) => {
const linkTicketResponse = data as LinkTicketResponse;
useEffect(() => {
const handleInsightTicketLink = (data: unknown) => {
const linkTicketResponse = data as LinkTicketResponse;

if (linkTicketResponse.success) {
setTicketLink(linkTicketResponse.ticketLink);
} else {
setErrorMessage(linkTicketResponse.message);
}
if (linkTicketResponse.success) {
setTicketLink(linkTicketResponse.ticketLink);
} else {
setErrorMessage(linkTicketResponse.message);
}

window.sendMessageToDigma({
action: actions.GET_DATA
});
window.sendMessageToDigma({
action: actions.GET_DATA
});

props.onReloadSpanInsight && props.onReloadSpanInsight();
};
props.onReloadSpanInsight && props.onReloadSpanInsight();
};

dispatcher.addActionListener(
actions.SET_TICKET_LINK,
handleInsightTicketLink
);
dispatcher.addActionListener(
actions.SET_TICKET_LINK,
handleInsightTicketLink
);

return () => {
dispatcher.removeActionListener(
actions.SET_TICKET_LINK,
handleInsightTicketLink
);
};
}, []);

useEffect(() => {
if (props.relatedInsight) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/JiraTicket/Field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const Field = (props: FieldProps) => {
props.multiline === true ? "top" : "center";

return (
<s.Container>
<s.Container $selectable={props.selectable}>
<s.Label>{props.label}</s.Label>
<s.ContentContainer>
<s.Content ref={getContentRef} $multiline={props.multiline}>
Expand Down
5 changes: 3 additions & 2 deletions src/components/common/JiraTicket/Field/styles.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import styled from "styled-components";
import { redScale } from "../../../common/App/getTheme";
import { ButtonContainerProps, ContentProps } from "./types";
import { ButtonContainerProps, ContainerProps, ContentProps } from "./types";

export const Container = styled.div`
export const Container = styled.div<ContainerProps>`
display: flex;
flex-direction: column;
gap: 6px;
${({ $selectable }) => (!$selectable ? "user-select: none;" : "")}
`;

export const Label = styled.label`
Expand Down
5 changes: 5 additions & 0 deletions src/components/common/JiraTicket/Field/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface FieldProps {
button: ReactNode;
multiline?: boolean;
errorMessage?: string;
selectable?: boolean;
}

export interface ButtonContainerProps {
Expand All @@ -24,3 +25,7 @@ export interface ButtonContainerProps {
export interface ContentProps {
$multiline?: boolean;
}

export interface ContainerProps {
$selectable?: boolean;
}
2 changes: 2 additions & 0 deletions src/components/common/JiraTicket/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ export const JiraTicket = (props: JiraTicketProps) => {
onClick={() => copyToClipboard("summary", props.summary)}
/>
}
selectable={false}
/>
<Field
key={"description"}
label={"Description"}
multiline={true}
selectable={false}
content={
<div ref={descriptionContentRef}>
{props.description.isLoading ? (
Expand Down