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

Progress Reports Grid - Cumulative Summary Column #1602

Merged
merged 2 commits into from
Oct 14, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const initialState = {
'varianceExplanation.reasons': false,
'engagement.project.isMember': false,
'engagement.project.pinned': false,
cumulativeSummary: false,
},
},
} satisfies DataGridProps['initialState'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
DataGridPro,
DataGridProProps as DataGridProps,
GridColDef,
GridRenderCellParams as RenderCellParams,
} from '@mui/x-data-grid-pro';
import { merge } from 'lodash';
import { useMemo } from 'react';
Expand Down Expand Up @@ -97,6 +98,24 @@ export const ProgressReportsColumnMap = {
filterable: false,
valueGetter: (_, row) => row.varianceExplanation.scheduleStatus,
},
cumulativeSummary: {
headerName: 'Cumulative Progress',
minWidth: 200,
sortable: false,
filterable: false,
renderCell: ({
value,
}: RenderCellParams<
ProgressReport,
ProgressReport['cumulativeSummary']
>) => (
<Box sx={{ my: 1, display: 'flex', gap: 2 }}>
<Metric label="Planned" value={value?.planned} />
<Metric label="Actual" value={value?.actual} />
<Metric label="Variance" value={value?.variance} />
</Box>
),
},
teamNews: {
headerName: 'Team News',
width: 400,
Expand Down Expand Up @@ -213,3 +232,12 @@ export const ProgressReportsGrid = ({
/>
);
};

const Metric = ({ label, value }: { label: string; value?: number }) => (
<Typography variant="body2">
<Box color={value ? undefined : 'text.disabled'}>
{value === undefined ? '—' : `${(value * 100).toFixed(1)}%`}
</Box>
<div>{label}</div>
</Typography>
);
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ fragment progressReportsDataGridRow on ProgressReport {
value
}
}
cumulativeSummary {
planned
actual
variance
}
teamNews {
items {
id
Expand Down
Loading