Skip to content

Commit

Permalink
fix: ANT-2905 - Study creation: project input should not appear insid…
Browse files Browse the repository at this point in the history
…e modal (#72)

* fix: ANT-2905 - Study creation: project input should not appear inside modal

* fix: remove console log

---------

Co-authored-by: marlenetienne <[email protected]>
  • Loading branch information
marlenetienne and marlenetienne authored Mar 7, 2025
1 parent e9bc830 commit 47c6989
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
18 changes: 13 additions & 5 deletions src/components/common/modal/StudyCreationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ interface StudyCreationModalProps {
onClose: () => void;
study?: StudyDTO | null;
setReloadStudies: React.Dispatch<React.SetStateAction<boolean>>;
projectInfoName?: string;
}

const StudyCreationModal: React.FC<StudyCreationModalProps> = ({ onClose, study, setReloadStudies }) => {
const StudyCreationModal: React.FC<StudyCreationModalProps> = ({
onClose,
study,
setReloadStudies,
projectInfoName,
}) => {
const { t } = useTranslation();
const [studyName, setStudyName] = useState<string>('');
const [horizon, setHorizon] = useState<string>('');
const [projectName, setProjectName] = useState<string>(study?.project || '');
const [projectName, setProjectName] = useState<string>(study?.project || projectInfoName || '');
const [keywords, setKeywords] = useState<string[]>(study?.keywords || []);
const [trajectoryIds] = useState<number[]>(study?.trajectoryIds || []);
const [isFormValid, setIsFormValid] = useState(false);
Expand Down Expand Up @@ -107,9 +113,11 @@ const StudyCreationModal: React.FC<StudyCreationModalProps> = ({ onClose, study,
minNbCharacters={3}
/>
</div>
<div className="flex w-32 flex-col items-start justify-start">
<ProjectInput value={projectName} onChange={setProjectName} />
</div>
{study && (
<div className="flex w-32 flex-col items-start justify-start">
<ProjectInput value={projectName} onChange={setProjectName} />
</div>
)}
</div>
</RdsModal.Content>
<RdsModal.Footer>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/pegase/home/components/StudyTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import StudyCreationModal from '@common/modal/StudyCreationModal';
interface StudyTableDisplayProps {
searchStudy: string | undefined;
projectId?: string;
projectInfoName?: string;
}

const StudyTableDisplay = ({ searchStudy, projectId }: StudyTableDisplayProps) => {
const StudyTableDisplay = ({ searchStudy, projectId, projectInfoName }: StudyTableDisplayProps) => {
const { t } = useTranslation();
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
const [isHeaderHovered, setIsHeaderHovered] = useState<boolean>(false);
Expand Down Expand Up @@ -135,6 +136,7 @@ const StudyTableDisplay = ({ searchStudy, projectId }: StudyTableDisplayProps) =
onClose={toggleModal}
study={selectedStudy}
setReloadStudies={setReloadStudies}
projectInfoName={projectInfoName}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const ProjectDetails = () => {
status={activeChip ? 'secondary' : 'primary'}
/>
</div>
<StudyTableDisplay searchStudy={searchTerm} projectId={projectInfo.id} />
<StudyTableDisplay searchStudy={searchTerm} projectId={projectInfo.id} projectInfoName={projectInfo.name} />
</div>
);
};
Expand Down

0 comments on commit 47c6989

Please sign in to comment.