Small UI fixes

This commit is contained in:
IRBorisov 2024-04-06 22:36:37 +03:00
parent a10bda8af3
commit 6e8801628d
3 changed files with 37 additions and 19 deletions

View File

@ -1,6 +1,7 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { IConstituenta } from '@/models/rsform'; import { IConstituenta } from '@/models/rsform';
import { isBasicConcept } from '@/models/rsformAPI';
import { labelCstTypification } from '@/utils/labels'; import { labelCstTypification } from '@/utils/labels';
import { CProps } from '../props'; import { CProps } from '../props';
@ -13,26 +14,14 @@ function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaPro
return ( return (
<div className={clsx('dense min-w-[15rem]', className)} {...restProps}> <div className={clsx('dense min-w-[15rem]', className)} {...restProps}>
<h2>Конституента {data.alias}</h2> <h2>Конституента {data.alias}</h2>
{data.derived_from_alias ? (
<p>
<b>Основание: </b>
{data.derived_from_alias}
</p>
) : null}
{data.derived_children_alias.length > 0 ? (
<p>
<b>Порождает: </b>
{data.derived_children_alias.join(', ')}
</p>
) : null}
<p>
<b>Типизация: </b>
{labelCstTypification(data)}
</p>
<p> <p>
<b>Термин: </b> <b>Термин: </b>
{data.term_resolved || data.term_raw} {data.term_resolved || data.term_raw}
</p> </p>
<p>
<b>Типизация: </b>
{labelCstTypification(data)}
</p>
{data.definition_formal ? ( {data.definition_formal ? (
<p> <p>
<b>Выражение: </b> <b>Выражение: </b>
@ -45,9 +34,21 @@ function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaPro
{data.definition_resolved} {data.definition_resolved}
</p> </p>
) : null} ) : null}
{data.derived_from_alias ? (
<p>
<b>Основание: </b>
{data.derived_from_alias}
</p>
) : null}
{data.derived_children_alias.length > 0 ? (
<p>
<b>Порождает: </b>
{data.derived_children_alias.join(', ')}
</p>
) : null}
{data.convention ? ( {data.convention ? (
<p> <p>
<b>Конвенция: </b> <b>{isBasicConcept(data.cst_type) ? 'Конвенция' : 'Комментарий'}: </b>
{data.convention} {data.convention}
</p> </p>
) : null} ) : null}

View File

@ -249,7 +249,7 @@ function RSTabsMenu({ onDestroy }: RSTabsMenuProps) {
tabIndex={-1} tabIndex={-1}
titleHtml='<b>Архив</b>: Редактирование запрещено<br />Перейти к актуальной версии' titleHtml='<b>Архив</b>: Редактирование запрещено<br />Перейти к актуальной версии'
hideTitle={accessMenu.isOpen} hideTitle={accessMenu.isOpen}
className='h-full' className='h-full px-2'
icon={<LuArchive size='1.25rem' className='icon-primary' />} icon={<LuArchive size='1.25rem' className='icon-primary' />}
onClick={() => controller.viewVersion(undefined)} onClick={() => controller.viewVersion(undefined)}
/> />

View File

@ -9,6 +9,7 @@ import clsx from 'clsx';
import { IEntityReference, ISyntacticReference } from '@/models/language'; import { IEntityReference, ISyntacticReference } from '@/models/language';
import { parseGrammemes } from '@/models/languageAPI'; import { parseGrammemes } from '@/models/languageAPI';
import { IConstituenta } from '@/models/rsform'; import { IConstituenta } from '@/models/rsform';
import { isBasicConcept } from '@/models/rsformAPI';
import { colorFgGrammeme, IColorTheme } from '../styling/color'; import { colorFgGrammeme, IColorTheme } from '../styling/color';
import { describeConstituentaTerm, labelCstTypification, labelGrammeme } from './labels'; import { describeConstituentaTerm, labelCstTypification, labelGrammeme } from './labels';
@ -161,9 +162,25 @@ export function domTooltipConstituenta(cst?: IConstituenta) {
if (cst.convention) { if (cst.convention) {
const convention = document.createElement('p'); const convention = document.createElement('p');
if (isBasicConcept(cst.cst_type)) {
convention.innerHTML = `<b>Конвенция:</b> ${cst.convention}`; convention.innerHTML = `<b>Конвенция:</b> ${cst.convention}`;
} else {
convention.innerHTML = `<b>Комментарий:</b> ${cst.convention}`;
}
dom.appendChild(convention); dom.appendChild(convention);
} }
if (cst.derived_from_alias) {
const derived = document.createElement('p');
derived.innerHTML = `<b>Основание:</b> ${cst.derived_from_alias}`;
dom.appendChild(derived);
}
if (cst.derived_children_alias.length > 0) {
const children = document.createElement('p');
children.innerHTML = `<b>Порождает:</b> ${cst.derived_children_alias.join(', ')}`;
dom.appendChild(children);
}
} else { } else {
const text = document.createElement('p'); const text = document.createElement('p');
text.innerText = 'Конституента не определена'; text.innerText = 'Конституента не определена';