diff --git a/apps/web/src/components/blocks/profile-1/components/setting-row.tsx b/apps/web/src/components/blocks/profile-1/components/setting-row.tsx index 7428c25..d9ff8d9 100644 --- a/apps/web/src/components/blocks/profile-1/components/setting-row.tsx +++ b/apps/web/src/components/blocks/profile-1/components/setting-row.tsx @@ -1,90 +1,3 @@ "use client" -import { type ReactNode } from "react" - -import { cn } from "@cfdm/ui/lib/utils" -import { - Field, - FieldContent, - FieldDescription, - FieldLabel, - FieldSeparator, - FieldTitle, -} from "@cfdm/ui/components/field" - -interface SettingRowProps { - title: string - description?: ReactNode - children: ReactNode - last?: boolean - compact?: boolean - stacked?: boolean - labelFor?: string - contentClassName?: string - titleAddon?: ReactNode -} - -export function SettingRow({ - title, - description, - children, - last, - compact, - stacked, - labelFor, - contentClassName, - titleAddon, -}: SettingRowProps) { - return ( - <> - -
-
- {labelFor ? ( - - {title} - - ) : ( - - {title} - - )} - {titleAddon} -
- - {description ? ( - - {description} - - ) : null} -
- - -
- {children} -
-
-
- - {!last ? : null} - - ) -} \ No newline at end of file +export { SettingRow, type SettingRowProps } from "@/components/setting-row" diff --git a/apps/web/src/components/counted-line-tabs.tsx b/apps/web/src/components/counted-line-tabs.tsx index 4d4788e..f6cfe20 100644 --- a/apps/web/src/components/counted-line-tabs.tsx +++ b/apps/web/src/components/counted-line-tabs.tsx @@ -1,3 +1,4 @@ +import type { ReactNode } from 'react' import { Tabs, TabsList, TabsTrigger } from '@cfdm/ui/components/tabs' import { cn } from '@cfdm/ui/lib/utils' @@ -13,6 +14,7 @@ interface CountedLineTabsProps { onValueChange: (value: string) => void className?: string listClassName?: string + children?: ReactNode } /** Line tabs with count pills (c-tabs-2 / data-grid-filtering-2). */ @@ -22,6 +24,7 @@ export function CountedLineTabs({ onValueChange, className, listClassName, + children, }: CountedLineTabsProps) { return ( @@ -41,6 +44,7 @@ export function CountedLineTabs({ ))} + {children} ) } diff --git a/apps/web/src/components/health-check-config-fields.tsx b/apps/web/src/components/health-check-config-fields.tsx index 4b504ea..c2378e1 100644 --- a/apps/web/src/components/health-check-config-fields.tsx +++ b/apps/web/src/components/health-check-config-fields.tsx @@ -1,6 +1,14 @@ -import { AppFieldGroup } from '@/components/app-field' import { FormFieldSimple } from '@/components/form-field' import { AppInput } from '@/components/app-input' +import { SettingRow } from '@/components/setting-row' +import { Badge } from '@/components/reui/badge' +import { + NumberField, + NumberFieldDecrement, + NumberFieldGroup, + NumberFieldIncrement, + NumberFieldInput, +} from '@/components/reui/number-field' import { Select, SelectContent, @@ -9,7 +17,7 @@ import { SelectValue, } from '@cfdm/ui/components/select' import { Switch } from '@cfdm/ui/components/switch' -import { Label } from '@cfdm/ui/components/label' +import { FieldGroup } from '@cfdm/ui/components/field' import { cn } from '@cfdm/ui/lib/utils' export type LbMode = 'round_robin' | 'failover' | 'weighted' @@ -50,6 +58,39 @@ interface HealthCheckConfigFieldsProps { className?: string } +function CompactNumberField({ + id, + value, + onValueChange, + min, + max, + placeholder, +}: { + id: string + value: number | null + onValueChange: (next: number | null) => void + min?: number + max?: number + placeholder?: string +}) { + return ( + onValueChange(next ?? null)} + > + + + + + + + ) +} + export function HealthCheckConfigFields({ value, onChange, @@ -64,11 +105,18 @@ export function HealthCheckConfigFields({ } const isHttp = value.type === 'http' + const rowClass = 'gap-3 px-0 py-3' return ( -
- {showLbMode && ( - + + {showLbMode ? ( + - - )} + + ) : null} - -
- patch({ enabled: checked })} - /> - -
-
+ + {value.enabled ? 'Вкл' : 'Выкл'} + + } + > + patch({ enabled: checked })} + /> + - {value.enabled && ( -
-

- Параметры проверки -

- - + {value.enabled ? ( +
+
+ )} - {showLbBlock && ( - - - - {binding.record_type === 'CNAME' - ? 'Health-check' - : binding.target_ips.length > 1 - ? 'Балансировка и Health-check (multi-A)' - : 'Health-check'} - - - - handleBindingHealthChange(index, next) - } - lbModeLabel="Режим балансировки" - showLbMode={ - binding.record_type === 'A' && - binding.target_ips.length > 1 - } - idPrefix={`binding-${index}-health`} - /> - - - - )} + {showLbBlock ? ( + handleBindingHealthChange(index, next)} + lbModeLabel="Режим балансировки" + showLbMode={ + binding.record_type === 'A' && binding.target_ips.length > 1 + } + idPrefix={`binding-${index}-health`} + /> + ) : null} - - handleRemoveBinding(index)} - > - - - ) })} )} - +
diff --git a/apps/web/src/components/service-group-edit-sheet.tsx b/apps/web/src/components/service-group-edit-sheet.tsx index 1fed143..934c477 100644 --- a/apps/web/src/components/service-group-edit-sheet.tsx +++ b/apps/web/src/components/service-group-edit-sheet.tsx @@ -23,12 +23,6 @@ import { SelectTrigger, SelectValue, } from '@cfdm/ui/components/select' -import { - Accordion, - AccordionContent, - AccordionItem, - AccordionTrigger, -} from '@cfdm/ui/components/accordion' const groupTypes = [ { value: 'vpn', label: 'VPN' }, @@ -199,21 +193,14 @@ export function ServiceGroupEditSheet({ - {hasDomain && ( - - - Балансировка и Health-check - - - - - - )} + {hasDomain ? ( + + ) : null} ) } diff --git a/apps/web/src/components/setting-row.tsx b/apps/web/src/components/setting-row.tsx new file mode 100644 index 0000000..522e7fe --- /dev/null +++ b/apps/web/src/components/setting-row.tsx @@ -0,0 +1,85 @@ +import { type ReactNode } from 'react' + +import { cn } from '@cfdm/ui/lib/utils' +import { + Field, + FieldContent, + FieldDescription, + FieldLabel, + FieldSeparator, + FieldTitle, +} from '@cfdm/ui/components/field' + +export interface SettingRowProps { + title: string + description?: ReactNode + children: ReactNode + last?: boolean + compact?: boolean + stacked?: boolean + labelFor?: string + contentClassName?: string + className?: string + titleAddon?: ReactNode +} + +/** Compact settings row (REUI PRO profile-1 / settings-9 pattern). */ +export function SettingRow({ + title, + description, + children, + last, + compact, + stacked, + labelFor, + contentClassName, + className, + titleAddon, +}: SettingRowProps) { + return ( + <> + +
+
+ {labelFor ? ( + {title} + ) : ( + {title} + )} + {titleAddon} +
+ + {description ? ( + {description} + ) : null} +
+ + +
+ {children} +
+
+
+ + {!last ? : null} + + ) +}