From c2836035c6e04d2a6f19427c013b4c8cf677be7c Mon Sep 17 00:00:00 2001
From: Ian Jones <51156018+ianjon3s@users.noreply.github.com>
Date: Wed, 17 Jan 2024 16:33:46 +0000
Subject: [PATCH 01/13] feat: Apply theme colours across app (#2658)
---
.../src/@planx/components/Content/Public.tsx | 2 +-
.../@planx/components/FileUploadAndLabel/Modal.tsx | 4 +++-
.../@planx/components/FileUploadAndLabel/Public.tsx | 1 -
.../src/@planx/components/Notice/Public.tsx | 12 ++++++++----
.../src/@planx/components/shared/Preview/Card.tsx | 2 +-
.../components/shared/PrivateFileUpload/Dropzone.tsx | 2 +-
editor.planx.uk/src/theme.ts | 4 ++--
editor.planx.uk/src/ui/public/NextStepsList.tsx | 7 ++++---
8 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/editor.planx.uk/src/@planx/components/Content/Public.tsx b/editor.planx.uk/src/@planx/components/Content/Public.tsx
index a000dd16b9..c583a111c8 100644
--- a/editor.planx.uk/src/@planx/components/Content/Public.tsx
+++ b/editor.planx.uk/src/@planx/components/Content/Public.tsx
@@ -20,7 +20,7 @@ const Content = styled(Box, {
theme.palette.text.primary,
])?.toHexString() || theme.palette.text.primary,
"& a": {
- color: getContrastTextColor(color || "#fff", theme.palette.primary.main),
+ color: getContrastTextColor(color || "#fff", theme.palette.link.main),
},
"& *:first-child": {
marginTop: 0,
diff --git a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Modal.tsx b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Modal.tsx
index fcac2b3a9e..db5aafc6e1 100644
--- a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Modal.tsx
+++ b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Modal.tsx
@@ -115,6 +115,7 @@ export const FileTaggingModal = ({
)}
@@ -138,7 +138,7 @@ const DesignSettings: React.FC = () => {
<>
setOpen(true)} />
setOpen(true)} />
-
+ setOpen(true)} />
Date: Thu, 18 Jan 2024 14:00:50 +0000
Subject: [PATCH 05/13] feat: UI setup for feedback component hidden behind
feature flag (#2632)
* wip: UI setup for feedback component
* fix: Back button test ID
* fix: Orphaned form labels
* fix: Tests for E2E
* fix: Tests for E2E
* feat: add new feature flag for the internal feedback feature
* feat: conditionally render feedback footer content
* feat: conditionally render the new MoreInfo feedback content
* chore: add todo as per feedback
* chore: make feature flag check static
---------
Co-authored-by: Mike Heneghan
---
e2e/tests/ui-driven/src/globalHelpers.ts | 4 +-
.../components/shared/Preview/MoreInfo.tsx | 18 +-
editor.planx.uk/src/components/Feedback.tsx | 260 ++++++++++++++++++
.../src/components/FeedbackPhaseBanner.tsx | 83 ++++++
.../src/components/MoreInfoFeedback.tsx | 82 ++++++
editor.planx.uk/src/lib/featureFlags.ts | 1 +
.../src/pages/Preview/Questions.tsx | 8 +-
.../src/pages/layout/PublicLayout.tsx | 7 +-
editor.planx.uk/src/theme.ts | 2 +-
.../src/ui/public/FeedbackDisclaimer.tsx | 16 ++
.../src/ui/public/FeedbackOption.tsx | 79 ++++++
11 files changed, 548 insertions(+), 12 deletions(-)
create mode 100644 editor.planx.uk/src/components/Feedback.tsx
create mode 100644 editor.planx.uk/src/components/FeedbackPhaseBanner.tsx
create mode 100644 editor.planx.uk/src/components/MoreInfoFeedback.tsx
create mode 100644 editor.planx.uk/src/ui/public/FeedbackDisclaimer.tsx
create mode 100644 editor.planx.uk/src/ui/public/FeedbackOption.tsx
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
+
+
+
+
+
+
+
+
+
+
+
+
+ Send feedback
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back
+
+
+
+
+
+
+
+
+
+
+ Share an idea
+
+
+
+
+
+
+
+ Send feedback
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Back
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Send feedback
+
+
+
+
+
+
+
+
+
+
+
+
+ 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) => {
- goBack()}>
+ goBack()}
+ >
Back
diff --git a/editor.planx.uk/src/pages/layout/PublicLayout.tsx b/editor.planx.uk/src/pages/layout/PublicLayout.tsx
index 9aa2c552b9..f0b4be5d3c 100644
--- a/editor.planx.uk/src/pages/layout/PublicLayout.tsx
+++ b/editor.planx.uk/src/pages/layout/PublicLayout.tsx
@@ -7,7 +7,9 @@ import {
} from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import ErrorFallback from "components/ErrorFallback";
+import Feedback from "components/Feedback";
import PhaseBanner from "components/PhaseBanner";
+import { hasFeatureFlag } from "lib/featureFlags";
import { useStore } from "pages/FlowEditor/lib/store";
import React, { PropsWithChildren } from "react";
import { ErrorBoundary } from "react-error-boundary";
@@ -62,9 +64,12 @@ const PublicFooter: React.FC = () => {
(item): item is { title: string; href: string; bold: boolean } =>
Boolean(item),
);
+
+ const isUsingFeatureFlag = hasFeatureFlag("SHOW_INTERNAL_FEEDBACK");
+
return (
-
+ {isUsingFeatureFlag ? : }