-
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.
added a new settings card for the status checks
- Loading branch information
Showing
4 changed files
with
116 additions
and
0 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,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