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

Fixed:Show more monitors in CNS on very large displays #6503 #9013

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ce241c3
Merge pull request #1 from ohcnetwork/develop
i0am0arunava Nov 6, 2024
7163bf8
Show more monitors in CNS on very large displays
i0am0arunava Nov 6, 2024
ebc5613
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 6, 2024
80e48d6
Merge pull request #2 from ohcnetwork/develop
i0am0arunava Nov 6, 2024
3f5fcd3
Merge pull request #3 from ohcnetwork/develop
i0am0arunava Nov 6, 2024
7974ef2
per page 9 monitors inserted for large display
i0am0arunava Nov 6, 2024
1801e16
added state per page 9 monitors inserted for large display
i0am0arunava Nov 6, 2024
180b214
added state per page 9 monitors inserted for large display
i0am0arunava Nov 6, 2024
6509672
added state per page 9 monitors inserted for large display
i0am0arunava Nov 6, 2024
2eb15ff
added usebreakpoint hook
i0am0arunava Nov 6, 2024
89d424c
added usebreakpoint hook
i0am0arunava Nov 6, 2024
7b16aa1
added usebreakpoint hook
i0am0arunava Nov 6, 2024
1e62a29
nothing
i0am0arunava Nov 6, 2024
4bb9541
added usebreakpoint hook
i0am0arunava Nov 6, 2024
a0baac9
added usebreakpoint hook
i0am0arunava Nov 6, 2024
2459be9
added usebreakpoint hook
i0am0arunava Nov 6, 2024
d986b2e
added usebreakpoint hook
i0am0arunava Nov 6, 2024
a7932ae
added usebreakpoint hook
i0am0arunava Nov 6, 2024
a5cc300
added usebrekpoint hook instead of usestate
i0am0arunava Nov 6, 2024
b17bfa5
increased column in 4k display
i0am0arunava Nov 7, 2024
596b0da
increased column in 4k display
i0am0arunava Nov 7, 2024
fc9e129
increased column in 4k display
i0am0arunava Nov 7, 2024
b867741
increased column in 4k display ok
i0am0arunava Nov 8, 2024
48af681
increased column in 4k display ok
i0am0arunava Nov 8, 2024
25f221a
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 9, 2024
087867b
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 9, 2024
93b9cc0
use proper naming conventions inline the breakpoint values so that ty…
i0am0arunava Nov 9, 2024
b867242
Merge branch 'issues/6503/displayCNSon4k' of https://github.com/i0am0…
i0am0arunava Nov 9, 2024
9e1ff97
remove unused lines and obvious comments
rithviknishad Nov 9, 2024
d306037
Using pixels instead of rem in the Tailwind config solved the problem
i0am0arunava Nov 9, 2024
0b3498a
use container queries
rithviknishad Nov 9, 2024
e969002
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 10, 2024
33f0bac
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 12, 2024
01d7b71
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 12, 2024
a00d6d4
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 12, 2024
8c9723c
fixed the bug of button click event.
i0am0arunava Nov 14, 2024
ea9e1ff
Merge remote-tracking branch 'kkp/develop' into issues/6503/displayCN…
i0am0arunava Nov 14, 2024
21a5bd9
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 18, 2024
ecd0871
Merge branch 'develop' into issues/6503/displayCNSon4k
i0am0arunava Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions src/components/Facility/CentralNursingStation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import HL7PatientVitalsMonitor from "@/components/VitalsMonitor/HL7PatientVitals
import useVitalsAspectRatioConfig from "@/components/VitalsMonitor/useVitalsAspectRatioConfig";
import { getVitalsMonitorSocketUrl } from "@/components/VitalsMonitor/utils";

import useBreakpoints from "@/hooks/useBreakpoints";
import useFilters from "@/hooks/useFilters";
import useFullscreen from "@/hooks/useFullscreen";

import routes from "@/Utils/request/api";
import useQuery from "@/Utils/request/useQuery";

const PER_PAGE_LIMIT = 6;

const SORT_OPTIONS: SortOption[] = [
{ isAscending: true, value: "bed__name" },
{ isAscending: false, value: "-bed__name" },
Expand All @@ -41,31 +40,34 @@ interface Props {
}

export default function CentralNursingStation({ facilityId }: Props) {
const perPageLimit = useBreakpoints({
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
default: 6,
"4xl": 9,
"4k": 24,
});
const { t } = useTranslation();
const [isFullscreen, setFullscreen] = useFullscreen();
const { qParams, updateQuery, removeFilter, updatePage } = useFilters({
limit: PER_PAGE_LIMIT,
limit: perPageLimit,
});
const query = useQuery(routes.listPatientAssetBeds, {
pathParams: { facility_external_id: facilityId },
query: {
...qParams,
page: qParams.page || 1,
limit: PER_PAGE_LIMIT,
offset: (qParams.page ? qParams.page - 1 : 0) * PER_PAGE_LIMIT,
limit: perPageLimit,
offset: (qParams.page ? qParams.page - 1 : 0) * perPageLimit,
asset_class: "HL7MONITOR",
ordering: qParams.ordering || "bed__name",
bed_is_occupied:
qParams.monitors_without_patient === "true" ? undefined : "true",
},
});

const totalCount = query.data?.count ?? 0;
const data = query.data?.results.map((obj) => ({
patientAssetBed: obj,
socketUrl: getVitalsMonitorSocketUrl(obj.asset),
}));

const { config, hash } = useVitalsAspectRatioConfig({
default: 6 / 11,
sm: 17 / 11,
Expand All @@ -88,7 +90,7 @@ export default function CentralNursingStation({ facilityId }: Props) {
<Pagination
className=""
cPage={qParams.page}
defaultPerPage={PER_PAGE_LIMIT}
defaultPerPage={perPageLimit}
data={{ totalCount }}
onChange={(page) => updatePage(page)}
/>
Expand Down Expand Up @@ -216,21 +218,23 @@ export default function CentralNursingStation({ facilityId }: Props) {
{t("no_vitals_present")}
</div>
) : (
<div className="3xl:grid-cols-3 mt-1 grid grid-cols-1 gap-1 lg:grid-cols-2">
{data.map((props, i) => (
<div className="overflow-hidden text-clip" key={i}>
<HL7PatientVitalsMonitor
patientCurrentBedAssignmentDate={
props.patientAssetBed?.patient?.last_consultation?.current_bed
?.start_date
}
key={`${props.patientAssetBed?.bed.id}-${hash}`}
patientAssetBed={props.patientAssetBed}
socketUrl={props.socketUrl || ""}
config={config}
/>
</div>
))}
<div className="@container">
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
<div className="mt-1 grid grid-cols-1 gap-1 @5xl:grid-cols-2 @7xl:grid-cols-3 @[140rem]:grid-cols-4 @[180rem]:grid-cols-5 @[240rem]:grid-cols-6">
{data.map((props, i) => (
<div className="overflow-hidden text-clip" key={i}>
<HL7PatientVitalsMonitor
patientCurrentBedAssignmentDate={
props.patientAssetBed?.patient?.last_consultation
?.current_bed?.start_date
}
key={`${props.patientAssetBed?.bed.id}-${hash}`}
patientAssetBed={props.patientAssetBed}
socketUrl={props.socketUrl || ""}
config={config}
/>
</div>
))}
</div>
</div>
)}
</Page>
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useBreakpoints.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useWindowDimensions from "@/hooks/useWindowDimensions";

type Breakpoints = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
type Breakpoints = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "4k";

// Ensure that the breakpoint widths are sorted in ascending order.
const BREAKPOINT_WIDTH: Record<Breakpoints, number> = {
Expand All @@ -10,6 +10,8 @@ const BREAKPOINT_WIDTH: Record<Breakpoints, number> = {
xl: 1280,
"2xl": 1536,
"3xl": 1920,
"4xl": 2560,
"4k": 3840,
};
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved

/**
Expand Down
Loading