mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-19 11:11:05 -05:00
fix: reviews
This commit is contained in:
@@ -23,7 +23,7 @@ export function LogicEditor({
|
||||
isLast,
|
||||
}: LogicEditorProps) {
|
||||
return (
|
||||
<div className="flex w-full grow flex-col gap-4 overflow-x-auto text-sm">
|
||||
<div className="flex w-full grow flex-col gap-4 overflow-x-auto pb-2 text-sm">
|
||||
<LogicEditorConditions
|
||||
conditions={logicItem.conditions}
|
||||
updateQuestion={updateQuestion}
|
||||
|
||||
@@ -241,6 +241,7 @@ export function LogicEditorConditions({
|
||||
const conditionOperatorOptions = getConditionOperatorOptions(condition, localSurvey);
|
||||
const { show, options, showInput = false, inputType } = getMatchValueProps(condition, localSurvey);
|
||||
|
||||
const allowMultiSelect = ["equalsOneOf", "includesAllOf", "includesOneOf"].includes(condition.operator);
|
||||
return (
|
||||
<div key={condition.id} className="flex items-center gap-x-2">
|
||||
<div className="w-10 shrink-0">
|
||||
@@ -290,7 +291,8 @@ export function LogicEditorConditions({
|
||||
key="conditionMatchValue"
|
||||
showSearch={false}
|
||||
groupedOptions={options}
|
||||
allowMultiSelect={["equalsOneOf", "includesAllOf", "includesOneOf"].includes(condition.operator)}
|
||||
allowMultiSelect={allowMultiSelect}
|
||||
showCheckIcon={allowMultiSelect}
|
||||
comboboxClasses="grow min-w-[180px] max-w-[300px]"
|
||||
value={condition.rightOperand?.value}
|
||||
clearable={true}
|
||||
|
||||
@@ -192,7 +192,9 @@ export const SurveyMenuBar = ({
|
||||
|
||||
toast.error(`${messageSplit} ${invalidLanguageLabels.join(", ")}`);
|
||||
} else {
|
||||
toast.error(currentError.message);
|
||||
toast.error(currentError.message, {
|
||||
className: "w-fit !max-w-md",
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -478,7 +478,7 @@ const getLeftOperandValue = (
|
||||
const responseValue = data[leftOperand.value];
|
||||
|
||||
if (currentQuestion.type === "openText" && currentQuestion.inputType === "number") {
|
||||
return Number(responseValue) || 0;
|
||||
return Number(responseValue) || undefined;
|
||||
}
|
||||
|
||||
if (currentQuestion.type === "multipleChoiceSingle" || currentQuestion.type === "multipleChoiceMulti") {
|
||||
|
||||
@@ -204,6 +204,15 @@ export const InputCombobox = ({
|
||||
setLocalValue(null);
|
||||
};
|
||||
|
||||
const isSelected = (option: TComboboxOption) => {
|
||||
if (typeof localValue === "object") {
|
||||
if (Array.isArray(localValue)) {
|
||||
return localValue.find((item) => item.value === option.value) !== undefined;
|
||||
}
|
||||
return localValue?.value === option.value;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -263,12 +272,9 @@ export const InputCombobox = ({
|
||||
onSelect={() => handleSelect(option)}
|
||||
title={option.label}
|
||||
className="cursor-pointer truncate">
|
||||
{showCheckIcon &&
|
||||
allowMultiSelect &&
|
||||
Array.isArray(localValue) &&
|
||||
localValue.find((item) => item.value === option.value) && (
|
||||
<CheckIcon className="mr-2 h-4 w-4 text-slate-300 hover:text-slate-400" />
|
||||
)}
|
||||
{showCheckIcon && isSelected(option) && (
|
||||
<CheckIcon className="mr-2 h-4 w-4 text-slate-300 hover:text-slate-400" />
|
||||
)}
|
||||
{option.icon && <option.icon className="mr-2 h-5 w-5 shrink-0 text-slate-400" />}
|
||||
{option.imgSrc && (
|
||||
<Image
|
||||
@@ -293,12 +299,9 @@ export const InputCombobox = ({
|
||||
key={option.value}
|
||||
onSelect={() => handleSelect(option)}
|
||||
className="cursor-pointer truncate">
|
||||
{showCheckIcon &&
|
||||
allowMultiSelect &&
|
||||
Array.isArray(localValue) &&
|
||||
localValue.find((item) => item.value === option.value) && (
|
||||
<CheckIcon className="mr-2 h-4 w-4 text-slate-300 hover:text-slate-400" />
|
||||
)}
|
||||
{showCheckIcon && isSelected(option) && (
|
||||
<CheckIcon className="mr-2 h-4 w-4 text-slate-300 hover:text-slate-400" />
|
||||
)}
|
||||
{option.icon && <option.icon className="mr-2 h-5 w-5 shrink-0 text-slate-400" />}
|
||||
{option.imgSrc && (
|
||||
<Image
|
||||
|
||||
Reference in New Issue
Block a user