From d784ec634e788ee8a71508b9f5a58b89b62449b4 Mon Sep 17 00:00:00 2001 From: Nisarg Vadgama <31422051+ngunner15@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:36:04 -0800 Subject: [PATCH] feat: 1723 wcag landing dashboard (#1751) Co-authored-by: DustyD Co-authored-by: mgaseta <105936322+mgaseta@users.noreply.github.com> --- .../components/Card/FavouriteCard/index.tsx | 2 +- .../src/components/Card/SmallCard/index.tsx | 2 +- .../src/components/EmptySection/index.tsx | 4 +-- .../components/FavouriteActivities/index.tsx | 8 ++++- .../FavouriteActivities/styles.scss | 11 +++++++ .../OwnershipStep/SingleOwnerInfo/index.tsx | 18 +++++++----- .../OwnershipStep/index.tsx | 24 +++++++-------- frontend/src/components/Subtitle/index.tsx | 2 +- .../Seedlot/SeedlotRegFormClassA/RegPage.tsx | 29 +++++-------------- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/frontend/src/components/Card/FavouriteCard/index.tsx b/frontend/src/components/Card/FavouriteCard/index.tsx index ace32f568..287488d93 100644 --- a/frontend/src/components/Card/FavouriteCard/index.tsx +++ b/frontend/src/components/Card/FavouriteCard/index.tsx @@ -105,7 +105,7 @@ const FavouriteCard = ({ {ActionBtn}
-

{favObject.header}

+

{favObject.header}

); diff --git a/frontend/src/components/Card/SmallCard/index.tsx b/frontend/src/components/Card/SmallCard/index.tsx index 756e58e60..891c405b4 100644 --- a/frontend/src/components/Card/SmallCard/index.tsx +++ b/frontend/src/components/Card/SmallCard/index.tsx @@ -26,7 +26,7 @@ const SmallCard = ({ navigate(path)}>
-

{header}

+

{header}

{actionBtn} diff --git a/frontend/src/components/EmptySection/index.tsx b/frontend/src/components/EmptySection/index.tsx index 2a0bfb156..463ff3f7d 100644 --- a/frontend/src/components/EmptySection/index.tsx +++ b/frontend/src/components/EmptySection/index.tsx @@ -34,10 +34,10 @@ const EmptySection = ({ return (
-

+

{title}

- +
); }; diff --git a/frontend/src/components/FavouriteActivities/index.tsx b/frontend/src/components/FavouriteActivities/index.tsx index fdbbedd5e..4354283c8 100644 --- a/frontend/src/components/FavouriteActivities/index.tsx +++ b/frontend/src/components/FavouriteActivities/index.tsx @@ -51,7 +51,13 @@ const FavouriteActivities = () => { { - favActQuery.isLoading ? : null + favActQuery.isLoading + ? ( + + Loading, please wait... + + ) + : null } { favActQuery.isSuccess diff --git a/frontend/src/components/FavouriteActivities/styles.scss b/frontend/src/components/FavouriteActivities/styles.scss index 1f4a69440..5cf1797a7 100644 --- a/frontend/src/components/FavouriteActivities/styles.scss +++ b/frontend/src/components/FavouriteActivities/styles.scss @@ -33,6 +33,17 @@ } .favourite-activities-cards { + .visually-hidden{ + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip-path: inset(0); + border: 0; + } + padding-inline: 0; } diff --git a/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/SingleOwnerInfo/index.tsx b/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/SingleOwnerInfo/index.tsx index def92c54c..2f78c7ebf 100644 --- a/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/SingleOwnerInfo/index.tsx +++ b/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/SingleOwnerInfo/index.tsx @@ -35,13 +35,15 @@ interface SingleOwnerInfoProps { setState: Function, readOnly?: boolean, isReview?: boolean + isOwnershipStep?: boolean } const SingleOwnerInfo = ({ ownerInfo, defaultAgency, defaultCode, fundingSourcesQuery, methodsOfPaymentQuery, deleteAnOwner, checkPortionSum, setState, - readOnly, isReview + readOnly, isReview, isOwnershipStep }: SingleOwnerInfoProps) => { + const isReadOnly = readOnly && (isOwnershipStep || !isReview); const [ownerPortionInvalidText, setOwnerPortionInvalidText] = useState( inputText.portion.invalidText ); @@ -151,7 +153,7 @@ const SingleOwnerInfo = ({ locationCode: StringInputType ) => setClientAndCode(client, locationCode) } - readOnly={readOnly} + readOnly={isReadOnly} /> @@ -169,7 +171,7 @@ const SingleOwnerInfo = ({ }} invalid={ownerInfo.ownerPortion.isInvalid} invalidText={ownerPortionInvalidText} - readOnly={readOnly} + readOnly={isReadOnly} /> @@ -189,7 +191,7 @@ const SingleOwnerInfo = ({ onWheel={(e: React.ChangeEvent) => e.target.blur()} invalid={ownerInfo.reservedPerc.isInvalid} invalidText={reservedInvalidText} - readOnly={readOnly} + readOnly={isReadOnly} />
@@ -207,7 +209,7 @@ const SingleOwnerInfo = ({ onWheel={(e: React.ChangeEvent) => e.target.blur()} invalid={ownerInfo.surplusPerc.isInvalid} invalidText={surplusInvalidText} - readOnly={readOnly} + readOnly={isReadOnly} />
@@ -234,7 +236,7 @@ const SingleOwnerInfo = ({ onChange={(e: ComboBoxEvent) => handleFundingSource(e.selectedItem)} invalid={ownerInfo.fundingSource.isInvalid} invalidText={inputText.funding.invalidText} - readOnly={readOnly} + readOnly={isReadOnly} /> ) } @@ -259,7 +261,7 @@ const SingleOwnerInfo = ({ onChange={(e: ComboBoxEvent) => handleMethodOfPayment(e.selectedItem)} invalid={ownerInfo.methodOfPayment.isInvalid} invalidText={inputText.payment.invalidText} - readOnly={readOnly} + readOnly={isReadOnly} /> ) @@ -277,7 +279,7 @@ const SingleOwnerInfo = ({ className="owner-mod-btn" renderIcon={TrashCan} onClick={() => deleteAnOwner(ownerInfo.id)} - disabled={readOnly} + disabled={isReadOnly} > Delete owner diff --git a/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/index.tsx b/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/index.tsx index b28999843..3733db244 100644 --- a/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/index.tsx +++ b/frontend/src/components/SeedlotRegistrationSteps/OwnershipStep/index.tsx @@ -12,7 +12,6 @@ import { Add } from '@carbon/icons-react'; import ClassAContext from '../../../views/Seedlot/ContextContainerClassA/context'; import getMethodsOfPayment from '../../../api-service/methodsOfPaymentAPI'; -import { ForestClientType } from '../../../types/ForestClientTypes/ForestClientType'; import MultiOptionsObj from '../../../types/MultiOptionsObject'; import { getForestClientByNumberOrAcronym } from '../../../api-service/forestClientsAPI'; import { EmptyMultiOptObj } from '../../../shared-constants/shared-constants'; @@ -40,6 +39,7 @@ import { import { MAX_OWNERS } from './constants'; import './styles.scss'; +import { ForestClientType } from '../../../types/ForestClientTypes/ForestClientType'; type OwnershipStepProps = { isReview?: boolean @@ -48,7 +48,7 @@ type OwnershipStepProps = { /* Component */ -const OwnershipStep = ({ isReview = false }: OwnershipStepProps) => { +const OwnershipStep = ({ isReview }: OwnershipStepProps) => { const { allStepData: { ownershipStep: state }, setStepData, @@ -59,7 +59,6 @@ const OwnershipStep = ({ isReview = false }: OwnershipStepProps) => { } = useContext(ClassAContext); const [accordionControls, setAccordionControls] = useState({}); - const [originalSeedQty, setOriginalSeedQty] = useState(0); const refControl = useRef({}); @@ -110,11 +109,11 @@ const OwnershipStep = ({ isReview = false }: OwnershipStepProps) => { cacheTime: THREE_HALF_HOURS }); - const getSeedlotBySeedlotNumberQuery = useQuery({ - queryKey: ['get-seedlot-by-seedlotNumber', seedlotNumber], - queryFn: () => getSeedlotFromOracleDbBySeedlotNumber(seedlotNumber ?? ''), - enabled: isReview && !!seedlotNumber - }); + const getSeedlotBySeedlotNumberQuery = useQuery( + ['get-seedlot-by-seedlotNumber', seedlotNumber], + () => getSeedlotFromOracleDbBySeedlotNumber(seedlotNumber ?? ''), + { enabled: !!seedlotNumber } + ); // Set default method of payment for the first owner. useEffect(() => { @@ -150,14 +149,10 @@ const OwnershipStep = ({ isReview = false }: OwnershipStepProps) => { })) }); - useEffect(() => { - if (getSeedlotBySeedlotNumberQuery.status === 'success') { - setOriginalSeedQty(getSeedlotBySeedlotNumberQuery.data.data.originalSeedQty); - } - }, [getSeedlotBySeedlotNumberQuery.status, getSeedlotBySeedlotNumberQuery.fetchStatus]); - const getFcQuery = (clientNumber: string): ForestClientType | undefined => qc.getQueryData(['forest-clients', clientNumber]); + const originalSeedQty = getSeedlotBySeedlotNumberQuery.data?.data?.originalSeedQty ?? 0; + return (
@@ -226,6 +221,7 @@ const OwnershipStep = ({ isReview = false }: OwnershipStepProps) => { } readOnly={isFormSubmitted || originalSeedQty > 0} isReview={isReview} + isOwnershipStep /> )) diff --git a/frontend/src/components/Subtitle/index.tsx b/frontend/src/components/Subtitle/index.tsx index 3852150d6..a3e8e060b 100644 --- a/frontend/src/components/Subtitle/index.tsx +++ b/frontend/src/components/Subtitle/index.tsx @@ -8,7 +8,7 @@ interface SubtitleProps { } const Subtitle = ({ text, className }: SubtitleProps) => ( -
+
{text}
); diff --git a/frontend/src/views/Seedlot/SeedlotRegFormClassA/RegPage.tsx b/frontend/src/views/Seedlot/SeedlotRegFormClassA/RegPage.tsx index a881226fb..fa5728d8d 100644 --- a/frontend/src/views/Seedlot/SeedlotRegFormClassA/RegPage.tsx +++ b/frontend/src/views/Seedlot/SeedlotRegFormClassA/RegPage.tsx @@ -60,12 +60,6 @@ const RegPage = () => { const { isTscAdmin } = useContext(AuthContext); - const disableSubmit = !allStepCompleted - || saveStatus === 'conflict' - || !seedlotData - || (seedlotData.seedlotStatus.seedlotStatusCode !== 'PND' - && seedlotData.seedlotStatus.seedlotStatusCode !== 'INC'); - return (
@@ -182,21 +176,6 @@ const RegPage = () => { - { - formStep === 5 && disableSubmit - ? ( - - - - ) - : null - } { @@ -258,7 +237,13 @@ const RegPage = () => { { submitSeedlot.mutate( getSeedlotPayload(