M: Improve focus cst layout
This commit is contained in:
parent
7cda2c5039
commit
d3d4622b1f
|
|
@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
|
||||||
import { type Edge, MarkerType, type Node, useEdgesState, useNodesState } from 'reactflow';
|
import { type Edge, MarkerType, type Node, useEdgesState, useNodesState } from 'reactflow';
|
||||||
|
|
||||||
import { type IConstituenta, type IRSForm } from '@/features/rsform';
|
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 { TGEdgeTypes } from '@/features/rsform/components/term-graph/graph/tg-edge-types';
|
||||||
import { TGNodeTypes } from '@/features/rsform/components/term-graph/graph/tg-node-types';
|
import { TGNodeTypes } from '@/features/rsform/components/term-graph/graph/tg-node-types';
|
||||||
import { SelectColoring } from '@/features/rsform/components/term-graph/select-coloring';
|
import { SelectColoring } from '@/features/rsform/components/term-graph/select-coloring';
|
||||||
|
|
@ -100,9 +101,10 @@ export function TGReadonlyFlow({ schema }: TGReadonlyFlowProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='relative w-full h-full flex flex-col'>
|
<div className='relative w-full h-full flex flex-col'>
|
||||||
<div className='cc-tab-tools flex mt-2 items-start rounded-b-2xl backdrop-blur-xs'>
|
<div className='cc-tab-tools mt-2 flex flex-col items-center rounded-b-2xl backdrop-blur-xs'>
|
||||||
{focusCst ? <ToolbarFocusedCst focus={focusCst} resetFocus={() => setFocusCst(null)} /> : null}
|
|
||||||
<ToolbarGraphFilter />
|
<ToolbarGraphFilter />
|
||||||
|
{focusCst ? <ToolbarFocusedCst resetFocus={() => setFocusCst(null)} /> : null}
|
||||||
|
{focusCst ? <FocusLabel label={focusCst.alias} /> : null}
|
||||||
</div>
|
</div>
|
||||||
<div className='absolute z-pop top-24 sm:top-16 left-2 sm:left-3 w-54 flex flex-col pointer-events-none'>
|
<div className='absolute z-pop top-24 sm:top-16 left-2 sm:left-3 w-54 flex flex-col pointer-events-none'>
|
||||||
<SelectColoring className='rounded-b-none' schema={schema} />
|
<SelectColoring className='rounded-b-none' schema={schema} />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import clsx from 'clsx';
|
||||||
|
|
||||||
|
interface FocusLabelProps {
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FocusLabel({ label }: FocusLabelProps) {
|
||||||
|
return (
|
||||||
|
<div className={clsx('px-1', 'select-none', 'hover:bg-background', 'text-accent-purple-foreground rounded-md')}>
|
||||||
|
<span aria-label='Фокус-конституента' className='whitespace-nowrap'>
|
||||||
|
Фокус
|
||||||
|
<b> {label} </b>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import clsx from 'clsx';
|
|
||||||
|
|
||||||
import { type IConstituenta } from '@/features/rsform/models/rsform';
|
|
||||||
|
|
||||||
import { MiniButton } from '@/components/control';
|
import { MiniButton } from '@/components/control';
|
||||||
import { IconGraphInputs, IconGraphOutputs, IconReset } from '@/components/icons';
|
import { IconGraphInputs, IconGraphOutputs, IconReset } from '@/components/icons';
|
||||||
import { cn } from '@/components/utils';
|
import { cn } from '@/components/utils';
|
||||||
|
|
@ -12,11 +8,10 @@ import { useTermGraphStore } from '../../stores/term-graph';
|
||||||
|
|
||||||
interface ToolbarFocusedCstProps {
|
interface ToolbarFocusedCstProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
focus: IConstituenta;
|
|
||||||
resetFocus: () => void;
|
resetFocus: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ToolbarFocusedCst({ focus, resetFocus, className }: ToolbarFocusedCstProps) {
|
export function ToolbarFocusedCst({ resetFocus, className }: ToolbarFocusedCstProps) {
|
||||||
const filter = useTermGraphStore(state => state.filter);
|
const filter = useTermGraphStore(state => state.filter);
|
||||||
const toggleFocusInputs = useTermGraphStore(state => state.toggleFocusInputs);
|
const toggleFocusInputs = useTermGraphStore(state => state.toggleFocusInputs);
|
||||||
const toggleFocusOutputs = useTermGraphStore(state => state.toggleFocusOutputs);
|
const toggleFocusOutputs = useTermGraphStore(state => state.toggleFocusOutputs);
|
||||||
|
|
@ -40,21 +35,6 @@ export function ToolbarFocusedCst({ focus, resetFocus, className }: ToolbarFocus
|
||||||
onClick={toggleFocusOutputs}
|
onClick={toggleFocusOutputs}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
className={clsx(
|
|
||||||
'translate-x-1/2',
|
|
||||||
'w-full text-right',
|
|
||||||
'px-1',
|
|
||||||
'select-none',
|
|
||||||
'hover:bg-background',
|
|
||||||
'text-accent-purple-foreground rounded-md'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<span aria-label='Фокус-конституента' className='whitespace-nowrap'>
|
|
||||||
Фокус
|
|
||||||
<b> {focus.alias} </b>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { HelpTopic } from '@/features/help';
|
||||||
import { BadgeHelp } from '@/features/help/components/badge-help';
|
import { BadgeHelp } from '@/features/help/components/badge-help';
|
||||||
import { type ILibraryItemReference } from '@/features/library';
|
import { type ILibraryItemReference } from '@/features/library';
|
||||||
import { MiniSelectorOSS } from '@/features/library/components/mini-selector-oss';
|
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 { ToolbarFocusedCst } from '@/features/rsform/components/term-graph/toolbar-focused-cst';
|
||||||
import { ToolbarGraphSelection } from '@/features/rsform/components/toolbar-graph-selection';
|
import { ToolbarGraphSelection } from '@/features/rsform/components/toolbar-graph-selection';
|
||||||
import { isBasicConcept } from '@/features/rsform/models/rsform-api';
|
import { isBasicConcept } from '@/features/rsform/models/rsform-api';
|
||||||
|
|
@ -162,10 +163,7 @@ export function ToolbarTermGraph({ className }: ToolbarTermGraphProps) {
|
||||||
</div>
|
</div>
|
||||||
<div className='cc-icons items-start'>
|
<div className='cc-icons items-start'>
|
||||||
{focusCst ? (
|
{focusCst ? (
|
||||||
<ToolbarFocusedCst
|
<ToolbarFocusedCst resetFocus={() => setFocus(null)} />
|
||||||
focus={focusCst} //
|
|
||||||
resetFocus={() => setFocus(null)}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<ToolbarGraphSelection
|
<ToolbarGraphSelection
|
||||||
graph={filteredGraph}
|
graph={filteredGraph}
|
||||||
|
|
@ -201,6 +199,7 @@ export function ToolbarTermGraph({ className }: ToolbarTermGraphProps) {
|
||||||
onClick={handleShowTypeGraph}
|
onClick={handleShowTypeGraph}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{focusCst ? <FocusLabel label={focusCst.alias} /> : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user