Skip to content

Commit

Permalink
Change feedback field to userComment
Browse files Browse the repository at this point in the history
  • Loading branch information
jamdelion committed Nov 11, 2024
1 parent 0aba609 commit aa19903
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,5 @@ type Story = StoryObj<typeof meta>;
export default meta;

export const Basic = {
args: {
title: defaultContent.title,
feedbackRequired: false,
description: defaultContent.description,
freeformQuestion: defaultContent.freeformQuestion,
ratingQuestion: defaultContent.ratingQuestion,
disclaimer: defaultContent.disclaimer,
},
args: defaultContent,
} satisfies Story;
14 changes: 5 additions & 9 deletions editor.planx.uk/src/@planx/components/Feedback/Public/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ export const PASSPORT_FEEDBACK_KEY = "_feedback";
const FeedbackComponent = (props: PublicProps<Feedback>): FCReturn => {
const handleSubmitFeedback = async (values: FormProps) => {
const metadata = await getInternalFeedbackMetadata();
const feedback = {
userComment: values.feedback,
feedbackScore: values.feedbackScore,
};
const data = {
...metadata,
...feedback,
...values,
feedbackType: "component" as FeedbackView,
};
const submitFeedbackResult = await insertFeedbackMutation(data).catch(
Expand All @@ -53,7 +49,7 @@ const FeedbackComponent = (props: PublicProps<Feedback>): FCReturn => {
const formik = useFormik<FormProps>({
initialValues: getPreviouslySubmittedData(props) ?? {
feedbackScore: "",
feedback: "",
userComment: "",
},
onSubmit: handleSubmitFeedback,
});
Expand Down Expand Up @@ -152,11 +148,11 @@ const FeedbackComponent = (props: PublicProps<Feedback>): FCReturn => {
<Input
multiline={true}
rows={3}
name="feedback"
value={formik.values.feedback}
name="userComment"
value={formik.values.userComment}
bordered
onChange={formik.handleChange}
aria-label="feedback"
aria-label="user comment"
/>
</Box>
{props.disclaimer && <Disclaimer text={props.disclaimer} />}
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Feedback/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Feedback extends BaseNodeData {
}
export interface FormProps {
feedbackScore: string;
feedback: string;
userComment: string;
}

export const parseFeedback = (
Expand Down

0 comments on commit aa19903

Please sign in to comment.