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

(fix) Tweak appearance of flagged vital signs #1423

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useState } from 'react';
import orderBy from 'lodash-es/orderBy';
import {
DataTable,
DataTableHeader,
DataTableRow,
Table,
TableCell,
TableContainer,
Expand All @@ -13,12 +15,13 @@ import {
import { useLayoutType, usePagination } from '@openmrs/esm-framework';
import { PatientChartPagination } from '@openmrs/esm-patient-common-lib';
import styles from './paginated-vitals.scss';

interface PaginatedVitalsProps {
pageSize: number;
pageUrl: string;
urlLabel: string;
tableRows: Array<Record<string, string>>;
tableHeaders: Array<Record<string, string | boolean>>;
tableRows: Array<typeof DataTableRow>;
denniskigen marked this conversation as resolved.
Show resolved Hide resolved
tableHeaders: Array<typeof DataTableHeader>;
isPrinting?: boolean;
}

Expand All @@ -31,6 +34,7 @@ const PaginatedVitals: React.FC<PaginatedVitalsProps> = ({
isPrinting,
}) => {
const isTablet = useLayoutType() === 'tablet';

const StyledTableCell = ({ interpretation, children }: { interpretation: string; children: React.ReactNode }) => {
switch (interpretation) {
case 'critically_high':
Expand Down Expand Up @@ -62,40 +66,20 @@ const PaginatedVitals: React.FC<PaginatedVitalsProps> = ({
? orderBy(tableRows, [key], ['desc'])
: orderBy(tableRows, [key], ['asc']);

function customSortRow(vitalA, vitalB, { sortDirection, sortStates, ...props }) {
const { key } = props;
setSortParams({ key, order: sortDirection });
}

const { results: paginatedVitals, goTo, currentPage } = usePagination(sortedData, pageSize);

const rows = isPrinting ? sortedData : paginatedVitals;

return (
<div>
<DataTable
rows={rows}
sortRow={customSortRow}
headers={tableHeaders}
isSortable
size={isTablet ? 'lg' : 'sm'}
useZebraStyles
>
{({ rows, headers, getHeaderProps, getTableProps }) => (
<DataTable rows={rows} headers={tableHeaders} size={isTablet ? 'lg' : 'sm'} useZebraStyles>
{({ rows, headers, getTableProps }) => (
<TableContainer>
<Table {...getTableProps()}>
<TableHead>
<TableRow>
{headers.map((header) => (
<TableHeader
className={`${styles.productiveHeading01} ${styles.text02}`}
{...getHeaderProps({
header,
isSortable: header.isSortable,
})}
>
{header.header?.content ?? header.header}
</TableHeader>
<TableHeader>{header.header?.content ?? header.header}</TableHeader>
))}
</TableRow>
</TableHead>
Expand Down
69 changes: 34 additions & 35 deletions packages/esm-patient-vitals-app/src/vitals/paginated-vitals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,55 @@

td {
white-space: nowrap;
}

&.criticallyLow, &.criticallyHigh, &.low, &.high {
td:nth-child(2) {
@include type.type-style("heading-compact-01");
}
.criticallyLow, .criticallyHigh, .low, .high {
td:nth-child(2) {
@include type.type-style("heading-compact-01");
}
}

&.criticallyLow, &.criticallyHigh {
outline: 2px solid colors.$red-60;
outline-offset: -1px;
}
.criticallyLow, .criticallyHigh {
border: 2px solid colors.$red-60 !important;
}

&.low, &.high {
outline: 1px solid colors.$black-100;
}
.low, .high {
border: 1.5px solid colors.$black-100 !important;
}

&.criticallyLow {
td:nth-child(2)::after {
content: " ↓↓";
}
.criticallyLow {
td:nth-child(2)::after {
content: " ↓↓";
}
}

&.criticallyHigh {
td:nth-child(2)::after {
content: " ↑↑";
}
.criticallyHigh {
td:nth-child(2)::after {
content: " ↑↑";
}
}

&.low {
td:nth-child(2)::after {
content: " ↓";
}
.low {
td:nth-child(2)::after {
content: " ↓";
}
}

&.high {
td:nth-child(2)::after {
content: " ↑";
}
.high {
td:nth-child(2)::after {
content: " ↑";
}
}

&.off-scale-low {
td:nth-child(2)::after {
content: " ↓↓↓";
}
.off-scale-low {
td:nth-child(2)::after {
content: " ↓↓↓";
}
}

&.off-scale-high {
td:nth-child(2)::after {
content: " ↑↑↑";
}
.off-scale-high {
td:nth-child(2)::after {
content: " ↑↑↑";
}
}

Expand Down
Loading