-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Summary In this PR, a new setting has been introduced for the status check feature. By default this setting will be turned off and there is a short description that it may not be completely accurate. More details on why it is labeled as an "experimental" feature is described in #59 ### Changes - Added a new hook along with extension methods to save and fetch the configured setting from storage - Hook is used in the <PRDisplay /> component and passed to each of the <PullRequest /> components - Updates in <PullRequest /> components to make use of the new setting
- Loading branch information
Showing
6 changed files
with
136 additions
and
11 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
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,59 @@ | ||
import Stack from "@mui/material/Stack"; | ||
import Typography from "@mui/material/Typography"; | ||
import CircularProgress from "@mui/material/CircularProgress"; | ||
import Switch from "@mui/material/Switch"; | ||
import React from "react"; | ||
import { saveStatusChecksSetting } from "../../../data/extension"; | ||
import { useGetStatusChecksSetting } from "../../hooks"; | ||
import Card from "../Card/Card"; | ||
|
||
export default function StatusChecksSettingCard() { | ||
const [statusCheckSetting, setStatusCheckSetting, statusCheckLoading] = | ||
useGetStatusChecksSetting(); | ||
|
||
return ( | ||
<Card sx={{ bgcolor: "white" }}> | ||
<Stack | ||
width="100%" | ||
direction="row" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
paddingX={1} | ||
> | ||
<Typography variant="body2" textAlign="left"> | ||
Status Checks | ||
</Typography> | ||
{statusCheckLoading && ( | ||
<Stack sx={{ alignItems: "center", height: "42px" }}> | ||
<CircularProgress /> | ||
</Stack> | ||
)} | ||
{!statusCheckLoading && ( | ||
<Switch | ||
checked={statusCheckSetting} | ||
onChange={(e) => { | ||
setStatusCheckSetting(e.target.checked); | ||
saveStatusChecksSetting(e.target.checked).catch((error: any) => { | ||
console.error("Failed to set the status check setting", error); | ||
}); | ||
}} | ||
inputProps={{ "aria-label": "status-check-setting" }} | ||
/> | ||
)} | ||
</Stack> | ||
|
||
<Stack padding={1}> | ||
<Typography variant="caption"> | ||
Turn this on if you want to see the status checks for each pull | ||
request | ||
</Typography> | ||
<br /> | ||
<Typography variant="caption"> | ||
This is an experimental feature and the status check reported may not | ||
be completely accurate if third party / external tools are used for | ||
status checks | ||
</Typography> | ||
</Stack> | ||
</Card> | ||
); | ||
} |
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