Skip to content

Commit

Permalink
using new setting in prdisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
syj67507 committed May 28, 2024
1 parent af2dceb commit 4118a3c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/popup/components/PRDisplay/RepoSection/PullRequest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ interface PullRequestProps {
* repo that this pull request is associated with
*/
isJiraConfigured: boolean;
statusChecksSetting: boolean;
}

export default function PullRequest({
pr,
isJiraConfigured,
statusChecksSetting,
}: PullRequestProps) {
return (
<Stack
Expand All @@ -49,17 +51,21 @@ export default function PullRequest({
<Typography variant="caption" fontStyle="italic">
{pr.username}
</Typography>
<Box
onClick={() => {
createTab(pr.checksUrl).catch(() => {
console.error(`Failed to create tab with url ${pr.checksUrl}`);
});
}}
>
{pr.checksState === "SUCCESS" && <SuccessStatusChecksIcon />}
{pr.checksState === "FAILURE" && <FailedStatusChecksIcon />}
{pr.checksState === "PENDING" && <PendingStatusChecksIcon />}
</Box>
{statusChecksSetting && (
<Box
onClick={() => {
createTab(pr.checksUrl).catch(() => {
console.error(
`Failed to create tab with url ${pr.checksUrl}`
);
});
}}
>
{pr.checksState === "SUCCESS" && <SuccessStatusChecksIcon />}
{pr.checksState === "FAILURE" && <FailedStatusChecksIcon />}
{pr.checksState === "PENDING" && <PendingStatusChecksIcon />}
</Box>
)}
</Stack>
<Typography
variant="caption"
Expand Down
3 changes: 3 additions & 0 deletions src/popup/components/PRDisplay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useGetAnimatedExpandSetting,
useGetHeaderClickBehavior,
useGetPullRequests,
useGetStatusChecksSetting,
useSavedFilters,
} from "../../hooks";

Expand All @@ -20,6 +21,7 @@ export default function PRDisplay() {
const { loading, data, username, token } = useGetPullRequests();
const [headerClickBehavior] = useGetHeaderClickBehavior();
const [animatedExpandSetting] = useGetAnimatedExpandSetting();
const [statusChecksSetting] = useGetStatusChecksSetting();

return (
<Stack width="100%" bgcolor="whitesmoke" padding={1} spacing={1}>
Expand Down Expand Up @@ -85,6 +87,7 @@ export default function PRDisplay() {
key={pr.url}
pr={pr}
isJiraConfigured={repo.isJiraConfigured}
statusChecksSetting={statusChecksSetting}
/>
))
: filtered.length === 0 && <NoPullRequest url={repo.url} />}
Expand Down

0 comments on commit 4118a3c

Please sign in to comment.