Skip to content

Commit

Permalink
adds a check for total infringements and scheduled raesons according …
Browse files Browse the repository at this point in the history
…to which the + button will rendered
  • Loading branch information
sucheta90 committed Jan 18, 2024
1 parent 7f33d9e commit 326ae12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/UserProfile/BlueSquareLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const BlueSquareLayout = props => {
) : null}
</div>

<BlueSquare blueSquares={userProfile?.infringements} handleBlueSquare={handleBlueSquare} isInfringementMoreThanFive={isInfringementMoreThanFive} userRole={userProfile.role}/>
<BlueSquare blueSquares={userProfile?.infringements} handleBlueSquare={handleBlueSquare} isInfringementMoreThanFive={isInfringementMoreThanFive} userRole={userProfile.role} numberOfReasons={numberOfReasons} infringementsNum={infringementsNum}/>
{/* Replaces Schedule Blue Square button when there are more than 5 blue squares or scheduled reasons - by Sucheta */}
<div className="mt-4 w-100">
{
Expand Down
4 changes: 2 additions & 2 deletions src/components/UserProfile/BlueSquares/BlueSquare.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { formatDateFromDescriptionString } from 'utils/formatDateFromDescription
const BlueSquare = (props) => {
const isInfringementAuthorizer = props.hasPermission('infringementAuthorizer');
const canPutUserProfileImportantInfo = props.hasPermission('putUserProfileImportantInfo');
const { blueSquares, handleBlueSquare, isInfringementMoreThanFive } = props;
const { blueSquares, handleBlueSquare, isInfringementMoreThanFive, numberOfReasons, infringementsNum } = props;

return (
<div className="blueSquareContainer">
Expand Down Expand Up @@ -52,7 +52,7 @@ const BlueSquare = (props) => {
: null}
</div>

{isInfringementAuthorizer && !isInfringementMoreThanFive &&(
{isInfringementAuthorizer && (!(infringementsNum >= 5 || numberOfReasons >= 5 || (infringementsNum + numberOfReasons >= 5 ))) && (
<div
onClick={() => {
handleBlueSquare(true, 'addBlueSquare', '');
Expand Down

0 comments on commit 326ae12

Please sign in to comment.