mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
Fix window sizing issues
This commit is contained in:
parent
3947778a35
commit
d227f7a5d9
|
@ -1,3 +1,4 @@
|
||||||
|
import { useMemo } from 'react';
|
||||||
import { Route, Routes } from 'react-router-dom';
|
import { Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import Footer from './components/Footer';
|
import Footer from './components/Footer';
|
||||||
|
@ -18,6 +19,17 @@ import UserProfilePage from './pages/UserProfilePage';
|
||||||
function App () {
|
function App () {
|
||||||
const { noNavigation } = useConceptTheme();
|
const { noNavigation } = useConceptTheme();
|
||||||
|
|
||||||
|
const scrollWindowSize = useMemo(() => {
|
||||||
|
return !noNavigation ?
|
||||||
|
'max-h-[calc(100vh-4.5rem)]'
|
||||||
|
: 'max-h-[100vh]';
|
||||||
|
}, [noNavigation]);
|
||||||
|
const mainSize = useMemo(() => {
|
||||||
|
return !noNavigation ?
|
||||||
|
'min-h-[calc(100vh-12rem)]'
|
||||||
|
: 'min-h-[calc(100vh-8rem)] ';
|
||||||
|
}, [noNavigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='antialiased clr-app'>
|
<div className='antialiased clr-app'>
|
||||||
<Navigation />
|
<Navigation />
|
||||||
|
@ -27,8 +39,9 @@ function App () {
|
||||||
draggable={false}
|
draggable={false}
|
||||||
pauseOnFocusLoss={false}
|
pauseOnFocusLoss={false}
|
||||||
/>
|
/>
|
||||||
<div className={`max-h-[calc(100vh-${noNavigation ? 0 : 4.5}rem)] overflow-auto`}>
|
|
||||||
<main className={`min-h-[calc(100vh-${noNavigation ? 8 : 12}rem)] px-2`}>
|
<div className={`${scrollWindowSize} overflow-auto`}>
|
||||||
|
<main className={`${mainSize} px-2`}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/' element={ <HomePage/>} />
|
<Route path='/' element={ <HomePage/>} />
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { GithubIcon } from './Icons';
|
||||||
|
|
||||||
function Footer() {
|
function Footer() {
|
||||||
return (
|
return (
|
||||||
<footer className='z-50 px-4 pt-2 pb-4 border-t-2 t clr-footer'>
|
<footer className='z-50 px-4 pt-2 pb-4 border-t-2 clr-footer'>
|
||||||
<div className='flex items-stretch justify-center w-full mx-auto'>
|
<div className='flex items-stretch justify-center w-full mx-auto'>
|
||||||
<div className='px-4 underline whitespace-nowrap'>
|
<div className='px-4 underline whitespace-nowrap'>
|
||||||
<Link to='/manuals' tabIndex={-1}>Справка</Link> <br/>
|
<Link to='/manuals' tabIndex={-1}>Справка</Link> <br/>
|
||||||
|
|
|
@ -65,6 +65,8 @@ function EditorConstituenta({ activeID, onShowAST, onCreateCst, onOpenEdit, onDe
|
||||||
setTextDefinition(activeCst.definition?.text?.raw ?? '');
|
setTextDefinition(activeCst.definition?.text?.raw ?? '');
|
||||||
setExpression(activeCst.definition?.formal ?? '');
|
setExpression(activeCst.definition?.formal ?? '');
|
||||||
setTypification(activeCst?.parse?.typification || 'N/A');
|
setTypification(activeCst?.parse?.typification || 'N/A');
|
||||||
|
} else if (schema && schema?.items.length > 0) {
|
||||||
|
onOpenEdit(schema.items[0].id);
|
||||||
}
|
}
|
||||||
}, [activeCst]);
|
}, [activeCst]);
|
||||||
|
|
||||||
|
@ -108,7 +110,7 @@ function EditorConstituenta({ activeID, onShowAST, onCreateCst, onOpenEdit, onDe
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex items-start w-full gap-2'>
|
<div className='flex items-start w-full gap-2'>
|
||||||
<form onSubmit={handleSubmit} className='flex-grow min-w-[50rem] max-w-min px-4 py-2 border'>
|
<form onSubmit={handleSubmit} className='flex-grow min-w-[50rem] max-w-min px-4 py-2 mb-2 border'>
|
||||||
<div className='flex items-start justify-between'>
|
<div className='flex items-start justify-between'>
|
||||||
<button type='submit'
|
<button type='submit'
|
||||||
title='Сохранить изменения'
|
title='Сохранить изменения'
|
||||||
|
|
|
@ -257,25 +257,25 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps)
|
||||||
<b>{selected.length}</b> из {schema?.stats?.count_all ?? 0}
|
<b>{selected.length}</b> из {schema?.stats?.count_all ?? 0}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{isEditable && <div className='flex items-center justify-start w-full gap-1'>
|
<div className='flex items-center justify-start w-full gap-1'>
|
||||||
<Button
|
<Button
|
||||||
tooltip='Переместить вверх'
|
tooltip='Переместить вверх'
|
||||||
icon={<ArrowUpIcon size={6}/>}
|
icon={<ArrowUpIcon size={6}/>}
|
||||||
disabled={nothingSelected}
|
disabled={!isEditable || nothingSelected}
|
||||||
dense
|
dense
|
||||||
onClick={handleMoveUp}
|
onClick={handleMoveUp}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
tooltip='Переместить вниз'
|
tooltip='Переместить вниз'
|
||||||
icon={<ArrowDownIcon size={6}/>}
|
icon={<ArrowDownIcon size={6}/>}
|
||||||
disabled={nothingSelected}
|
disabled={!isEditable || nothingSelected}
|
||||||
dense
|
dense
|
||||||
onClick={handleMoveDown}
|
onClick={handleMoveDown}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
tooltip='Удалить выбранные'
|
tooltip='Удалить выбранные'
|
||||||
icon={<DumpBinIcon color={!nothingSelected ? 'text-red' : ''} size={6}/>}
|
icon={<DumpBinIcon color={!nothingSelected ? 'text-red' : ''} size={6}/>}
|
||||||
disabled={nothingSelected}
|
disabled={!isEditable || nothingSelected}
|
||||||
dense
|
dense
|
||||||
onClick={handleDelete}
|
onClick={handleDelete}
|
||||||
/>
|
/>
|
||||||
|
@ -284,12 +284,14 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps)
|
||||||
tooltip='Переиндексировать имена'
|
tooltip='Переиндексировать имена'
|
||||||
icon={<ArrowsRotateIcon color='text-primary' size={6}/>}
|
icon={<ArrowsRotateIcon color='text-primary' size={6}/>}
|
||||||
dense
|
dense
|
||||||
|
disabled={!isEditable}
|
||||||
onClick={handleReindex}
|
onClick={handleReindex}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
tooltip='Новая конституента'
|
tooltip='Новая конституента'
|
||||||
icon={<SmallPlusIcon color='text-green' size={6}/>}
|
icon={<SmallPlusIcon color='text-green' size={6}/>}
|
||||||
dense
|
dense
|
||||||
|
disabled={!isEditable}
|
||||||
onClick={() => handleCreateCst()}
|
onClick={() => handleCreateCst()}
|
||||||
/>
|
/>
|
||||||
{(Object.values(CstType)).map(
|
{(Object.values(CstType)).map(
|
||||||
|
@ -299,6 +301,7 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps)
|
||||||
text={`${getCstTypePrefix(type)}`}
|
text={`${getCstTypePrefix(type)}`}
|
||||||
tooltip={getCstTypeShortcut(type)}
|
tooltip={getCstTypeShortcut(type)}
|
||||||
dense
|
dense
|
||||||
|
disabled={!isEditable}
|
||||||
onClick={() => handleCreateCst(type)}
|
onClick={() => handleCreateCst(type)}
|
||||||
/>;
|
/>;
|
||||||
})}
|
})}
|
||||||
|
@ -328,7 +331,7 @@ function EditorItems({ onOpenEdit, onCreateCst, onDeleteCst }: EditorItemsProps)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</ConceptTooltip>
|
</ConceptTooltip>
|
||||||
</div>}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='w-full h-full' onKeyDown={handleTableKey}>
|
<div className='w-full h-full' onKeyDown={handleTableKey}>
|
||||||
<ConceptDataTable
|
<ConceptDataTable
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { GraphLayoutSelector,mapLayoutLabels } from '../../utils/staticUI';
|
||||||
|
|
||||||
function EditorTermGraph() {
|
function EditorTermGraph() {
|
||||||
const { schema } = useRSForm();
|
const { schema } = useRSForm();
|
||||||
const { darkMode } = useConceptTheme();
|
const { darkMode, noNavigation } = useConceptTheme();
|
||||||
const [ layout, setLayout ] = useLocalStorage<LayoutTypes>('graph_layout', 'forceatlas2');
|
const [ layout, setLayout ] = useLocalStorage<LayoutTypes>('graph_layout', 'forceatlas2');
|
||||||
|
|
||||||
const [ filtered, setFiltered ] = useState<Graph>(new Graph());
|
const [ filtered, setFiltered ] = useState<Graph>(new Graph());
|
||||||
|
@ -91,6 +91,10 @@ function EditorTermGraph() {
|
||||||
focusOnSelect: false
|
focusOnSelect: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const canvasSize = !noNavigation ?
|
||||||
|
'w-[1240px] h-[736px] 2xl:w-[1880px] 2xl:h-[746px]'
|
||||||
|
: 'w-[1240px] h-[800px] 2xl:w-[1880px] 2xl:h-[810px]';
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<div className='relative w-full'>
|
<div className='relative w-full'>
|
||||||
<div className='absolute top-0 left-0 z-20 py-2 w-[12rem] flex flex-col'>
|
<div className='absolute top-0 left-0 z-20 py-2 w-[12rem] flex flex-col'>
|
||||||
|
@ -127,7 +131,7 @@ function EditorTermGraph() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='flex-wrap w-full h-full overflow-auto'>
|
<div className='flex-wrap w-full h-full overflow-auto'>
|
||||||
<div className='relative w-[1260px] h-[730px] 2xl:w-[1900px] 2xl:h-[750px]'>
|
<div className={`relative border-t border-r ${canvasSize}`}>
|
||||||
<GraphCanvas
|
<GraphCanvas
|
||||||
draggable
|
draggable
|
||||||
ref={graphRef}
|
ref={graphRef}
|
||||||
|
@ -142,7 +146,7 @@ function EditorTermGraph() {
|
||||||
onNodePointerOver={onNodePointerOver}
|
onNodePointerOver={onNodePointerOver}
|
||||||
onNodePointerOut={onNodePointerOut}
|
onNodePointerOut={onNodePointerOut}
|
||||||
cameraMode={ orbit ? 'orbit' : layout.includes('3d') ? 'rotate' : 'pan'}
|
cameraMode={ orbit ? 'orbit' : layout.includes('3d') ? 'rotate' : 'pan'}
|
||||||
layoutOverrides={ layout.includes('tree') ? { nodeLevelRatio: 3 } : undefined }
|
layoutOverrides={ layout.includes('tree') ? { nodeLevelRatio: 1 } : undefined }
|
||||||
labelFontUrl={resources.graph_font}
|
labelFontUrl={resources.graph_font}
|
||||||
theme={darkMode ? darkTheme : lightTheme}
|
theme={darkMode ? darkTheme : lightTheme}
|
||||||
renderNode={({ node, ...rest }) => (
|
renderNode={({ node, ...rest }) => (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user