From 13a8d621b6bcbed76e4430857016c3aa9fffa642 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:01:00 +0000 Subject: [PATCH] Replace enum with object map --- .../FeedbackLog/components/CollapsibleRow.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackLog/components/CollapsibleRow.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackLog/components/CollapsibleRow.tsx index 1c1afb9859..7103438632 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackLog/components/CollapsibleRow.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackLog/components/CollapsibleRow.tsx @@ -126,16 +126,15 @@ export const CollapsibleRow: React.FC = (item) => { userContext: "What were you doing?", }; - enum EmojiRating { - Terrible, - Poor, - Average, - Good, - Excellent, - } + const EmojiRating: Record = { + 1: "Terrible", + 2: "Poor", + 3: "Neutral", + 4: "Good", + 5: "Excellent", + }; - const feedbackScore = - item.feedbackScore && EmojiRating[item.feedbackScore + 1]; // enums are 0-indexed + const feedbackScore = EmojiRating[item.feedbackScore]; const renderContent = (key: string, value: any) => { if (key === "combinedHelp" && value) {