2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2023-12-13 14:32:57 +03:00
|
|
|
import { useConceptTheme } from '@/context/ThemeContext';
|
|
|
|
import { ExpressionStatus } from '@/models/rsform';
|
2024-01-06 03:15:02 +03:00
|
|
|
import { colorBgCstStatus } from '@/styling/color';
|
2023-12-13 14:32:57 +03:00
|
|
|
import { prefixes } from '@/utils/constants';
|
|
|
|
import { describeExpressionStatus, labelExpressionStatus } from '@/utils/labels';
|
2023-08-15 21:43:15 +03:00
|
|
|
|
2023-08-16 10:11:22 +03:00
|
|
|
interface InfoCstStatusProps {
|
2023-12-28 14:04:44 +03:00
|
|
|
title?: string;
|
2023-08-15 21:43:15 +03:00
|
|
|
}
|
|
|
|
|
2023-08-16 10:11:22 +03:00
|
|
|
function InfoCstStatus({ title }: InfoCstStatusProps) {
|
2023-08-27 00:19:19 +03:00
|
|
|
const { colors } = useConceptTheme();
|
|
|
|
|
2023-08-15 21:43:15 +03:00
|
|
|
return (
|
2023-12-28 14:04:44 +03:00
|
|
|
<div className='flex flex-col gap-1 mb-2'>
|
|
|
|
{title ? <h1>{title}</h1> : null}
|
|
|
|
{Object.values(ExpressionStatus)
|
|
|
|
.filter(status => status !== ExpressionStatus.UNDEFINED)
|
|
|
|
.map((status, index) => (
|
|
|
|
<p key={`${prefixes.cst_status_list}${index}`}>
|
|
|
|
<span
|
|
|
|
className={clsx(
|
2024-01-04 14:35:46 +03:00
|
|
|
'inline-block', // prettier: split lines
|
2023-12-28 14:04:44 +03:00
|
|
|
'min-w-[7rem]',
|
|
|
|
'px-1',
|
|
|
|
'border',
|
2023-12-30 19:43:24 +03:00
|
|
|
'text-center text-sm font-controls'
|
2023-12-28 14:04:44 +03:00
|
|
|
)}
|
|
|
|
style={{ backgroundColor: colorBgCstStatus(status, colors) }}
|
|
|
|
>
|
|
|
|
{labelExpressionStatus(status)}
|
|
|
|
</span>
|
|
|
|
<span> - </span>
|
|
|
|
<span>{describeExpressionStatus(status)}</span>
|
|
|
|
</p>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
2023-08-15 21:43:15 +03:00
|
|
|
}
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
export default InfoCstStatus;
|