-
-
- По умолчанию
-
-
- {defaultNext ? screenTitleMap[defaultNext] ?? defaultNext : "Воронка завершится"}
-
-
+
+
{rules.map((rule, ruleIndex) => {
const condition = rule.conditions[0];
@@ -322,37 +439,28 @@ export function BuilderCanvas() {
}))
: [];
+ const operatorKey = condition?.operator as
+ | Exclude
+ | undefined;
+ const operatorLabel = operatorKey
+ ? OPERATOR_LABELS[operatorKey] ?? operatorKey
+ : undefined;
+
+ const ruleTargetIndex = screens.findIndex(
+ (candidate) => candidate.id === rule.nextScreenId
+ );
+ const ruleTargetLabel = screenTitleMap[rule.nextScreenId] ?? rule.nextScreenId;
+
return (
-
-
-
- Вариативность
-
- {condition?.operator && (
-
- {condition.operator}
-
- )}
-
- {optionSummaries.length > 0 && (
-
- {optionSummaries.map((option) => (
-
- {option.label}
-
- ))}
-
- )}
-
- → {screenTitleMap[rule.nextScreenId] ?? rule.nextScreenId}
-
-
+ type="branch"
+ label="Вариативность"
+ targetLabel={ruleTargetLabel}
+ targetIndex={ruleTargetIndex !== -1 ? ruleTargetIndex : null}
+ optionSummaries={optionSummaries}
+ operator={operatorLabel}
+ />
);
})}
diff --git a/src/components/admin/builder/BuilderSidebar.tsx b/src/components/admin/builder/BuilderSidebar.tsx
index 30a48a8..342138d 100644
--- a/src/components/admin/builder/BuilderSidebar.tsx
+++ b/src/components/admin/builder/BuilderSidebar.tsx
@@ -478,30 +478,28 @@ export function BuilderSidebar() {
- {selectedScreen.template === "list" && (
-
-
Варианты ответа
-
- {selectedScreen.list.options.map((option) => {
- const condition = rule.conditions[0];
- const isChecked = condition.optionIds?.includes(option.id) ?? false;
- return (
-
- );
- })}
-
+
+
Варианты ответа
+
+ {selectedScreen.list.options.map((option) => {
+ const condition = rule.conditions[0];
+ const isChecked = condition.optionIds?.includes(option.id) ?? false;
+ return (
+
+ );
+ })}
- )}
+