Dynamic aspect ratio for HL7 and Ventilator Vitals Monitors #5976
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHAT
π€ Generated by Copilot at cd23ceb
This pull request improves the responsiveness and adaptability of the vitals monitor components, which display real-time vital signs of patients in the facility. It refactors the code to use a common interface and a configuration prop for the vitals monitor components, and to use a variable duration for the waveform rendering. It also simplifies the code structure and removes redundant comments. It affects the following files:
src/Components/Facility/ConsultationDetails.tsx
,src/Components/VitalsMonitor/*
,src/Common/hooks/useBreakpoints.ts
, andsrc/Common/hooks/useWindowDimensions.ts
.Proposed Changes
β Adds a utility hook:
useBreakpoints
to obtain value based on the current break-point.Usage:
β Made
duration
to be configurable for the Vitals Renderers.β Added utility method to get canvas render's size and duration based (configurable)
2023-08-01.17-27-35.mp4
Closes #5726
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
Merge Checklist
HOW
π€ Generated by Copilot at cd23ceb
useBreakpoints
hook to get the value mapped to the current breakpoint for the vitals monitor component (link, link)useWindowDimensions
hook touseBreakpoints
module and remove usage example (link, link)config
prop toHL7PatientVitalsMonitor
andVentilatorPatientVitalsMonitor
components to configure the vitals monitor renderer and canvas (link, link, link, link, link, link, link)PatientAssetBed
import fromHL7PatientVitalsMonitor
andVentilatorPatientVitalsMonitor
modules as it is imported fromtypes
module (link, link)style
prop ofdiv
andcanvas
elements inHL7PatientVitalsMonitor
andVentilatorPatientVitalsMonitor
modules and usewaveformCanvas.size
object directly (link, link, link, link, link, link, link, link)duration
property toOptions
interface andHL7VitalsRenderer
andVentilatorVitalsRenderer
class constructors to pass the duration of each row on the canvas (link, link, link, link)DURATION
constant withduration
property in the calculation ofdeltaX
property of each channel inHL7VitalsRenderer
andVentilatorVitalsRenderer
classes (link, link, link, link, link, link)DURATION
constant fromHL7VitalsRenderer
andVentilatorVitalsRenderer
modules as it is no longer needed (link, link)config
parameter touseHL7VitalsMonitor
anduseVentilatorVitalsMonitor
hooks to pass the size and duration of the vitals monitor canvas (link, link, link, link, link, link)MONITOR_WAVEFORMS_CANVAS_SIZE
constant withsize
property ofconfig
parameter in the return value ofuseHL7VitalsMonitor
anduseVentilatorVitalsMonitor
hooks (link, link)IVitalsComponentProps
interface totypes
module to define the common props for the vitals monitor components (link)PatientAssetBed
type andgetVitalsCanvasSizeAndDuration
function fromAssetTypes
andutils
modules respectively intypes
module (link)getVitalsCanvasSizeAndDuration
function toutils
module to return the size and duration of the vitals monitor canvas based on the given aspect ratio and scale or the default values based on the window dimensions and breakpoints (link)