Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use language property for review page label #4088

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const SelectNextAction = ({
{selectedGroupNextActions === "exit" && (
<div className="bg-gray-50 p-3">
<SingleActionSelect
lang={lang}
key={`single-action-select-${selectedGroupId}`}
nextAction={selectedGroupNextActions || "end"}
/>
Expand All @@ -92,6 +93,7 @@ export const SelectNextAction = ({
<SectionName lang={lang} sectionName={sectionName} />
</div>
<SingleActionSelect
lang={lang}
key={`single-action-select-${selectedGroupId}`}
nextAction={selectedGroupNextActions || "end"}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { useTranslation } from "@i18n/client";
import { SaveNote } from "./SaveNote";
import { toast } from "@formBuilder/components/shared/Toast";
import { Checkbox } from "@formBuilder/components/shared";
import { getReviewLabels } from "@lib/utils/form-builder/i18nHelpers";
import { Language } from "@lib/types/form-builder-types";

const ExitIcon = () => {
return (
Expand All @@ -24,9 +26,11 @@ const ExitIcon = () => {

export const SingleActionSelect = ({
item,
lang,
nextAction = "review",
}: {
item?: FormElement | null;
lang: Language;
nextAction: string | undefined;
}) => {
const { flow } = useFlowRef();
Expand All @@ -40,7 +44,13 @@ export const SingleActionSelect = ({
const formGroups: GroupsType = useTemplateStore((s) => s.form.groups) || {};
let groupItems = Object.keys(formGroups).map((key) => {
const item = formGroups[key];
return { label: item.name, value: key };
let label = item.name;

if (key === "review") {
label = getReviewLabels()[lang];
}

return { label, value: key };
});

// Filter out the current group
Expand Down
Loading