2024-07-29 16:55:48 +03:00
|
|
|
import { ErrorData } from '@/components/info/InfoError';
|
|
|
|
import PickSubstitutions from '@/components/select/PickSubstitutions';
|
2024-08-26 17:24:46 +03:00
|
|
|
import TextArea from '@/components/ui/TextArea';
|
2024-07-29 16:55:48 +03:00
|
|
|
import DataLoader from '@/components/wrap/DataLoader';
|
2024-08-26 17:24:46 +03:00
|
|
|
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
2024-07-30 15:59:37 +03:00
|
|
|
import { ICstSubstitute } from '@/models/oss';
|
|
|
|
import { IRSForm } from '@/models/rsform';
|
2024-07-29 16:55:48 +03:00
|
|
|
import { prefixes } from '@/utils/constants';
|
|
|
|
|
|
|
|
interface TabSynthesisProps {
|
|
|
|
loading: boolean;
|
|
|
|
error: ErrorData;
|
2024-08-26 17:24:46 +03:00
|
|
|
validationText: string;
|
|
|
|
isCorrect: boolean;
|
2024-07-29 16:55:48 +03:00
|
|
|
|
2024-07-30 15:59:37 +03:00
|
|
|
schemas: IRSForm[];
|
2024-07-29 16:55:48 +03:00
|
|
|
substitutions: ICstSubstitute[];
|
|
|
|
setSubstitutions: React.Dispatch<React.SetStateAction<ICstSubstitute[]>>;
|
2024-08-28 15:42:57 +03:00
|
|
|
suggestions: ICstSubstitute[];
|
2024-07-29 16:55:48 +03:00
|
|
|
}
|
|
|
|
|
2024-08-26 17:24:46 +03:00
|
|
|
function TabSynthesis({
|
|
|
|
schemas,
|
|
|
|
loading,
|
|
|
|
error,
|
|
|
|
validationText,
|
|
|
|
isCorrect,
|
|
|
|
substitutions,
|
2024-08-28 15:42:57 +03:00
|
|
|
setSubstitutions,
|
|
|
|
suggestions
|
2024-08-26 17:24:46 +03:00
|
|
|
}: TabSynthesisProps) {
|
|
|
|
const { colors } = useConceptOptions();
|
2024-07-29 16:55:48 +03:00
|
|
|
return (
|
2024-07-30 15:59:37 +03:00
|
|
|
<DataLoader id='dlg-synthesis-tab' className='cc-column mt-3' isLoading={loading} error={error}>
|
2024-07-29 16:55:48 +03:00
|
|
|
<PickSubstitutions
|
2024-07-30 15:59:37 +03:00
|
|
|
schemas={schemas}
|
2024-07-29 16:55:48 +03:00
|
|
|
prefixID={prefixes.dlg_cst_substitutes_list}
|
2024-08-26 17:24:46 +03:00
|
|
|
rows={10}
|
2024-07-29 16:55:48 +03:00
|
|
|
substitutions={substitutions}
|
|
|
|
setSubstitutions={setSubstitutions}
|
2024-08-28 15:42:57 +03:00
|
|
|
suggestions={suggestions}
|
2024-07-29 16:55:48 +03:00
|
|
|
/>
|
2024-08-28 12:33:47 +03:00
|
|
|
<TextArea
|
|
|
|
disabled
|
|
|
|
value={validationText}
|
|
|
|
rows={4}
|
|
|
|
style={{ borderColor: isCorrect ? undefined : colors.fgRed }}
|
|
|
|
/>
|
2024-07-29 16:55:48 +03:00
|
|
|
</DataLoader>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TabSynthesis;
|