-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: show warning and skip Send event creation if `DISABLE_SAVE_AND_R…
…ETURN` feature flag is enabled (#2416)
- Loading branch information
1 parent
2b0f6af
commit 07f57d1
Showing
4 changed files
with
87 additions
and
3 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,54 @@ | ||
import ReportIcon from "@mui/icons-material/Report"; | ||
import Box from "@mui/material/Box"; | ||
import Button from "@mui/material/Button"; | ||
import Container from "@mui/material/Container"; | ||
import { styled } from "@mui/material/styles"; | ||
import Typography from "@mui/material/Typography"; | ||
import { hasFeatureFlag } from "lib/featureFlags"; | ||
import React, { useState } from "react"; | ||
|
||
const TestEnvironmentWarning = styled(Box)(({ theme }) => ({ | ||
display: "flex", | ||
backgroundColor: theme.palette.background.paper, | ||
color: theme.palette.text.primary, | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
padding: "0.2em 0", | ||
})); | ||
|
||
const FeatureFlagBanner: React.FC = () => { | ||
const [showWarning, setShowWarning] = useState(true); | ||
|
||
const isUsingFeatureFlag = () => hasFeatureFlag("DISABLE_SAVE_AND_RETURN"); | ||
|
||
return ( | ||
<> | ||
{isUsingFeatureFlag() && showWarning && ( | ||
<TestEnvironmentWarning> | ||
<Container | ||
maxWidth={false} | ||
sx={{ | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
}} | ||
> | ||
<Box display="flex" alignItems="center"> | ||
<ReportIcon color="error" /> | ||
<Typography variant="body2" ml={1}> | ||
You have <strong>disabled save and return</strong> via feature | ||
flag. This means you cannot save or submit your test | ||
applications. | ||
</Typography> | ||
</Box> | ||
<Button size="small" onClick={() => setShowWarning(false)}> | ||
Hide | ||
</Button> | ||
</Container> | ||
</TestEnvironmentWarning> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default FeatureFlagBanner; |
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