F: Improve panel UI
This commit is contained in:
parent
d46fa536e6
commit
3feadb6f06
|
@ -50,21 +50,22 @@ export function SidePanel({ isMounted, className }: SidePanelProps) {
|
||||||
icon={<IconClose size='1.25rem' />}
|
icon={<IconClose size='1.25rem' />}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'absolute z-pop transition-transform duration-move right-0 top-0',
|
'absolute z-pop transition-transform duration-move right-0 top-0',
|
||||||
noNavigationAnimation ? '-translate-x-4 translate-y-0' : 'translate-x-0 translate-y-2'
|
noNavigationAnimation ? '-translate-x-4 translate-y-0' : 'translate-x-0 translate-y-1'
|
||||||
)}
|
)}
|
||||||
onClick={closePanel}
|
onClick={closePanel}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{!selectedSchema ? (
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'mt-0 mb-1',
|
'mt-0 mb-1',
|
||||||
'font-medium text-sm select-none self-center',
|
'font-medium text-sm select-none self-center',
|
||||||
'transition-transform',
|
|
||||||
selectedSchema && 'translate-x-20'
|
selectedSchema && 'translate-x-20'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
Содержание
|
Содержание
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{!selectedOperation && !selectedBlock ? (
|
{!selectedOperation && !selectedBlock ? (
|
||||||
<div className='text-center text-sm cc-fade-in'>Выделите операцию или блок для просмотра</div>
|
<div className='text-center text-sm cc-fade-in'>Выделите операцию или блок для просмотра</div>
|
||||||
|
|
|
@ -15,12 +15,15 @@ import {
|
||||||
IconMoveDown,
|
IconMoveDown,
|
||||||
IconMoveUp,
|
IconMoveUp,
|
||||||
IconNewItem,
|
IconNewItem,
|
||||||
IconRSForm
|
IconRSForm,
|
||||||
|
IconTree,
|
||||||
|
IconTypeGraph
|
||||||
} from '@/components/icons';
|
} from '@/components/icons';
|
||||||
import { cn } from '@/components/utils';
|
import { cn } from '@/components/utils';
|
||||||
import { useDialogsStore } from '@/stores/dialogs';
|
import { useDialogsStore } from '@/stores/dialogs';
|
||||||
import { PARAMETER, prefixes } from '@/utils/constants';
|
import { PARAMETER, prefixes } from '@/utils/constants';
|
||||||
import { type RO } from '@/utils/meta';
|
import { type RO } from '@/utils/meta';
|
||||||
|
import { notImplemented } from '@/utils/utils';
|
||||||
|
|
||||||
interface ToolbarConstituentsProps {
|
interface ToolbarConstituentsProps {
|
||||||
schema: IRSForm;
|
schema: IRSForm;
|
||||||
|
@ -48,6 +51,7 @@ export function ToolbarConstituents({
|
||||||
|
|
||||||
const showCreateCst = useDialogsStore(state => state.showCreateCst);
|
const showCreateCst = useDialogsStore(state => state.showCreateCst);
|
||||||
const showDeleteCst = useDialogsStore(state => state.showDeleteCst);
|
const showDeleteCst = useDialogsStore(state => state.showDeleteCst);
|
||||||
|
const showTypeGraph = useDialogsStore(state => state.showShowTypeGraph);
|
||||||
const { moveConstituents } = useMoveConstituents();
|
const { moveConstituents } = useMoveConstituents();
|
||||||
const { createConstituenta } = useCreateConstituenta();
|
const { createConstituenta } = useCreateConstituenta();
|
||||||
|
|
||||||
|
@ -162,6 +166,15 @@ export function ToolbarConstituents({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleShowTypeGraph() {
|
||||||
|
const typeInfo = schema.items.map(item => ({
|
||||||
|
alias: item.alias,
|
||||||
|
result: item.parse.typification,
|
||||||
|
args: item.parse.args
|
||||||
|
}));
|
||||||
|
showTypeGraph({ items: typeInfo });
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('flex gap-0.5', className)}>
|
<div className={cn('flex gap-0.5', className)}>
|
||||||
<MiniButton
|
<MiniButton
|
||||||
|
@ -176,7 +189,6 @@ export function ToolbarConstituents({
|
||||||
onClick={onEditActive}
|
onClick={onEditActive}
|
||||||
disabled={!isMutable || isProcessing || !activeCst}
|
disabled={!isMutable || isProcessing || !activeCst}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<MiniButton
|
<MiniButton
|
||||||
title='Создать конституенту'
|
title='Создать конституенту'
|
||||||
icon={<IconNewItem size='1rem' className='icon-green' />}
|
icon={<IconNewItem size='1rem' className='icon-green' />}
|
||||||
|
@ -209,6 +221,17 @@ export function ToolbarConstituents({
|
||||||
onClick={moveDown}
|
onClick={moveDown}
|
||||||
disabled={!isMutable || !activeCst || isProcessing || schema.items.length < 2 || hasSearch}
|
disabled={!isMutable || !activeCst || isProcessing || schema.items.length < 2 || hasSearch}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<MiniButton
|
||||||
|
icon={<IconTree size='1rem' className='hover:text-primary' />}
|
||||||
|
title='Граф термов'
|
||||||
|
onClick={notImplemented}
|
||||||
|
/>
|
||||||
|
<MiniButton
|
||||||
|
icon={<IconTypeGraph size='1rem' className='hover:text-primary' />}
|
||||||
|
title='Граф ступеней'
|
||||||
|
onClick={handleShowTypeGraph}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ export function ViewSchema({ schemaID, isMutable }: ViewSchemaProps) {
|
||||||
const listHeight = useFitHeight('14.5rem', '10rem');
|
const listHeight = useFitHeight('14.5rem', '10rem');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='grid h-full relative cc-fade-in' style={{ gridTemplateRows: '1fr auto' }}>
|
<div className='grid h-full relative cc-fade-in mt-5' style={{ gridTemplateRows: '1fr auto' }}>
|
||||||
<ToolbarConstituents
|
<ToolbarConstituents
|
||||||
className='absolute -top-7 left-1'
|
className='absolute -top-6.5 left-1'
|
||||||
schema={schema}
|
schema={schema}
|
||||||
activeCst={activeCst}
|
activeCst={activeCst}
|
||||||
isMutable={isMutable}
|
isMutable={isMutable}
|
||||||
|
|
|
@ -180,7 +180,7 @@ export function sharePage() {
|
||||||
* Show error message about not implemented function.
|
* Show error message about not implemented function.
|
||||||
*/
|
*/
|
||||||
export function notImplemented() {
|
export function notImplemented() {
|
||||||
toast.error('Данная функция еще не реализована');
|
toast.error('Функционал в разработке');
|
||||||
console.error('Not implemented');
|
console.error('Not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user