removed save button and added autosave on marking
This commit is contained in:
parent
67b6c5921c
commit
60c1152a38
@ -11,10 +11,12 @@ type Props = {
|
|||||||
const EntryForm = ({ entries, onUpdate, onDelete, onSave }: Props) => {
|
const EntryForm = ({ entries, onUpdate, onDelete, onSave }: Props) => {
|
||||||
return (
|
return (
|
||||||
<div className='entryForm'>
|
<div className='entryForm'>
|
||||||
<span className='header'>*** Mark Your Areas of Pain on the Picture ***</span>
|
<span className='header'>
|
||||||
{entries && entries.length > 0 &&
|
*** Mark Your Areas of Pain on the Picture ***
|
||||||
|
</span>
|
||||||
|
{entries && entries.length > 0 && (
|
||||||
<span className='sub-header'>How much pain are you in right now?</span>
|
<span className='sub-header'>How much pain are you in right now?</span>
|
||||||
}
|
)}
|
||||||
{entries?.map((entry: any, index: number) => (
|
{entries?.map((entry: any, index: number) => (
|
||||||
<Entry
|
<Entry
|
||||||
entry={entry}
|
entry={entry}
|
||||||
@ -24,14 +26,14 @@ const EntryForm = ({ entries, onUpdate, onDelete, onSave }: Props) => {
|
|||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{
|
{/* {
|
||||||
entries && entries.length > 0 &&
|
entries && entries.length > 0 &&
|
||||||
<div className='buttonDiv'>
|
<div className='buttonDiv'>
|
||||||
<Button variant='contained' onClick={() => onSave({})}>
|
<Button variant='contained' onClick={() => onSave({})}>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
} */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react';
|
||||||
import ImageMarker, { Marker } from 'react-image-marker';
|
import ImageMarker, { Marker } from 'react-image-marker';
|
||||||
|
|
||||||
import humanImage from '../../Assets/human_body_3d.jpg';
|
import humanImage from '../../Assets/human_body_3d.jpg';
|
||||||
import EntryForm from './EntryForm';
|
import EntryForm from './EntryForm';
|
||||||
|
|
||||||
import './PatientImageMarker.css'
|
import './PatientImageMarker.css';
|
||||||
|
|
||||||
type Props = {}
|
type Props = {};
|
||||||
|
|
||||||
const PatientImageMarker = (props: Props) => {
|
const PatientImageMarker = (props: Props) => {
|
||||||
const [markers, setMarkers] = useState<Array<Marker>>([]);
|
const [markers, setMarkers] = useState<Array<Marker>>([]);
|
||||||
@ -38,7 +38,7 @@ const PatientImageMarker = (props: Props) => {
|
|||||||
'entry',
|
'entry',
|
||||||
JSON.stringify({ markers: markers, entries: entries })
|
JSON.stringify({ markers: markers, entries: entries })
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (action.type === 'add')
|
if (action.type === 'add')
|
||||||
@ -48,26 +48,30 @@ const PatientImageMarker = (props: Props) => {
|
|||||||
entries.filter((entry: any, ind: number) => ind != action.index)
|
entries.filter((entry: any, ind: number) => ind != action.index)
|
||||||
);
|
);
|
||||||
}, [action]);
|
}, [action]);
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='image-marker-div'>
|
|
||||||
<div className='entry-div'>
|
|
||||||
<EntryForm
|
|
||||||
entries={entries}
|
|
||||||
onSave={onSave}
|
|
||||||
onDelete={deleteEntry}
|
|
||||||
onUpdate={updateEntry}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className='marker-div'>
|
|
||||||
<ImageMarker
|
|
||||||
src={humanImage}
|
|
||||||
markers={markers}
|
|
||||||
onAddMarker={(marker: Marker) => addEntries(marker)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default PatientImageMarker;
|
useEffect(() => {
|
||||||
|
onSave();
|
||||||
|
}, [entries]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='image-marker-div'>
|
||||||
|
<div className='entry-div'>
|
||||||
|
<EntryForm
|
||||||
|
entries={entries}
|
||||||
|
onSave={onSave}
|
||||||
|
onDelete={deleteEntry}
|
||||||
|
onUpdate={updateEntry}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className='marker-div'>
|
||||||
|
<ImageMarker
|
||||||
|
src={humanImage}
|
||||||
|
markers={markers}
|
||||||
|
onAddMarker={(marker: Marker) => addEntries(marker)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PatientImageMarker;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user