ConceptPortal-public/rsconcept/frontend/src/features/rsform/components/InfoConstituenta.tsx
Ivan 74473f4cb5
Some checks are pending
Frontend CI / build (22.x) (push) Waiting to run
R: Remove all default exports
2025-02-19 23:30:35 +03:00

66 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import clsx from 'clsx';
import { IconChild } from '@/components/Icons';
import { CProps } from '@/components/props';
import { labelCstTypification } from '../labels';
import { IConstituenta } from '../models/rsform';
import { isBasicConcept } from '../models/rsformAPI';
interface InfoConstituentaProps extends CProps.Div {
data: IConstituenta;
}
export function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaProps) {
return (
<div className={clsx('dense min-w-[15rem] break-words', className)} {...restProps}>
<h2 className='cursor-default' title={data.is_inherited ? ' наследник' : undefined}>
{data.alias}
{data.is_inherited ? (
<IconChild size='1rem' className='inline-icon translate-y-[-0.1rem] translate-x-[0.125rem]' />
) : null}
</h2>
{data.term_resolved ? (
<p>
<b>Термин: </b>
{data.term_resolved || data.term_raw}
</p>
) : null}
<p className='break-all'>
<b>Типизация: </b>
<span className='font-math'>{labelCstTypification(data)}</span>
</p>
{data.definition_formal ? (
<p className='break-all'>
<b>Выражение: </b>
<span className='font-math'>{data.definition_formal}</span>
</p>
) : null}
{data.definition_resolved ? (
<p>
<b>Определение: </b>
{data.definition_resolved}
</p>
) : null}
{data.spawner_alias ? (
<p>
<b>Основание: </b>
{data.spawner_alias}
</p>
) : null}
{data.spawn_alias.length > 0 ? (
<p>
<b>Порождает: </b>
{data.spawn_alias.join(', ')}
</p>
) : null}
{data.convention ? (
<p>
<b>{isBasicConcept(data.cst_type) ? 'Конвенция' : 'Комментарий'}: </b>
{data.convention}
</p>
) : null}
</div>
);
}