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

🐛 Update Freq Col Alignment in Timeline Event Availability Chart #4558

Merged
Show file tree
Hide file tree
Changes from all commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 29 additions & 4 deletions src/pages/studyView/table/ClinicalEventTypeCountTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
import { action, computed, makeObservable, observable } from 'mobx';
import _ from 'lodash';
import MobxPromise from 'mobxpromise';
import React from 'react';
import React, { CSSProperties } from 'react';
import styles from 'pages/studyView/table/tables.module.scss';
import {
toNumericValue,
Expand All @@ -25,16 +25,26 @@ import {
import autobind from 'autobind-decorator';
import { SelectionOperatorEnum } from 'pages/studyView/TableUtils';
import { MultiSelectionTableRow } from 'pages/studyView/table/MultiSelectionTable';
import { getFrequencyStr } from 'pages/studyView/StudyViewUtils';
import {
correctMargin,
getFixedHeaderNumberCellMargin,
getFrequencyStr,
} from 'pages/studyView/StudyViewUtils';

export interface IClinicalEventTypeDataColumnCellProp {
data: string;
style?: CSSProperties;
className?: string;
}

function ClinicalEventTypeColumnCell(
props: IClinicalEventTypeDataColumnCellProp
) {
return <div>{props.data}</div>;
return (
<div className={props.className} style={props.style}>
{props.data}
</div>
);
}

export function filterClinicalEventTypeCountCell(
Expand Down Expand Up @@ -194,6 +204,8 @@ export default class ClinicalEventTypeCountTable extends React.Component<
),
render: (data: ClinicalEventTypeCount) => (
<ClinicalEventTypeColumnCell
className={styles.pullRight}
style={{ marginLeft: cellMargin }}
data={this.calculateClinicalEventTypeFreqString(
data,
this.selectedPatientCount
Expand Down Expand Up @@ -241,7 +253,20 @@ export default class ClinicalEventTypeCountTable extends React.Component<
return {
[ClinicalEventTypeCountColumnKey.CLINICAL_EVENT_TYPE]: 0,
[ClinicalEventTypeCountColumnKey.COUNT]: 0,
[ClinicalEventTypeCountColumnKey.FREQ]: 0,
[ClinicalEventTypeCountColumnKey.FREQ]: correctMargin(
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's this about? (i see it isn't new)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this to dynamically calculate the marge based on freq string.

This is similar to how MultiSelectionTable.tsx aligns the Freq column

getFixedHeaderNumberCellMargin(
this.columnsWidth[ClinicalEventTypeCountColumnKey.FREQ],
getFrequencyStr(
_.max(
this.tableData.map(
item =>
(item.count! / this.selectedPatientCount!) *
100
)
)!
)
)
),
};
}

Expand Down