Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vesnushka committed Aug 15, 2023
1 parent 3c0ed56 commit 82ecbcf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 32 deletions.
39 changes: 21 additions & 18 deletions web/src/containers/Main/MappingEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import { Questionnaire, QuestionnaireResponse, Parameters } from 'fhir/r4b';
import { useEffect, useState } from 'react';
import { SingleValue } from 'react-select';
Expand All @@ -19,7 +20,7 @@ interface Props {
questionnaireRD: RemoteData<Questionnaire>;
onSave: (resource: WithId<Mapping>) => void;
onChange: (resource: WithId<Mapping>) => void;
mappingRD: RemoteData<Mapping>;
mappingRD: RemoteData<WithId<Mapping>>;
launchContext: Parameters;
questionnaireResponseRD: RemoteData<QuestionnaireResponse>;
reload: () => void;
Expand All @@ -32,7 +33,7 @@ export function MappingEditor(props: Props) {
const { mappingsRD } = useMappingEditor(questionnaireRD);
const [showSelect, setShowSelect] = useState(false);
const [showModal, setShowModal] = useState(false);
const [updatedResource, setUpdatedResource] = useState<Mapping | undefined>();
const [updatedResource, setUpdatedResource] = useState<WithId<Mapping> | undefined>();

useEffect(() => {
if (isFailure(questionnaireResponseRD) || isLoading(questionnaireResponseRD)) {
Expand Down Expand Up @@ -86,10 +87,10 @@ export function MappingEditor(props: Props) {
);
};

const renderEditor = (mapping: Mapping) => {
const renderEditor = (mapping: WithId<Mapping>) => {
return (
<>
<ResourceCodeEditor<Mapping>
<ResourceCodeEditor<WithId<Mapping>>
{...props}
resource={mapping}
onChange={setUpdatedResource}
Expand All @@ -104,20 +105,22 @@ export function MappingEditor(props: Props) {
>
remove
</Button>
{/* <Button
className={classNames(s.action, {
_active: !!updatedResource,
})}
disabled={!!updatedResource}
onClick={() => {
if (updatedResource) {
onSave(updatedResource);
setUpdatedResource(undefined);
}
}}
>
save
</Button> */}
{false && (
<Button
className={classNames(s.action, {
_active: !!updatedResource,
})}
disabled={!!updatedResource}
onClick={() => {
if (updatedResource) {
onSave(updatedResource);
setUpdatedResource(undefined);
}
}}
>
save
</Button>
)}
</div>
</>
);
Expand Down
31 changes: 17 additions & 14 deletions web/src/containers/Main/QuestionnaireEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import { Questionnaire, Parameters, QuestionnaireResponse } from 'fhir/r4b';
import { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
Expand Down Expand Up @@ -87,20 +88,22 @@ export function QuestionnaireEditor(props: Props) {
>
remove
</Button>
{/* <Button
className={classNames(s.action, {
_active: !!updatedResource,
})}
disabled={!!updatedResource}
onClick={() => {
if (updatedResource) {
onSave(updatedResource);
setUpdatedResource(undefined);
}
}}
>
save
</Button> */}
{false && (
<Button
className={classNames(s.action, {
_active: !!updatedResource,
})}
disabled={!!updatedResource}
onClick={() => {
if (updatedResource) {
onSave(updatedResource);
setUpdatedResource(undefined);
}
}}
>
save
</Button>
)}
</div>
</>
)}
Expand Down

0 comments on commit 82ecbcf

Please sign in to comment.