diff --git a/package.json b/package.json index a2ec5df..0e57cc1 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "react-dom": "^18.2.0", "react-gauge-chart": "^0.4.1", "react-icons": "^4.9.0", + "react-image-marker": "^1.2.0", "react-leaflet": "^4.2.1", "react-router-dom": "^6.14.2", "react-scripts": "5.0.1", diff --git a/src/Assets/delete.png b/src/Assets/delete.png new file mode 100644 index 0000000..7df0d69 Binary files /dev/null and b/src/Assets/delete.png differ diff --git a/src/Assets/human_body_3d.jpg b/src/Assets/human_body_3d.jpg new file mode 100644 index 0000000..8357302 Binary files /dev/null and b/src/Assets/human_body_3d.jpg differ diff --git a/src/Components/ImageMarker/Entry.tsx b/src/Components/ImageMarker/Entry.tsx new file mode 100644 index 0000000..5e796da --- /dev/null +++ b/src/Components/ImageMarker/Entry.tsx @@ -0,0 +1,26 @@ +import Slider from '@mui/material/Slider'; +import IconButton from '@mui/material/IconButton'; + +import deleteIcon from '../../Assets/delete.png'; +import Rating from './Rating'; + +type Props = { + entry: any; + index: number; + onUpdate: (data: any) => void; + onDelete: (index: number) => void; +}; + +const Entry = ({ entry, onUpdate, onDelete, index }: Props) => { + return ( +
+ {index + 1} + + onDelete(index)}> + + +
+ ); +}; + +export default Entry; diff --git a/src/Components/ImageMarker/EntryForm.tsx b/src/Components/ImageMarker/EntryForm.tsx new file mode 100644 index 0000000..a793ce5 --- /dev/null +++ b/src/Components/ImageMarker/EntryForm.tsx @@ -0,0 +1,39 @@ +import Entry from './Entry'; +import { Button } from '@mui/material'; + +type Props = { + entries: Array; + onUpdate: (data: any) => void; + onDelete: (index: number) => void; + onSave: (data: any) => void; +}; + +const EntryForm = ({ entries, onUpdate, onDelete, onSave }: Props) => { + return ( +
+ *** Mark Your Areas of Pain on the Picture *** + {entries && entries.length > 0 && + How much pain are you in right now? + } + {entries?.map((entry: any, index: number) => ( + + ))} + {/* { + entries && entries.length > 0 && +
+ +
+ } */} +
+ ); +}; + +export default EntryForm; diff --git a/src/Components/ImageMarker/PatientImageMarker.css b/src/Components/ImageMarker/PatientImageMarker.css new file mode 100644 index 0000000..dc4906a --- /dev/null +++ b/src/Components/ImageMarker/PatientImageMarker.css @@ -0,0 +1,160 @@ +.image-marker-div { + width: 100%; + display: flex; + justify-content: space-between; +} + +.image-marker-div .entry-div { + width: 50%; +} + +.image-marker-div .entry-div .entryForm { + display: flex; + flex-direction: column; + gap: 10px; +} + +.image-marker-div .entry-div .entryForm .header { + font-weight: 500; + font-size: 18px; +} + +.image-marker-div .entry-div .entryForm .sub-header { + font-weight: 500; + font-size: 14px; +} + +.image-marker-div .entry-div .entryForm .entry { + margin-top: 1%; + display: flex; + align-items: center; + gap: 20px; +} + +.image-marker-div .marker-div { + /* margin-right: 5%; */ +} + +.image-marker-div .rating-div { + width: 80%; +} + +@media only screen and (max-width: 1200px) { + .image-marker-div { + flex-direction: column; + } + + .image-marker-div .entry-div { + width: 100%; + } + + .image-marker-div .rating-div { + width: 100%; + } + + .image-marker-div .entry-div .entryForm .entry { + gap: 0; + margin-bottom: 2%; + } +} + +@media only screen and (min-width: 1400px) { + .image-marker-div .rating-div { + width: 60%; + } +} + +.btn-scale { + min-width: 40px !important; + width: 3% !important; + text-align: center !important; + font-weight: bold !important; + color: black !important; + font-family: 'Lato', sans-serif; + border: none !important; + margin-left: 1% !important; +} + +.selected { + border: 3px solid black !important; +} + +.btn-scale-asc-1 { + background-color: #33FF00 !important; +} + +.btn-scale-asc-1:hover { + background-color: #2CDE00 !important; +} + +.btn-scale-asc-2 { + background-color: #66FF00 !important; +} + +.btn-scale-asc-2:hover { + background-color: #59DE00 !important; +} + +.btn-scale-asc-3 { + background-color: #99FF00 !important; +} + +.btn-scale-asc-3:hover { + background-color: #85DE00 !important; +} + +.btn-scale-asc-4 { + background-color: #CCFF00 !important; +} + +.btn-scale-asc-4:hover { + background-color: #B1DE00 !important; +} + +.btn-scale-asc-5 { + background-color: #FFFF00 !important; +} + +.btn-scale-asc-5:hover { + background-color: #DEDE00 !important; +} + +.btn-scale-asc-6 { + background-color: #FFCC00 !important; +} + +.btn-scale-asc-6:hover { + background-color: #DEB100 !important; +} + +.btn-scale-asc-7 { + background-color: #FF9900 !important; +} + +.btn-scale-asc-7:hover { + background-color: #DE8500 !important; +} + +.btn-scale-asc-8 { + background-color: #FF6600 !important; +} + +.btn-scale-asc-8 { + background-color: #DE5900 !important; +} + +.btn-scale-asc-9 { + background-color: #FF3300 !important; +} + +.btn-scale-asc-9:hover { + background-color: #DE2C00 !important; +} + +.btn-scale-asc-10 { + background-color: #FF0000 !important; +} + +.btn-scale-asc-10:hover { + background-color: #DE0000 !important; +} \ No newline at end of file diff --git a/src/Components/ImageMarker/PatientImageMarker.tsx b/src/Components/ImageMarker/PatientImageMarker.tsx new file mode 100644 index 0000000..be39ddb --- /dev/null +++ b/src/Components/ImageMarker/PatientImageMarker.tsx @@ -0,0 +1,70 @@ +import React, { useEffect, useState } from 'react' +import ImageMarker, { Marker } from 'react-image-marker'; + +import humanImage from '../../Assets/human_body_3d.jpg'; +import EntryForm from './EntryForm'; + +import './PatientImageMarker.css' + +type Props = {} + +const PatientImageMarker = (props: Props) => { + const [markers, setMarkers] = useState>([]); + const [entries, setEntries] = useState>([]); + const [action, setAction] = useState({}); + + const updateEntry = (updated: any) => { + setEntries((prevEntries) => + prevEntries.map((entry) => + entry.index === updated.index + ? { ...entry, severity: updated.severity } + : entry + ) + ); + }; + + const addEntries = (marker: Marker) => { + setAction({ type: 'add', index: 0 }); + setMarkers([...markers, marker]); + }; + + const deleteEntry = (index: number) => { + setAction({ type: 'delete', index: index }); + setMarkers(markers.filter((marker: Marker, ind: number) => ind != index)); + }; + + const onSave = () => { + + } + + useEffect(() => { + if (action.type === 'add') + setEntries([...entries, { index: entries.length + 1, severity: 5 }]); + else + setEntries( + entries.filter((entry: any, ind: number) => ind != action.index) + ); + }, [action]); + + return ( +
+
+ +
+
+ addEntries(marker)} + /> +
+
+ ) +} + +export default PatientImageMarker; \ No newline at end of file diff --git a/src/Components/ImageMarker/Rating.tsx b/src/Components/ImageMarker/Rating.tsx new file mode 100644 index 0000000..cb8906a --- /dev/null +++ b/src/Components/ImageMarker/Rating.tsx @@ -0,0 +1,30 @@ +import { Button, Tooltip } from '@mui/material'; +import React, { useState } from 'react'; + +type Props = { + index: number; + defaultValue: number; + onUpdate: (data: any) => void; +}; + +const Rating = ({index, defaultValue, onUpdate} : Props) => { + return ( +
+ {[...Array(10)].map((star, ind) => { + return ( + 7 ? 'Unbearable' : ''} placement="top-end"> + + + ); + })} +
+ ); +}; + +export default Rating; diff --git a/src/Components/PatientForm/PatientForm.tsx b/src/Components/PatientForm/PatientForm.tsx index e258f90..5999d78 100644 --- a/src/Components/PatientForm/PatientForm.tsx +++ b/src/Components/PatientForm/PatientForm.tsx @@ -19,6 +19,7 @@ import PastTreatment5 from './PastTreatment5'; import SystemReviewSection6 from './SyestemReviewSection6'; import RecreationalHobbiesSection7 from './RecreationalHobbiesSection7'; import OtherDetails8 from './OtherDetails8'; +import PatientImageMarker from '../ImageMarker/PatientImageMarker'; interface Patient { fullName: string; @@ -152,6 +153,17 @@ export default function PatientForm(){ + + + + Patient's Injury Image + + + + + + +