ENCOA-228 Now when user navigates between modules the generation items persist. Reading, listening and writing added to level module

This commit is contained in:
Carlos-Mesquita
2024-11-12 14:17:54 +00:00
parent 696c968ebc
commit fdf411d133
66 changed files with 2546 additions and 1635 deletions

View File

@@ -1,13 +1,26 @@
interface Props {
label: string;
preview?: React.ReactNode;
type: string;
firstId: string;
lastId: string;
prompt: string;
}
const ExerciseLabel: React.FC<Props> = ({label, preview}) => {
const previewLabel = (text: string) => {
return <>
&quot;{text !== undefined ? text.replaceAll('\\n', ' ').split(' ').slice(0, 15).join(' ') : ""}...&quot;
</>
}
const label = (type: string, firstId: string, lastId: string) => {
return `${type} #${firstId} ${firstId === lastId ? '' : `- #${lastId}`}`;
}
const ExerciseLabel: React.FC<Props> = ({type, firstId, lastId, prompt}) => {
return (
<div className="flex w-full justify-between items-center mr-4">
<span className="font-semibold">{label}</span>
{preview && <div className="text-sm font-light italic">{preview}</div>}
<span className="font-semibold">{label(type, firstId, lastId)}</span>
<div className="text-sm font-light italic">{previewLabel(prompt)}</div>
</div>
);
}