Skip to content

Commit

Permalink
Merge pull request #272 from djnunez-aot/bug/remove-created-for-packa…
Browse files Browse the repository at this point in the history
…ge-version

Display note for Proponent update request
  • Loading branch information
jadmsaadaot authored Jan 31, 2025
2 parents e38a609 + a21dc54 commit 252fc9f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion submit-web/src/components/Shared/PermissionGate/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export const checkIfStaff = (roles?: string[]) => {
};

export const checkIfProponent = (roles?: string[]) => {
if (!roles) {
if (!roles || roles.length === 0) {
return true;
}
return false;
};

export const hasPermission = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import { checkIfProponent } from "@/components/Shared/PermissionGate/utils";
import { useCreatePackageUpdateRequesNote } from "@/hooks/api/usePackages";
import { UpdateRequest } from "@/models/UpdateRequest";
import { useAccount } from "@/store/accountStore";
import { Box, Button, Collapse, Stack, TextField } from "@mui/material";
import {
Box,
Button,
Collapse,
Stack,
TextField,
Typography,
} from "@mui/material";
import { BCDesignTokens } from "epic.theme";
import { useState } from "react";
import { When } from "react-if";
Expand All @@ -28,9 +35,16 @@ export const AddRequestNoteSection = ({

const { roles } = useAccount();
const isProponent = checkIfProponent(roles);

return (
<Box mt="1em">
<Collapse in={isAddingNote && !updateRequest.note}>
<Typography
variant="body1"
sx={{ mb: 1, fontWeight: BCDesignTokens.typographyFontWeightsBold }}
>
Note for the EAO
</Typography>
<TextField
onChange={handleNoteChange}
value={note}
Expand Down Expand Up @@ -69,7 +83,7 @@ export const AddRequestNoteSection = ({
</Button>
</Stack>
</Collapse>
<When condition={!updateRequest.note && !isAddingNote && isProponent}>
<When condition={isProponent && !updateRequest.note && !isAddingNote}>
<Button
color="primary"
variant="outlined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function RequestSection({

<When condition={showNoteSection}>
<Typography
variant="subtitle1"
variant="body1"
sx={{ mb: 1, fontWeight: BCDesignTokens.typographyFontWeightsBold }}
>
Note to EAO
Expand Down

0 comments on commit 252fc9f

Please sign in to comment.