Skip to content

Commit

Permalink
chore: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brobro10000 committed Sep 18, 2024
1 parent 689d71d commit ede45ff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const AssignmentModalContent = ({
/>
</h4>
<AssignmentModalSummary
course={course}
courseRun={courseRun}
learnerEmails={learnerEmails}
assignmentAllocationMetadata={assignmentAllocationMetadata}
/>
Expand Down Expand Up @@ -206,7 +206,7 @@ AssignmentModalContent.propTypes = {
courseRun: PropTypes.shape({
enrollBy: PropTypes.string,
start: PropTypes.string,
contentPrice: PropTypes.string,
contentPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}).isRequired,
onEmailAddressesChange: PropTypes.func.isRequired,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import AssignmentModalSummaryErrorState from './AssignmentModalSummaryErrorState
const AssignmentModalSummaryContents = ({
hasLearnerEmails,
learnerEmails,
course,
courseRun,
hasInputValidationError,
}) => {
if (hasLearnerEmails) {
return (
<AssignmentModalSummaryLearnerList
course={course}
courseRun={courseRun}
learnerEmails={learnerEmails}
/>
);
Expand All @@ -32,7 +32,7 @@ const AssignmentModalSummaryContents = ({

// TODO: Pass course runs to take into account hte individual run content_price
const AssignmentModalSummary = ({
course,
courseRun,
learnerEmails,
assignmentAllocationMetadata,
}) => {
Expand Down Expand Up @@ -67,7 +67,7 @@ const AssignmentModalSummary = ({
<AssignmentModalSummaryContents
learnerEmails={learnerEmails}
hasLearnerEmails={hasLearnerEmails}
course={course}
courseRun={courseRun}
hasInputValidationError={!isValidInput}
/>
</Card.Section>
Expand Down Expand Up @@ -104,12 +104,16 @@ const AssignmentModalSummary = ({
AssignmentModalSummaryContents.propTypes = {
hasLearnerEmails: PropTypes.bool.isRequired,
learnerEmails: PropTypes.arrayOf(PropTypes.string).isRequired,
course: PropTypes.shape().isRequired, // pass-thru prop to child component(s)
courseRun: PropTypes.shape({
contentPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}).isRequired, // pass-thru prop to child component(s)
hasInputValidationError: PropTypes.bool.isRequired,
};

AssignmentModalSummary.propTypes = {
course: PropTypes.shape().isRequired, // pass-thru prop to child component(s)
courseRun: PropTypes.shape({
contentPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}).isRequired, // pass-thru prop to child component(s)
learnerEmails: PropTypes.arrayOf(PropTypes.string).isRequired,
assignmentAllocationMetadata: PropTypes.shape({
isValidInput: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { v4 as uuidv4 } from 'uuid';
import {
Button, Stack, Icon,
} from '@openedx/paragon';
import { Button, Icon, Stack } from '@openedx/paragon';
import { Person } from '@openedx/paragon/icons';
import { useIntl } from '@edx/frontend-platform/i18n';

import { MAX_INITIAL_LEARNER_EMAILS_DISPLAYED_COUNT, hasLearnerEmailsSummaryListTruncation } from '../cards/data';
import { hasLearnerEmailsSummaryListTruncation, MAX_INITIAL_LEARNER_EMAILS_DISPLAYED_COUNT } from '../cards/data';
import { formatPrice } from '../data';

const AssignmentModalSummaryLearnerList = ({
course,
courseRun,
learnerEmails,
}) => {
const [isTruncated, setIsTruncated] = useState(hasLearnerEmailsSummaryListTruncation(learnerEmails));
Expand Down Expand Up @@ -53,7 +52,7 @@ const AssignmentModalSummaryLearnerList = ({
</Stack>
</div>
<span className="ml-auto">
{course.formattedPrice}
{formatPrice(courseRun.contentPrice)}
</span>
</div>
</li>
Expand All @@ -74,8 +73,8 @@ const AssignmentModalSummaryLearnerList = ({
};

AssignmentModalSummaryLearnerList.propTypes = {
course: PropTypes.shape({
formattedPrice: PropTypes.string.isRequired,
courseRun: PropTypes.shape({
contentPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}).isRequired,
learnerEmails: PropTypes.arrayOf(PropTypes.string).isRequired,
};
Expand Down

0 comments on commit ede45ff

Please sign in to comment.