Skip to content

Commit

Permalink
Clean up ticket issue
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Nov 27, 2023
1 parent 7fecfd9 commit 77ab1a3
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions client/src/app/pages/migration-waves/components/ticket-issue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,33 @@ import { Text, TextVariants } from "@patternfly/react-core";
import { Ticket } from "@app/api/models";
import { useTranslation } from "react-i18next";
import ExternalLink from "@app/components/ExternalLink";
import { useTrackerTypesByProjectId } from "@app/queries/trackers";

export interface ITicketIssueProps {
ticket?: Ticket;
}

export const TicketIssue: React.FC<ITicketIssueProps> = ({ ticket }) => {
const { t } = useTranslation();
const ticketIssue = useTicketIssue(ticket);

return (
<>
<Text component={TextVariants.p}>
{ticket?.link ? (
<ExternalLink href={ticket.link}>{ticket?.link}</ExternalLink>
) : (
t("terms.unassigned")
)}
</Text>
</>
<Text component={TextVariants.p}>
{ticket?.link ? (
<ExternalLink href={ticket.link}>{ticketIssue}</ExternalLink>
) : (
t("terms.unassigned")
)}
</Text>
);
};

const useTicketIssue = (ticket?: Ticket) => {
const types = useTrackerTypesByProjectId(
ticket?.tracker?.name,
ticket?.parent
);
const type = types.find((kind) => kind.id === ticket?.kind);

return type ? type.name : "";
};

0 comments on commit 77ab1a3

Please sign in to comment.