This commit is contained in:
dev.daminik00 2025-09-26 20:51:08 +02:00
parent da92fe28c8
commit 0b10a09497
6 changed files with 4002 additions and 28 deletions

View File

@ -478,28 +478,34 @@ export function BuilderSidebar() {
</select>
</label>
<div className="flex flex-col gap-2">
<span className="text-sm font-medium text-muted-foreground">Варианты ответа</span>
<div className="flex flex-col gap-2 rounded-lg border border-border/60 p-3">
{selectedScreen.list.options.map((option) => {
const condition = rule.conditions[0];
const isChecked = condition.optionIds?.includes(option.id) ?? false;
return (
<label key={option.id} className="flex items-center gap-2 text-sm">
<input
type="checkbox"
checked={isChecked}
onChange={() => handleRuleOptionToggle(selectedScreen.id, ruleIndex, option.id)}
/>
<span>
{option.label}
<span className="text-muted-foreground"> ({option.id})</span>
</span>
</label>
);
})}
{selectedScreen.template === "list" ? (
<div className="flex flex-col gap-2">
<span className="text-sm font-medium text-muted-foreground">Варианты ответа</span>
<div className="flex flex-col gap-2 rounded-lg border border-border/60 p-3">
{selectedScreen.list.options.map((option) => {
const condition = rule.conditions[0];
const isChecked = condition.optionIds?.includes(option.id) ?? false;
return (
<label key={option.id} className="flex items-center gap-2 text-sm">
<input
type="checkbox"
checked={isChecked}
onChange={() => handleRuleOptionToggle(selectedScreen.id, ruleIndex, option.id)}
/>
<span>
{option.label}
<span className="text-muted-foreground"> ({option.id})</span>
</span>
</label>
);
})}
</div>
</div>
</div>
) : (
<div className="flex flex-col gap-2 rounded-lg border border-border/60 bg-muted/20 p-3 text-xs text-muted-foreground">
Навигационные правила с вариантами ответа доступны только для экранов со списком.
</div>
)}
<label className="flex flex-col gap-2">
<span className="text-sm font-medium text-muted-foreground">Следующий экран</span>

View File

@ -65,8 +65,7 @@ export function FormScreenConfig({ screen, onUpdate }: FormScreenConfigProps) {
</span>
<Button
variant="ghost"
size="sm"
className="text-destructive"
className="h-8 px-3 text-xs text-destructive"
onClick={() => removeField(index)}
>
Удалить

View File

@ -76,7 +76,9 @@ export function InfoScreenConfig({ screen, onUpdate }: InfoScreenConfigProps) {
<select
className="rounded-lg border border-border bg-background px-2 py-1"
value={infoScreen.icon?.size ?? "lg"}
onChange={(event) => handleIconChange("size", event.target.value)}
onChange={(event) =>
handleIconChange("size", event.target.value as "sm" | "md" | "lg" | "xl")
}
>
<option value="sm">Маленький</option>
<option value="md">Средний</option>

View File

@ -159,7 +159,7 @@ export function ListScreenConfig({ screen, onUpdate }: ListScreenConfigProps) {
<div className="space-y-3">
<div className="flex items-center justify-between">
<h4 className="text-sm font-semibold text-foreground">Настройка вариантов</h4>
<Button variant="outline" size="sm" className="h-8 px-3" onClick={handleAddOption}>
<Button variant="outline" className="h-8 px-3 text-xs" onClick={handleAddOption}>
<Plus className="mr-1 h-4 w-4" /> Добавить
</Button>
</div>
@ -195,8 +195,7 @@ export function ListScreenConfig({ screen, onUpdate }: ListScreenConfigProps) {
</button>
<Button
variant="ghost"
size="sm"
className="text-destructive"
className="h-8 px-3 text-xs text-destructive"
onClick={() => handleRemoveOption(index)}
>
<Trash2 className="h-4 w-4" />

View File

@ -370,7 +370,10 @@ function ActionButtonControls({ label, value, onChange }: ActionButtonControlsPr
export function TemplateConfig({ screen, onUpdate }: TemplateConfigProps) {
const { template } = screen;
const handleTitleChange = (value: TypographyVariant) => {
const handleTitleChange = (value: TypographyVariant | undefined) => {
if (!value) {
return;
}
onUpdate({ title: value });
};

File diff suppressed because it is too large Load Diff