Skip to content

Commit

Permalink
fix update request not displaying for proponent + qol
Browse files Browse the repository at this point in the history
  • Loading branch information
djnunez-aot committed Jan 31, 2025
1 parent 0ad64ea commit 70b7fba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ 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";
import { Unless, When } from "react-if";

Check failure on line 16 in submit-web/src/components/Submission/UpdateRequestWidget/AddRequestNoteSection.tsx

View workflow job for this annotation

GitHub Actions / linting (18.x)

'Unless' is defined but never used

type AddRequestNoteSectionProps = Readonly<{
updateRequest: UpdateRequest;
Expand All @@ -27,10 +34,17 @@ export const AddRequestNoteSection = ({
});

const { roles } = useAccount();
const isProponent = checkIfProponent(roles);
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
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,12 @@ export default function SubmissionPage() {
</Box>
</Box>
<InfoBox submissionPackage={submissionPackage} />
{submissionPackage?.update_requests.length > 0 && (
<Box mt="1em" width="100%">
<UpdateRequestWidget
submissionPackage={submissionPackage}
summaryBackgroundColor="#FEF8E8"
/>
</Box>
)}
<Box mt="1em" width="100%">
<UpdateRequestWidget
submissionPackage={submissionPackage}
summaryBackgroundColor="#FEF8E8"
/>
</Box>
<Box
sx={{
mb: BCDesignTokens.layoutMarginXlarge,
Expand Down

0 comments on commit 70b7fba

Please sign in to comment.