-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Gkrumbach07/issue-tracker
added issue tracker
- Loading branch information
Showing
11 changed files
with
3,593 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import IssueTracker from '../../src/components/IssueTracker/IssueTracker'; | ||
|
||
<IssueTracker/> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { getDate } from "./getIssueStep"; | ||
import { Label } from "@patternfly/react-core"; | ||
import React, { useMemo } from "react"; | ||
|
||
export const IssueEvent = ({ event, ...props }) => { | ||
const statusLabel = useMemo(() => { | ||
const status = (() => { | ||
if (event?.source?.issue.state === "open") { | ||
return ["green", "OPEN"]; | ||
} else if (event?.source?.issue?.pull_request) { | ||
if (event?.source?.issue?.pull_request?.merged_at) { | ||
return ["purple", "MERGED"]; | ||
} else { | ||
return ["red", "CLOSED"]; | ||
} | ||
} else { | ||
return ["purple", "CLOSED"]; | ||
} | ||
})(); | ||
|
||
return ( | ||
<Label style={{ marginRight: "1rem" }} color={status[0]}> | ||
{status[1]} | ||
</Label> | ||
); | ||
}, [event]); | ||
|
||
return ( | ||
<div {...props} style={{ marginTop: ".5rem", marginBottom: ".5rem" }}> | ||
<div style={{ fontSize: "small", color: "gray" }}> | ||
<b>@{event?.source?.issue?.user?.login}</b> | ||
{" mentioned this issue on "} | ||
{getDate(event?.source?.issue?.created_at)} | ||
</div> | ||
<div | ||
style={{ | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
}} | ||
> | ||
<a | ||
style={{ color: "black" }} | ||
href={event?.source?.issue?.html_url} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
>{`#${event?.source?.issue.number} ${event?.source?.issue.title}`}</a> | ||
{statusLabel} | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.