Skip to content

Commit

Permalink
Refactor for better extendability.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bottle7 committed Jul 31, 2023
1 parent 01dc1f2 commit b295e14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import PendingReview from './pendingReview';
import ViewProgramAreaReview from './viewProgramArea';
import EditProgramAreaReview from './editProgramArea';
import { YesNoInput } from '../../../../types/enums/yes-no.enum';
import { statusList } from '../../../../utils/status';

export interface IReviewProps {
printPreview?: boolean;
Expand Down Expand Up @@ -196,6 +197,7 @@ const PIAReview = ({ printPreview }: IReviewProps) => {
const review = { isAcknowledged: mpoAcknowledged, reviewNote };
stateChangeHandler(review, `mpo`, true);
};

return (
<>
<section>
Expand Down Expand Up @@ -300,8 +302,9 @@ const PIAReview = ({ printPreview }: IReviewProps) => {
reviewForm.programArea?.selectedRoles.map(
(role: string, index: number) => {
return reviewForm.programArea?.selectedRoles &&
(pia.status === PiaStatuses.FINAL_REVIEW ||
pia.status === PiaStatuses.COMPLETE) ? (
// eslint-disable-next-line no-non-null-asserted-optional-chain
statusList?.(pia)?.[pia?.status!]?.Pages?.review
.viewProgramAreaReviews ? (
<div
className="d-flex align-items-center"
key={index}
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/src/utils/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SubmitButtonTextEnum } from '../pages/PIAForm';
export type PageAccessControl = {
[page: string]: {
accessControl: boolean;
viewProgramAreaReviews?: boolean;
};
};

Expand Down Expand Up @@ -293,6 +294,7 @@ export const statusList = (pia: IPiaForm | null): StatusList => {
Pages: {
review: {
accessControl: true,
viewProgramAreaReviews: true,
},
},
Privileges: {
Expand Down Expand Up @@ -414,6 +416,7 @@ export const statusList = (pia: IPiaForm | null): StatusList => {
Pages: {
review: {
accessControl: true,
viewProgramAreaReviews: true,
},
},
Privileges: {
Expand Down

0 comments on commit b295e14

Please sign in to comment.