Skip to content

Commit

Permalink
feat: study-improvements (#47)
Browse files Browse the repository at this point in the history
minor improvements on study flow
  • Loading branch information
vuyaniShabangu authored Aug 1, 2024
1 parent 92a6e87 commit ad70ef1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions components/AddStudy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ const AddStudy: FC<Props> = ({ refetchStudies }) => {
setIsModalOpen(false);
};

const resetFormValues = () => {
form.setFieldsValue({ Study: '' });
form.setFieldsValue({ Description: '' });
};

const [form] = Form.useForm();

const createStudy = () => {
setLoading(true);
if (!projectId) {
Expand All @@ -45,6 +52,7 @@ const AddStudy: FC<Props> = ({ refetchStudies }) => {
setLoading(false);
toast(ToastType.SUCCESS, 'Study was successfully created');
handleCancel();
resetFormValues();
refetchStudies();
})
.catch((error) => {
Expand Down Expand Up @@ -72,6 +80,7 @@ const AddStudy: FC<Props> = ({ refetchStudies }) => {
<Form
size="large"
name="basic"
form={form}
style={{ minWidth: 400, margin: 'auto' }}
onFinish={createStudy}
layout="horizontal"
Expand Down
6 changes: 5 additions & 1 deletion components/ProjectDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function convertToTableData(responseData: any): Project {
title: responseData?.title,
projectId: responseData?.pid,
pathogen: {
commonName: '',
commonName: responseData?.pathogen?.common_name,
scientificName: '',
},
description: responseData?.description,
Expand Down Expand Up @@ -197,6 +197,10 @@ const ProjectDetails: React.FC = () => {
<span>Project ID</span>
<code>{project?.projectId}</code>
</div>
<div style={CardDivColumn}>
<span>Pathogen</span>
<code>{project?.pathogen?.commonName}</code>
</div>
<div style={CardDivColumn}>
<span>Created by:</span>
<span>{username}</span>
Expand Down

0 comments on commit ad70ef1

Please sign in to comment.