Skip to content

Commit

Permalink
Merge pull request #2643 from Northeastern-Electric-Racing/#2630-sepe…
Browse files Browse the repository at this point in the history
…rate-changes

#2630 added distinction between project and work package proposed changes
  • Loading branch information
Peyton-McKee authored Jun 1, 2024
2 parents 7e82e8e + cba1099 commit ee0d2b0
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
PotentialChangeType,
changeBulletDetailText,
getPotentialChangeBackground,
ProposedChangeValue
ProposedChangeValue,
workPackageProposedChangesToPreview
} from '../../../utils/diff-page.utils';
import { labelPipe } from '../../../utils/pipes';

Expand All @@ -24,11 +25,18 @@ const DiffPanel: React.FC<ProjectDiffPanelProps> = ({
const theme = useTheme();

const changeBullets: ChangeBullet[][] = [[{ label: 'Proposed Changes', detail: 'None' }]];
const workPackagePreviews =
projectProposedChanges?.workPackageProposedChanges.map(workPackageProposedChangesToPreview) ?? [];
for (const projectKey in projectProposedChanges) {
if (projectProposedChanges.hasOwnProperty(projectKey)) {
if (projectKey === 'workPackageProposedChanges') {
for (const workPackage of projectProposedChanges.workPackageProposedChanges) {
const wpChangeBullets: ChangeBullet[] = [{ label: 'Work Package Proposed Changes', detail: 'None' }];
workPackagePreviews.forEach((workPackage, idx) => {
const wpChangeBullets: ChangeBullet[] = [
{
label: `Work Package Proposed Changes ${workPackagePreviews.length > 1 ? '#' + (idx + 1) : ''}`,
detail: 'None'
}
];
for (let workPackageKey in workPackage) {
if (workPackage.hasOwnProperty(workPackageKey)) {
if (workPackageKey === 'duration') {
Expand All @@ -53,7 +61,7 @@ const DiffPanel: React.FC<ProjectDiffPanelProps> = ({
}
}
changeBullets.push(wpChangeBullets);
}
});
} else {
changeBullets[0].push({
label: projectKey,
Expand Down Expand Up @@ -99,7 +107,7 @@ const DiffPanel: React.FC<ProjectDiffPanelProps> = ({
} else if (Array.isArray(detailText) && detailText.length > 0) {
if (typeof detailText[0] === 'string') {
return (
<List sx={{ listStyleType: 'disc', pl: 4 }}>
<List sx={{ listStyleType: 'disc', pl: 6 }}>
{(detailText as string[]).map((bullet) => {
const url = bullet.includes('http') ? bullet.split(': ')[1] : undefined;
return (
Expand Down Expand Up @@ -135,7 +143,9 @@ const DiffPanel: React.FC<ProjectDiffPanelProps> = ({

return potentialChangeType === PotentialChangeType.SAME ? (
<Typography>
{labelPipe(changeBullet.label)}: {renderDetailText(detailText)}
<Box pl={2}>
{labelPipe(changeBullet.label)}: {renderDetailText(detailText)}
</Box>
</Typography>
) : (
<Box
Expand All @@ -150,6 +160,7 @@ const DiffPanel: React.FC<ProjectDiffPanelProps> = ({
borderRadius: '5px',
width: 'fit-content'
}}
pl={2}
component="span"
display="inline"
>
Expand Down

0 comments on commit ee0d2b0

Please sign in to comment.