ConceptPortal-public/rsconcept/frontend/src/components/info/InfoConstituenta.tsx

65 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-04-01 11:13:50 +03:00
import clsx from 'clsx';
import { IConstituenta } from '@/models/rsform';
2024-04-06 22:36:37 +03:00
import { isBasicConcept } from '@/models/rsformAPI';
import { labelCstTypification } from '@/utils/labels';
2023-08-15 21:43:15 +03:00
2024-03-20 15:27:32 +03:00
import { CProps } from '../props';
interface InfoConstituentaProps extends CProps.Div {
2023-12-28 14:04:44 +03:00
data: IConstituenta;
2023-08-15 21:43:15 +03:00
}
2024-04-01 11:13:50 +03:00
function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaProps) {
2023-08-15 21:43:15 +03:00
return (
2024-04-05 20:04:12 +03:00
<div className={clsx('dense min-w-[15rem]', className)} {...restProps}>
2024-08-01 00:36:06 +03:00
<h2>
Конституента {data.alias}
{data.is_inherited ? ' (наследуется)' : ''}
</h2>
2024-04-06 23:09:25 +03:00
{data.term_resolved ? (
<p>
<b>Термин: </b>
{data.term_resolved || data.term_raw}
</p>
) : null}
2024-04-06 22:36:37 +03:00
<p>
<b>Типизация: </b>
{labelCstTypification(data)}
</p>
2023-12-28 14:04:44 +03:00
{data.definition_formal ? (
<p>
<b>Выражение: </b>
{data.definition_formal}
</p>
) : null}
{data.definition_resolved ? (
<p>
<b>Определение: </b>
{data.definition_resolved}
</p>
) : null}
{data.parent_alias ? (
2024-04-06 22:36:37 +03:00
<p>
<b>Основание: </b>
{data.parent_alias}
2024-04-06 22:36:37 +03:00
</p>
) : null}
{data.children_alias.length > 0 ? (
2024-04-06 22:36:37 +03:00
<p>
<b>Порождает: </b>
{data.children_alias.join(', ')}
2024-04-06 22:36:37 +03:00
</p>
) : null}
2023-12-28 14:04:44 +03:00
{data.convention ? (
<p>
2024-04-06 22:36:37 +03:00
<b>{isBasicConcept(data.cst_type) ? 'Конвенция' : 'Комментарий'}: </b>
2023-12-28 14:04:44 +03:00
{data.convention}
</p>
) : null}
</div>
);
2023-08-15 21:43:15 +03:00
}
2023-12-28 14:04:44 +03:00
export default InfoConstituenta;