diff --git a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MatrixQuestionForm.tsx b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MatrixQuestionForm.tsx
index 1c06aaf779..50c920c26a 100644
--- a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MatrixQuestionForm.tsx
+++ b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MatrixQuestionForm.tsx
@@ -3,17 +3,11 @@
import { PlusIcon, TrashIcon } from "lucide-react";
import { createI18nString, extractLanguageCodes } from "@formbricks/lib/i18n/utils";
import { TAttributeClass } from "@formbricks/types/attribute-classes";
-import { TI18nString, TShuffleOption, TSurvey, TSurveyMatrixQuestion } from "@formbricks/types/surveys/types";
+import { TI18nString, TSurvey, TSurveyMatrixQuestion } from "@formbricks/types/surveys/types";
import { Button } from "@formbricks/ui/components/Button";
import { Label } from "@formbricks/ui/components/Label";
import { QuestionFormInput } from "@formbricks/ui/components/QuestionFormInput";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@formbricks/ui/components/Select";
+import { ShuffleOptionSelect } from "@formbricks/ui/components/ShuffleOptionSelect";
import { isLabelValidForAllLanguages } from "../lib/validation";
interface MatrixQuestionFormProps {
@@ -237,29 +231,12 @@ export const MatrixQuestionForm = ({
-
+
diff --git a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MultipleChoiceQuestionForm.tsx b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MultipleChoiceQuestionForm.tsx
index b3d52b29a1..83e9fed362 100644
--- a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MultipleChoiceQuestionForm.tsx
+++ b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/MultipleChoiceQuestionForm.tsx
@@ -19,13 +19,7 @@ import {
import { Button } from "@formbricks/ui/components/Button";
import { Label } from "@formbricks/ui/components/Label";
import { QuestionFormInput } from "@formbricks/ui/components/QuestionFormInput";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@formbricks/ui/components/Select";
+import { ShuffleOptionSelect } from "@formbricks/ui/components/ShuffleOptionSelect";
import { QuestionOptionChoice } from "./QuestionOptionChoice";
interface OpenQuestionFormProps {
@@ -290,29 +284,12 @@ export const MultipleChoiceQuestionForm = ({
-
+
diff --git a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/RankingQuestionForm.tsx b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/RankingQuestionForm.tsx
index c19111bf53..7e75ed8660 100644
--- a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/RankingQuestionForm.tsx
+++ b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/RankingQuestionForm.tsx
@@ -7,22 +7,11 @@ import { PlusIcon } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { createI18nString, extractLanguageCodes } from "@formbricks/lib/i18n/utils";
import { TAttributeClass } from "@formbricks/types/attribute-classes";
-import {
- TI18nString,
- TShuffleOption,
- TSurvey,
- TSurveyRankingQuestion,
-} from "@formbricks/types/surveys/types";
+import { TI18nString, TSurvey, TSurveyRankingQuestion } from "@formbricks/types/surveys/types";
import { Button } from "@formbricks/ui/components/Button";
import { Label } from "@formbricks/ui/components/Label";
import { QuestionFormInput } from "@formbricks/ui/components/QuestionFormInput";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@formbricks/ui/components/Select";
+import { ShuffleOptionSelect } from "@formbricks/ui/components/ShuffleOptionSelect";
import { QuestionOptionChoice } from "./QuestionOptionChoice";
interface RankingQuestionFormProps {
@@ -227,29 +216,12 @@ export const RankingQuestionForm = ({
onClick={() => addOption()}>
Add option
-
+
diff --git a/packages/ui/components/ShuffleOptionSelect/index.tsx b/packages/ui/components/ShuffleOptionSelect/index.tsx
new file mode 100644
index 0000000000..0ee9fe6b1a
--- /dev/null
+++ b/packages/ui/components/ShuffleOptionSelect/index.tsx
@@ -0,0 +1,68 @@
+import {
+ TShuffleOption,
+ TSurveyMatrixQuestion,
+ TSurveyMultipleChoiceQuestion,
+ TSurveyRankingQuestion,
+} from "@formbricks/types/surveys/types";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../Select";
+
+type ShuffleOptionsTypes = {
+ none?: {
+ id: string;
+ label: string;
+ show: boolean;
+ };
+ all?: {
+ id: string;
+ label: string;
+ show: boolean;
+ };
+ exceptLast?: {
+ id: string;
+ label: string;
+ show: boolean;
+ };
+};
+
+interface ShuffleOptionSelectInterface {
+ shuffleOption: TShuffleOption | undefined;
+ updateQuestion: (
+ questionIdx: number,
+ updatedAttributes: Partial
+ ) => void;
+ questionIdx: number;
+ shuffleOptionsTypes: ShuffleOptionsTypes;
+}
+
+export const ShuffleOptionSelect: React.FC = ({
+ questionIdx,
+ shuffleOption,
+ updateQuestion,
+ shuffleOptionsTypes,
+}) => {
+ return (
+
+ );
+};