diff --git a/e2e/tests/ui-driven/src/globalHelpers.ts b/e2e/tests/ui-driven/src/globalHelpers.ts index a6f8552b90..52be7509c0 100644 --- a/e2e/tests/ui-driven/src/globalHelpers.ts +++ b/e2e/tests/ui-driven/src/globalHelpers.ts @@ -139,7 +139,7 @@ export async function clickContinue({ export async function clickBack({ page }: { page: Page }) { const waitPromise = waitForDebugLog(page); // assume debug message is triggered on state transition - await page.getByRole("button", { name: "Back", exact: true }).click(); + await page.getByTestId("backButton").click(); await waitPromise; } @@ -193,7 +193,7 @@ export async function answerChecklist({ }); await expect(checklist).toBeVisible(); for (const answer of answers) { - await page.locator("label", { hasText: answer }).click(); + await page.getByLabel(answer, { exact: true }).click(); } } diff --git a/editor.planx.uk/src/@planx/components/shared/Preview/MoreInfo.tsx b/editor.planx.uk/src/@planx/components/shared/Preview/MoreInfo.tsx index f2e135bec9..2d6bd4edec 100644 --- a/editor.planx.uk/src/@planx/components/shared/Preview/MoreInfo.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Preview/MoreInfo.tsx @@ -1,8 +1,11 @@ import CloseIcon from "@mui/icons-material/Close"; +import Box from "@mui/material/Box"; import Container from "@mui/material/Container"; import Drawer, { DrawerProps } from "@mui/material/Drawer"; import IconButton from "@mui/material/IconButton"; import { styled } from "@mui/material/styles"; +import MoreInfoFeedbackComponent from "components/MoreInfoFeedback"; +import { hasFeatureFlag } from "lib/featureFlags"; import React from "react"; const PREFIX = "MoreInfo"; @@ -34,22 +37,22 @@ const Root = styled(Drawer, { [`& .${classes.drawerPaper}`]: { width: "100%", maxWidth: drawerWidth, - backgroundColor: theme.palette.background.default, + backgroundColor: theme.palette.background.paper, border: 0, boxShadow: "-4px 0 0 rgba(0,0,0,0.1)", }, })); -const DrawerContent = styled("div")(({ theme }) => ({ - padding: theme.spacing(2.5, 4, 6, 0), +const DrawerContent = styled(Box)(({ theme }) => ({ + padding: theme.spacing(2.5, 4, 2, 0), fontSize: "1rem", lineHeight: "1.5", [theme.breakpoints.up("sm")]: { - padding: theme.spacing(6, 4, 6, 1), + padding: theme.spacing(6, 4, 4, 1), }, })); -const CloseButton = styled("div")(({ theme }) => ({ +const CloseButton = styled(Box)(({ theme }) => ({ display: "flex", alignItems: "center", justifyContent: "flex-end", @@ -59,6 +62,8 @@ const CloseButton = styled("div")(({ theme }) => ({ color: theme.palette.text.primary, })); +const isUsingFeatureFlag = hasFeatureFlag("SHOW_INTERNAL_FEEDBACK"); + interface IMoreInfo { open: boolean; children: (JSX.Element | string | undefined)[] | JSX.Element; @@ -90,9 +95,10 @@ const MoreInfo: React.FC = ({ open, children, handleClose }) => ( - + {children} + {isUsingFeatureFlag && } ); diff --git a/editor.planx.uk/src/components/Feedback.tsx b/editor.planx.uk/src/components/Feedback.tsx new file mode 100644 index 0000000000..55623756f5 --- /dev/null +++ b/editor.planx.uk/src/components/Feedback.tsx @@ -0,0 +1,260 @@ +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import CloseIcon from "@mui/icons-material/Close"; +import LightbulbIcon from "@mui/icons-material/Lightbulb"; +import MoreHorizIcon from "@mui/icons-material/MoreHoriz"; +import WarningIcon from "@mui/icons-material/Warning"; +import Box from "@mui/material/Box"; +import Button from "@mui/material/Button"; +import Container from "@mui/material/Container"; +import IconButton from "@mui/material/IconButton"; +import { styled } from "@mui/material/styles"; +import Typography from "@mui/material/Typography"; +import { contentFlowSpacing } from "@planx/components/shared/Preview/Card"; +import FeedbackPhaseBanner from "components/FeedbackPhaseBanner"; +import { BackButton } from "pages/Preview/Questions"; +import React from "react"; +import FeedbackDisclaimer from "ui/public/FeedbackDisclaimer"; +import FeedbackOption from "ui/public/FeedbackOption"; +import InputLabel from "ui/public/InputLabel"; +import Input from "ui/shared/Input"; + +const FeedbackWrapper = styled(Box)(({ theme }) => ({ + backgroundColor: theme.palette.background.paper, + borderTop: `1px solid ${theme.palette.border.main}`, +})); + +const FeedbackRow = styled(Box)(({ theme }) => ({ + maxWidth: theme.breakpoints.values.formWrap, + padding: theme.spacing(2, 0, 4), +})); + +const FeedbackHeader = styled(Box)(({ theme }) => ({ + padding: theme.spacing(1, 0), + position: "relative", + display: "flex", + justifyContent: "space-between", + alignItems: "center", +})); + +const FeedbackTitle = styled(Box)(({ theme }) => ({ + position: "relative", + display: "flex", + alignItems: "center", + "& svg": { + width: "28px", + height: "auto", + color: theme.palette.primary.dark, + marginRight: theme.spacing(1), + }, +})); + +const CloseButton = styled("div")(({ theme }) => ({ + display: "flex", + alignItems: "center", + justifyContent: "flex-end", + color: theme.palette.text.primary, +})); + +const FeedbackBody = styled(Box)(({ theme }) => ({ + maxWidth: theme.breakpoints.values.formWrap, +})); + +const FeedbackForm = styled("form")(({ theme }) => ({ + "& > *": { + ...contentFlowSpacing(theme), + }, +})); + +const FeedbackComponent: React.FC = () => { + return ( + <> + + + + + + + + + + What would you like to share? + + + + + + + + + + + + + + + + + + + + + + + Back + + + + + + + + + + + Report an issue + + + + + + + + + + + + + + + + + + + + + + + + + Back + + + + + + + + + + + Share an idea + + + + + + + + + + + + + + + + + + + + Back + + + + + + + + + + + Share a comment + + + + + + + + + + + + + + + + + + + Thank you for sharing feedback + + + + + + + + + + We appreciate it lorem ipsum dolor sit amet, consectetuer + adipiscing elit. Aenean commodo ligula eget dolor. + + + + + + + ); +}; + +export default FeedbackComponent; diff --git a/editor.planx.uk/src/components/FeedbackPhaseBanner.tsx b/editor.planx.uk/src/components/FeedbackPhaseBanner.tsx new file mode 100644 index 0000000000..37809ce5e0 --- /dev/null +++ b/editor.planx.uk/src/components/FeedbackPhaseBanner.tsx @@ -0,0 +1,83 @@ +import Box from "@mui/material/Box"; +import Button from "@mui/material/Button"; +import Container from "@mui/material/Container"; +import Link from "@mui/material/Link"; +import { styled } from "@mui/material/styles"; +import Typography from "@mui/material/Typography"; +import React from "react"; + +const Root = styled(Box)(({ theme }) => ({ + width: "100%", + backgroundColor: theme.palette.background.paper, +})); + +const ReportButton = styled(Button)(({ theme }) => ({ + backgroundColor: theme.palette.common.white, + color: theme.palette.primary.main, + padding: "0.7em 1em", +})); + +const Inner = styled(Box)(({ theme }) => ({ + width: "100%", + display: "flex", + justifyContent: "space-between", + alignItems: "center", + flexWrap: "wrap", + padding: theme.spacing(0.75, 0), +})); + +const PhaseWrap = styled(Box)(({ theme }) => ({ + display: "flex", + justifyContent: "start", + alignItems: "start", + padding: theme.spacing(0.5, 1, 0.5, 0), +})); + +const BetaFlag = styled(Box)(({ theme }) => ({ + betaIcon: { + width: "100%", + [theme.breakpoints.up("sm")]: { + width: "auto", + marginRight: theme.spacing(2), + }, + }, +})); + +export default function FeedbackPhaseBanner(): FCReturn { + return ( + + + + + + PUBLIC BETA + + + This is a new service. Your feedback will help us + improve it. + + + Report an issue with this page + + + + ); +} diff --git a/editor.planx.uk/src/components/MoreInfoFeedback.tsx b/editor.planx.uk/src/components/MoreInfoFeedback.tsx new file mode 100644 index 0000000000..530f56a721 --- /dev/null +++ b/editor.planx.uk/src/components/MoreInfoFeedback.tsx @@ -0,0 +1,82 @@ +import CancelIcon from "@mui/icons-material/Cancel"; +import CheckCircleIcon from "@mui/icons-material/CheckCircle"; +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 { contentFlowSpacing } from "@planx/components/shared/Preview/Card"; +import React from "react"; +import FeedbackDisclaimer from "ui/public/FeedbackDisclaimer"; +import FeedbackOption from "ui/public/FeedbackOption"; +import Input from "ui/shared/Input"; + +const MoreInfoFeedback = styled(Box)(({ theme }) => ({ + borderTop: `2px solid ${theme.palette.border.main}`, + padding: theme.spacing(2.5, 4, 8, 0), + [theme.breakpoints.up("sm")]: { + padding: theme.spacing(3, 4, 8, 1), + }, +})); + +const FeedbackBody = styled(Box)(({ theme }) => ({ + padding: theme.spacing(1, 0), + "& form > * + *": { + ...contentFlowSpacing(theme), + }, +})); + +const MoreInfoFeedbackComponent: React.FC = () => { + return ( + <> + + + + Did this help to answer your question? + + + + + + + + + + + + Please help us to improve this service by sharing feedback + + +
+ + + + +
+
+
+ + + + + Thank you for sharing feedback + + + + We appreciate it lorem ipsum dolor sit amet, consectetuer + adipiscing elit. Aenean commodo ligula eget dolor. + + + + + + ); +}; + +export default MoreInfoFeedbackComponent; diff --git a/editor.planx.uk/src/lib/featureFlags.ts b/editor.planx.uk/src/lib/featureFlags.ts index 7bf56fbe6f..d676604615 100644 --- a/editor.planx.uk/src/lib/featureFlags.ts +++ b/editor.planx.uk/src/lib/featureFlags.ts @@ -2,6 +2,7 @@ const AVAILABLE_FEATURE_FLAGS = [ "DISABLE_SAVE_AND_RETURN", "SHOW_TEAM_SETTINGS", + "SHOW_INTERNAL_FEEDBACK", ] as const; type featureFlag = (typeof AVAILABLE_FEATURE_FLAGS)[number]; diff --git a/editor.planx.uk/src/pages/Preview/Questions.tsx b/editor.planx.uk/src/pages/Preview/Questions.tsx index 58b1dafaf7..5f83ef110a 100644 --- a/editor.planx.uk/src/pages/Preview/Questions.tsx +++ b/editor.planx.uk/src/pages/Preview/Questions.tsx @@ -23,7 +23,7 @@ const BackBar = styled(Box)(() => ({ zIndex: "1000", })); -const BackButton = styled(ButtonBase)(({ theme, hidden }) => ({ +export const BackButton = styled(ButtonBase)(({ theme, hidden }) => ({ visibility: "visible", pointerEvents: "auto", display: "flex", @@ -170,7 +170,11 @@ const Questions = ({ previewEnvironment }: QuestionsProps) => {