From d3d4622b1f378e606f94c5a42a91a989b62a7a98 Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Sun, 9 Nov 2025 15:53:53 +0300 Subject: [PATCH] M: Improve focus cst layout --- .../dlg-show-term-graph/tg-readonly-flow.tsx | 6 +++-- .../components/term-graph/focus-label.tsx | 16 ++++++++++++++ .../term-graph/toolbar-focused-cst.tsx | 22 +------------------ .../editor-term-graph/toolbar-term-graph.tsx | 7 +++--- 4 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 rsconcept/frontend/src/features/rsform/components/term-graph/focus-label.tsx diff --git a/rsconcept/frontend/src/features/oss/dialogs/dlg-show-term-graph/tg-readonly-flow.tsx b/rsconcept/frontend/src/features/oss/dialogs/dlg-show-term-graph/tg-readonly-flow.tsx index 5ed7f704..06dfdd0f 100644 --- a/rsconcept/frontend/src/features/oss/dialogs/dlg-show-term-graph/tg-readonly-flow.tsx +++ b/rsconcept/frontend/src/features/oss/dialogs/dlg-show-term-graph/tg-readonly-flow.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from 'react'; import { type Edge, MarkerType, type Node, useEdgesState, useNodesState } from 'reactflow'; import { type IConstituenta, type IRSForm } from '@/features/rsform'; +import { FocusLabel } from '@/features/rsform/components/term-graph/focus-label'; import { TGEdgeTypes } from '@/features/rsform/components/term-graph/graph/tg-edge-types'; import { TGNodeTypes } from '@/features/rsform/components/term-graph/graph/tg-node-types'; import { SelectColoring } from '@/features/rsform/components/term-graph/select-coloring'; @@ -100,9 +101,10 @@ export function TGReadonlyFlow({ schema }: TGReadonlyFlowProps) { return (
-
- {focusCst ? setFocusCst(null)} /> : null} +
+ {focusCst ? setFocusCst(null)} /> : null} + {focusCst ? : null}
diff --git a/rsconcept/frontend/src/features/rsform/components/term-graph/focus-label.tsx b/rsconcept/frontend/src/features/rsform/components/term-graph/focus-label.tsx new file mode 100644 index 00000000..407dfc5b --- /dev/null +++ b/rsconcept/frontend/src/features/rsform/components/term-graph/focus-label.tsx @@ -0,0 +1,16 @@ +import clsx from 'clsx'; + +interface FocusLabelProps { + label: string; +} + +export function FocusLabel({ label }: FocusLabelProps) { + return ( +
+ + Фокус + {label} + +
+ ); +} diff --git a/rsconcept/frontend/src/features/rsform/components/term-graph/toolbar-focused-cst.tsx b/rsconcept/frontend/src/features/rsform/components/term-graph/toolbar-focused-cst.tsx index c9bcdb61..c9e80961 100644 --- a/rsconcept/frontend/src/features/rsform/components/term-graph/toolbar-focused-cst.tsx +++ b/rsconcept/frontend/src/features/rsform/components/term-graph/toolbar-focused-cst.tsx @@ -1,9 +1,5 @@ 'use client'; -import clsx from 'clsx'; - -import { type IConstituenta } from '@/features/rsform/models/rsform'; - import { MiniButton } from '@/components/control'; import { IconGraphInputs, IconGraphOutputs, IconReset } from '@/components/icons'; import { cn } from '@/components/utils'; @@ -12,11 +8,10 @@ import { useTermGraphStore } from '../../stores/term-graph'; interface ToolbarFocusedCstProps { className?: string; - focus: IConstituenta; resetFocus: () => void; } -export function ToolbarFocusedCst({ focus, resetFocus, className }: ToolbarFocusedCstProps) { +export function ToolbarFocusedCst({ resetFocus, className }: ToolbarFocusedCstProps) { const filter = useTermGraphStore(state => state.filter); const toggleFocusInputs = useTermGraphStore(state => state.toggleFocusInputs); const toggleFocusOutputs = useTermGraphStore(state => state.toggleFocusOutputs); @@ -40,21 +35,6 @@ export function ToolbarFocusedCst({ focus, resetFocus, className }: ToolbarFocus onClick={toggleFocusOutputs} />
-
- - Фокус - {focus.alias} - -
); } diff --git a/rsconcept/frontend/src/features/rsform/pages/rsform-page/editor-term-graph/toolbar-term-graph.tsx b/rsconcept/frontend/src/features/rsform/pages/rsform-page/editor-term-graph/toolbar-term-graph.tsx index e47580df..3c52cdb6 100644 --- a/rsconcept/frontend/src/features/rsform/pages/rsform-page/editor-term-graph/toolbar-term-graph.tsx +++ b/rsconcept/frontend/src/features/rsform/pages/rsform-page/editor-term-graph/toolbar-term-graph.tsx @@ -6,6 +6,7 @@ import { HelpTopic } from '@/features/help'; import { BadgeHelp } from '@/features/help/components/badge-help'; import { type ILibraryItemReference } from '@/features/library'; import { MiniSelectorOSS } from '@/features/library/components/mini-selector-oss'; +import { FocusLabel } from '@/features/rsform/components/term-graph/focus-label'; import { ToolbarFocusedCst } from '@/features/rsform/components/term-graph/toolbar-focused-cst'; import { ToolbarGraphSelection } from '@/features/rsform/components/toolbar-graph-selection'; import { isBasicConcept } from '@/features/rsform/models/rsform-api'; @@ -162,10 +163,7 @@ export function ToolbarTermGraph({ className }: ToolbarTermGraphProps) {
{focusCst ? ( - setFocus(null)} - /> + setFocus(null)} /> ) : (
+ {focusCst ? : null} ); }