fix
This commit is contained in:
parent
d89b5b002c
commit
8ad4bd41e1
@ -9,6 +9,7 @@ import type {
|
||||
ListOptionDefinition,
|
||||
NavigationConditionDefinition,
|
||||
ScreenDefinition,
|
||||
ScreenVariantDefinition,
|
||||
} from "@/lib/funnel/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@ -235,7 +236,11 @@ function VariantSummary({
|
||||
screenTitleMap: Record<string, string>;
|
||||
listOptionsMap: Record<string, ListOptionDefinition[]>;
|
||||
}) {
|
||||
const variants = (screen as ScreenDefinition & { variants?: ScreenDefinition["variants"] }).variants;
|
||||
const variants = (
|
||||
screen as ScreenDefinition & {
|
||||
variants?: ScreenVariantDefinition<ScreenDefinition>[];
|
||||
}
|
||||
).variants;
|
||||
|
||||
if (!variants || variants.length === 0) {
|
||||
return null;
|
||||
|
||||
@ -63,13 +63,16 @@ function VariantOverridesEditor({
|
||||
}, [baseScreen]);
|
||||
|
||||
const mergedScreen = useMemo(
|
||||
() => mergeScreenWithOverrides(baseWithoutVariants, overrides),
|
||||
() => mergeScreenWithOverrides<BuilderScreen>(baseWithoutVariants, overrides) as BuilderScreen,
|
||||
[baseWithoutVariants, overrides]
|
||||
);
|
||||
|
||||
const handleUpdate = useCallback(
|
||||
(updates: Partial<ScreenDefinition>) => {
|
||||
const nextScreen = mergeScreenWithOverrides(mergedScreen, updates as Partial<ScreenDefinition>);
|
||||
const nextScreen = mergeScreenWithOverrides<BuilderScreen>(
|
||||
mergedScreen,
|
||||
updates as Partial<BuilderScreen>
|
||||
);
|
||||
const nextOverrides = extractVariantOverrides(baseWithoutVariants, nextScreen);
|
||||
onChange(nextOverrides);
|
||||
},
|
||||
@ -79,7 +82,7 @@ function VariantOverridesEditor({
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<TemplateConfig screen={mergedScreen} onUpdate={handleUpdate} />
|
||||
<Button variant="outline" size="sm" onClick={() => onChange({})}>
|
||||
<Button variant="outline" className="h-8 px-3 text-xs" onClick={() => onChange({})}>
|
||||
Сбросить переопределения
|
||||
</Button>
|
||||
</div>
|
||||
@ -294,7 +297,7 @@ export function ScreenVariantsConfig({ screen, allScreens, onChange }: ScreenVar
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Настройте альтернативные варианты контента без изменения переходов.
|
||||
</p>
|
||||
<Button size="sm" onClick={addVariant} disabled={listScreens.length === 0}>
|
||||
<Button className="h-8 px-3 text-xs" onClick={addVariant} disabled={listScreens.length === 0}>
|
||||
Добавить вариант
|
||||
</Button>
|
||||
</div>
|
||||
@ -326,12 +329,16 @@ export function ScreenVariantsConfig({ screen, allScreens, onChange }: ScreenVar
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 px-3 text-xs"
|
||||
onClick={() => setExpandedVariant(isExpanded ? null : index)}
|
||||
>
|
||||
{isExpanded ? "Свернуть" : "Редактировать"}
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" className="text-destructive" onClick={() => removeVariant(index)}>
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="h-8 px-3 text-xs text-destructive"
|
||||
onClick={() => removeVariant(index)}
|
||||
>
|
||||
Удалить
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user