Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added scroll and responsiveness to the plots page #9815

Prev Previous commit
Next Next commit
used useBreakpoints hook instead of useWindowDimensions
Utkarsh-Anandani committed Jan 7, 2025
commit 24ce109df1907c6aa97b1b216dcb4872d39c824c
6 changes: 3 additions & 3 deletions src/pages/Encounters/tabs/EncounterPlotsTab.tsx
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import {
} from "@/components/Common/Charts/ObservationChart";
import Loading from "@/components/Common/Loading";

import useWindowDimensions from "@/hooks/useWindowDimensions";
import useBreakpoints from "@/hooks/useBreakpoints";

import { EncounterTabProps } from "@/pages/Encounters/EncounterShow";

@@ -23,7 +23,7 @@ export const EncounterPlotsTab = (props: EncounterTabProps) => {
const { t } = useTranslation();
const [qParams, setQParams] = useQueryParams<QueryParams>();

const { width } = useWindowDimensions();
const isSmallDevice = useBreakpoints({ default: true, md: false });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const isSmallDevice = useBreakpoints({ default: true, md: false });
const plotColumns = useBreakpoints({ default: 1, md: 2 });


const { data, isLoading } = useQuery<ObservationPlotConfig>({
queryKey: ["plots-config"],
@@ -62,7 +62,7 @@ export const EncounterPlotsTab = (props: EncounterTabProps) => {
<ObservationVisualizer
patientId={props.patient.id}
codeGroups={tab.groups}
gridCols={width >= 768 ? 2 : 1}
gridCols={isSmallDevice ? 1 : 2}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gridCols={isSmallDevice ? 1 : 2}
gridCols={plotColumns}

/>
</TabsContent>
))}