From f73aff8b608bf5409d7aad8c898b90955c85909e Mon Sep 17 00:00:00 2001 From: Donald Kibet Date: Fri, 9 Feb 2024 03:19:25 +0300 Subject: [PATCH] (feat) Anchor workspace actions to the bottom of the screen in tablet mode --- .../action-menu/action-menu.component.tsx | 8 ++++-- .../patient-chart/patient-chart.component.tsx | 2 +- .../src/visit/visit-form/visit-form.scss | 22 ++++++++++------ .../src/conditions/conditions-form.scss | 5 +++- .../add-lab-order/lab-order-form.scss | 3 +++ .../src/add-drug-order/drug-order-form.scss | 25 +++++++++++-------- .../src/notes/visit-notes-form.scss | 7 ++++-- .../src/order-basket/order-basket.scss | 3 +++ 8 files changed, 52 insertions(+), 23 deletions(-) diff --git a/packages/esm-patient-chart-app/src/patient-chart/action-menu/action-menu.component.tsx b/packages/esm-patient-chart-app/src/patient-chart/action-menu/action-menu.component.tsx index 6ee90261d1..62c3cf2715 100644 --- a/packages/esm-patient-chart-app/src/patient-chart/action-menu/action-menu.component.tsx +++ b/packages/esm-patient-chart-app/src/patient-chart/action-menu/action-menu.component.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import classNames from 'classnames'; -import { ExtensionSlot } from '@openmrs/esm-framework'; +import { ExtensionSlot, useLayoutType } from '@openmrs/esm-framework'; import styles from './action-menu.scss'; interface ActionMenuInterface { @@ -10,7 +10,7 @@ interface ActionMenuInterface { export const ActionMenu: React.FC = ({ open }) => { const [keyboardVisible, setKeyboardVisible] = useState(false); const initialHeight = useRef(window.innerHeight); - + const isTablet = useLayoutType() === 'tablet'; useEffect(() => { const handleKeyboardVisibilityChange = () => { setKeyboardVisible(initialHeight.current > window.innerHeight); @@ -22,6 +22,10 @@ export const ActionMenu: React.FC = ({ open }) => { return () => window.removeEventListener('resize', handleKeyboardVisibilityChange); }, [initialHeight]); + if (open && isTablet) { + return null; + } + return (