mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-08-14 21:00:37 +03:00
Improve UI design
This commit is contained in:
parent
9391d757d7
commit
2bc14c24bd
|
@ -7,7 +7,7 @@ interface DropdownProps {
|
||||||
function Dropdown({ children, dimensions = 'w-fit', stretchLeft }: DropdownProps) {
|
function Dropdown({ children, dimensions = 'w-fit', stretchLeft }: DropdownProps) {
|
||||||
return (
|
return (
|
||||||
<div className='relative text-sm'>
|
<div className='relative text-sm'>
|
||||||
<div className={`absolute ${stretchLeft ? 'right-0' : 'left-0'} mt-2 py-1 z-tooltip flex flex-col items-stretch justify-start origin-top-right border divide-y divide-inherit rounded-md shadow-lg clr-input ${dimensions}`}>
|
<div className={`absolute ${stretchLeft ? 'right-0' : 'left-0'} mt-2 z-tooltip flex flex-col items-stretch justify-start origin-top-right border divide-y divide-inherit rounded-md shadow-lg clr-input ${dimensions}`}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@ function Form({ title, onSubmit, dimensions = 'max-w-xs', children }: FormProps)
|
||||||
className={`border shadow-md py-2 clr-app px-6 flex flex-col gap-3 ${dimensions}`}
|
className={`border shadow-md py-2 clr-app px-6 flex flex-col gap-3 ${dimensions}`}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
>
|
>
|
||||||
{ title && <h1 className='text-xl font-bold whitespace-nowrap'>{title}</h1> }
|
{ title && <h1 className='text-xl whitespace-nowrap'>{title}</h1> }
|
||||||
{children}
|
{children}
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|
|
@ -35,6 +35,10 @@ function SelectMulti<
|
||||||
borderWidth: '1px',
|
borderWidth: '1px',
|
||||||
borderColor: colors.border
|
borderColor: colors.border
|
||||||
}),
|
}),
|
||||||
|
menuList: (styles) => ({
|
||||||
|
...styles,
|
||||||
|
padding: '0px'
|
||||||
|
}),
|
||||||
input: (styles) => ({...styles}),
|
input: (styles) => ({...styles}),
|
||||||
placeholder: (styles) => ({...styles}),
|
placeholder: (styles) => ({...styles}),
|
||||||
multiValue: styles => ({
|
multiValue: styles => ({
|
||||||
|
|
|
@ -27,6 +27,10 @@ function SelectSingle<
|
||||||
borderRadius: '0.25rem',
|
borderRadius: '0.25rem',
|
||||||
cursor: isDisabled ? 'not-allowed' : 'pointer'
|
cursor: isDisabled ? 'not-allowed' : 'pointer'
|
||||||
}),
|
}),
|
||||||
|
menuList: (styles) => ({
|
||||||
|
...styles,
|
||||||
|
padding: '0px'
|
||||||
|
}),
|
||||||
option: (styles, { isSelected }) => ({
|
option: (styles, { isSelected }) => ({
|
||||||
...styles,
|
...styles,
|
||||||
backgroundColor: isSelected ? colors.bgSelected : styles.backgroundColor,
|
backgroundColor: isSelected ? colors.bgSelected : styles.backgroundColor,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { useAuth } from '../../context/AuthContext';
|
import { useAuth } from '../../context/AuthContext';
|
||||||
import { useConceptNavigation } from '../../context/NagivationContext';
|
import { useConceptNavigation } from '../../context/NagivationContext';
|
||||||
import { useConceptTheme } from '../../context/ThemeContext';
|
import { useConceptTheme } from '../../context/ThemeContext';
|
||||||
import { LibraryFilterStrategy } from '../../models/miscelanious';
|
|
||||||
import Dropdown from '../Common/Dropdown';
|
import Dropdown from '../Common/Dropdown';
|
||||||
import DropdownButton from '../Common/DropdownButton';
|
import DropdownButton from '../Common/DropdownButton';
|
||||||
|
|
||||||
|
@ -25,11 +24,6 @@ function UserDropdown({ hideDropdown }: UserDropdownProps) {
|
||||||
logout(() => navigateTo('/login/'));
|
logout(() => navigateTo('/login/'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateMyWork = () => {
|
|
||||||
hideDropdown();
|
|
||||||
navigateTo(`/library?filter=${LibraryFilterStrategy.PERSONAL}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown dimensions='w-36' stretchLeft>
|
<Dropdown dimensions='w-36' stretchLeft>
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
|
@ -44,9 +38,6 @@ function UserDropdown({ hideDropdown }: UserDropdownProps) {
|
||||||
>
|
>
|
||||||
{darkMode ? 'Светлая тема' : 'Темная тема'}
|
{darkMode ? 'Светлая тема' : 'Темная тема'}
|
||||||
</DropdownButton>
|
</DropdownButton>
|
||||||
<DropdownButton onClick={navigateMyWork}>
|
|
||||||
Мои схемы
|
|
||||||
</DropdownButton>
|
|
||||||
<DropdownButton onClick={logoutAndRedirect}>
|
<DropdownButton onClick={logoutAndRedirect}>
|
||||||
<b>Выйти...</b>
|
<b>Выйти...</b>
|
||||||
</DropdownButton>
|
</DropdownButton>
|
||||||
|
|
|
@ -229,7 +229,7 @@ function DlgEditReference({ hideWindow, items, initial, onSave }: DlgEditReferen
|
||||||
canSubmit={isValid}
|
canSubmit={isValid}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
>
|
>
|
||||||
<div className='min-w-[40rem] max-w-[40rem] flex flex-col gap-4 mb-4 mt-2 min-h-[34rem]'>
|
<div className='min-w-[40rem] max-w-[40rem] flex flex-col gap-4 mb-4 min-h-[34rem]'>
|
||||||
<div className='flex items-center self-center flex-start'>
|
<div className='flex items-center self-center flex-start'>
|
||||||
<ReferenceTypeButton
|
<ReferenceTypeButton
|
||||||
type={ReferenceType.ENTITY}
|
type={ReferenceType.ENTITY}
|
||||||
|
|
|
@ -12,7 +12,7 @@ function ReferenceTypeButton({ type, isSelected, onSelect, ...props }: Reference
|
||||||
return (
|
return (
|
||||||
<button type='button' tabIndex={-1}
|
<button type='button' tabIndex={-1}
|
||||||
onClick={() => onSelect(type)}
|
onClick={() => onSelect(type)}
|
||||||
className={`min-w-[12rem] px-2 py-1 border font-semibold rounded-none cursor-pointer clr-btn-clear clr-hover ${isSelected ? 'clr-selected': ''}`}
|
className={`min-w-[12rem] px-2 py-1 border font-semibold small-caps rounded-none cursor-pointer clr-btn-clear clr-hover ${isSelected ? 'clr-selected': ''}`}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{labelReferenceType(type)}
|
{labelReferenceType(type)}
|
||||||
|
|
|
@ -122,7 +122,11 @@
|
||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
h1 {
|
h1 {
|
||||||
@apply text-lg font-bold text-center
|
@apply text-lg font-semibold text-center
|
||||||
|
}
|
||||||
|
|
||||||
|
b {
|
||||||
|
@apply font-semibold
|
||||||
}
|
}
|
||||||
|
|
||||||
.border {
|
.border {
|
||||||
|
|
|
@ -9,8 +9,8 @@ interface TopicsListProps {
|
||||||
|
|
||||||
function TopicsList({ activeTopic, onChangeTopic }: TopicsListProps) {
|
function TopicsList({ activeTopic, onChangeTopic }: TopicsListProps) {
|
||||||
return (
|
return (
|
||||||
<div className='sticky top-0 left-0 border-r border-b min-w-[13rem] pt-2 select-none flex flex-col clr-controls'>
|
<div className='sticky top-0 left-0 border-x min-w-[13rem] select-none flex flex-col clr-controls small-caps h-fit'>
|
||||||
<div className='mb-2 font-semibold text-center'>Справка</div>
|
<div className='my-2 text-lg text-center'>Справка</div>
|
||||||
{ Object.values(HelpTopic).map(
|
{ Object.values(HelpTopic).map(
|
||||||
(topic, index) => {
|
(topic, index) => {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -34,7 +34,7 @@ function ManualsPage() {
|
||||||
}, [search, setActiveTopic, navigateTopic]);
|
}, [search, setActiveTopic, navigateTopic]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex w-full gap-2 justify-stretch' style={{minHeight: mainHeight}}>
|
<div className='flex w-full gap-2 justify-start items-start' style={{minHeight: mainHeight}}>
|
||||||
<TopicsList
|
<TopicsList
|
||||||
activeTopic={activeTopic}
|
activeTopic={activeTopic}
|
||||||
onChangeTopic={topic => onSelectTopic(topic)}
|
onChangeTopic={topic => onSelectTopic(topic)}
|
||||||
|
|
|
@ -136,8 +136,8 @@ function EditorConstituenta({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex w-full max-w-[1500px] gap-2 mt-2 justify-stretch'>
|
<div className='flex w-full max-w-[1500px] gap-2 justify-stretch'>
|
||||||
<form onSubmit={handleSubmit} className='min-w-[50rem] max-w-min px-4 py-2 border'>
|
<form onSubmit={handleSubmit} className='min-w-[50rem] max-w-min px-4 py-2'>
|
||||||
<div className='relative w-full'>
|
<div className='relative w-full'>
|
||||||
<div className='absolute top-0 right-0 flex items-start justify-between w-full'>
|
<div className='absolute top-0 right-0 flex items-start justify-between w-full'>
|
||||||
{activeCst &&
|
{activeCst &&
|
||||||
|
@ -249,7 +249,7 @@ function EditorConstituenta({
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{(windowSize.width ?? 0) >= SIDELIST_HIDE_THRESHOLD &&
|
{(windowSize.width ?? 0) >= SIDELIST_HIDE_THRESHOLD &&
|
||||||
<div className='self-stretch w-full border'>
|
<div className='self-stretch w-full border mt-10'>
|
||||||
<ViewSideConstituents
|
<ViewSideConstituents
|
||||||
expression={expression}
|
expression={expression}
|
||||||
baseHeight={UNFOLDED_HEIGHT}
|
baseHeight={UNFOLDED_HEIGHT}
|
||||||
|
|
|
@ -60,7 +60,7 @@ function RSTabs() {
|
||||||
cstCreate, cstDelete, cstRename, subscribe, unsubscribe, cstUpdate
|
cstCreate, cstDelete, cstRename, subscribe, unsubscribe, cstUpdate
|
||||||
} = useRSForm();
|
} = useRSForm();
|
||||||
const { destroySchema } = useLibrary();
|
const { destroySchema } = useLibrary();
|
||||||
const { setNoFooter } = useConceptTheme();
|
const { setNoFooter, noNavigation } = useConceptTheme();
|
||||||
|
|
||||||
const { isModified, setIsModified } = useModificationPrompt();
|
const { isModified, setIsModified } = useModificationPrompt();
|
||||||
|
|
||||||
|
@ -89,6 +89,13 @@ function RSTabs() {
|
||||||
|
|
||||||
const [showEditTerm, setShowEditTerm] = useState(false);
|
const [showEditTerm, setShowEditTerm] = useState(false);
|
||||||
|
|
||||||
|
const panelHeight = useMemo(
|
||||||
|
() => {
|
||||||
|
return !noNavigation ?
|
||||||
|
'calc(100vh - 4.8rem - 4px)'
|
||||||
|
: 'calc(100vh - 2rem - 4px)';
|
||||||
|
}, [noNavigation]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (schema) {
|
if (schema) {
|
||||||
const oldTitle = document.title
|
const oldTitle = document.title
|
||||||
|
@ -386,48 +393,50 @@ function RSTabs() {
|
||||||
<ConceptTab className='min-w-[6.5rem]'>Граф термов</ConceptTab>
|
<ConceptTab className='min-w-[6.5rem]'>Граф термов</ConceptTab>
|
||||||
</TabList>
|
</TabList>
|
||||||
|
|
||||||
<TabPanel className='flex gap-4 w-fit'>
|
<div className='overflow-y-auto' style={{ maxHeight: panelHeight}}>
|
||||||
<EditorRSForm
|
<TabPanel className='flex gap-4 w-fit'>
|
||||||
isModified={isModified}
|
<EditorRSForm
|
||||||
setIsModified={setIsModified}
|
isModified={isModified}
|
||||||
onDownload={onDownloadSchema}
|
setIsModified={setIsModified}
|
||||||
onDestroy={onDestroySchema}
|
onDownload={onDownloadSchema}
|
||||||
onClaim={onClaimSchema}
|
onDestroy={onDestroySchema}
|
||||||
onShare={onShareSchema}
|
onClaim={onClaimSchema}
|
||||||
/>
|
onShare={onShareSchema}
|
||||||
{schema.stats && <RSFormStats stats={schema.stats}/>}
|
/>
|
||||||
</TabPanel>
|
{schema.stats && <RSFormStats stats={schema.stats}/>}
|
||||||
|
</TabPanel>
|
||||||
|
|
||||||
<TabPanel className='w-full'>
|
<TabPanel className='w-full'>
|
||||||
<EditorItems
|
<EditorItems
|
||||||
onOpenEdit={onOpenCst}
|
onOpenEdit={onOpenCst}
|
||||||
onCreateCst={promptCreateCst}
|
onCreateCst={promptCreateCst}
|
||||||
onDeleteCst={promptDeleteCst}
|
onDeleteCst={promptDeleteCst}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
|
||||||
<TabPanel className='flex justify-center w-full'>
|
<TabPanel className='flex justify-center w-full'>
|
||||||
<EditorConstituenta
|
<EditorConstituenta
|
||||||
isModified={isModified}
|
isModified={isModified}
|
||||||
setIsModified={setIsModified}
|
setIsModified={setIsModified}
|
||||||
activeID={activeID}
|
activeID={activeID}
|
||||||
activeCst={activeCst}
|
activeCst={activeCst}
|
||||||
onOpenEdit={onOpenCst}
|
onOpenEdit={onOpenCst}
|
||||||
onShowAST={onShowAST}
|
onShowAST={onShowAST}
|
||||||
onCreateCst={promptCreateCst}
|
onCreateCst={promptCreateCst}
|
||||||
onDeleteCst={promptDeleteCst}
|
onDeleteCst={promptDeleteCst}
|
||||||
onRenameCst={promptRenameCst}
|
onRenameCst={promptRenameCst}
|
||||||
onEditTerm={promptShowEditTerm}
|
onEditTerm={promptShowEditTerm}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
|
||||||
<TabPanel>
|
<TabPanel>
|
||||||
<EditorTermGraph
|
<EditorTermGraph
|
||||||
onOpenEdit={onOpenCst}
|
onOpenEdit={onOpenCst}
|
||||||
onCreateCst={promptCreateCst}
|
onCreateCst={promptCreateCst}
|
||||||
onDeleteCst={promptDeleteCst}
|
onDeleteCst={promptDeleteCst}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
</div>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</>}
|
</>}
|
||||||
</div>);
|
</div>);
|
||||||
|
|
|
@ -206,8 +206,8 @@ function ViewSideConstituents({ expression, baseHeight, activeID, onOpenEdit }:
|
||||||
() => {
|
() => {
|
||||||
const siblingHeight = `${baseHeight} - ${LOCAL_NAVIGATION_H}`
|
const siblingHeight = `${baseHeight} - ${LOCAL_NAVIGATION_H}`
|
||||||
return (noNavigation ?
|
return (noNavigation ?
|
||||||
`calc(min(100vh - 5.2rem, ${siblingHeight}))`
|
`calc(min(100vh - 7.2rem, ${siblingHeight}))`
|
||||||
: `calc(min(100vh - 8.7rem, ${siblingHeight}))`);
|
: `calc(min(100vh - 10.7rem, ${siblingHeight}))`);
|
||||||
}, [noNavigation, baseHeight]);
|
}, [noNavigation, baseHeight]);
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user