From 3ecc75605220d18bdf59cdcb3d0c35f34841e1eb Mon Sep 17 00:00:00 2001 From: Ai Ling <50992674+ailing35@users.noreply.github.com> Date: Sun, 30 Oct 2022 22:41:35 +0800 Subject: [PATCH] [offers][feat] Add logo (#461) * [offers][feat] Add logo * [offers][fix] Fix table pagination * [offers][fix] Disable button on submit --- apps/portal/public/offers-logo.svg | 67 +++++++++++++++++++ .../components/offers/OffersNavigation.tsx | 7 +- .../offers/offerAnalysis/OfferAnalysis.tsx | 54 ++++++++------- .../offersSubmission/OffersSubmissionForm.tsx | 16 ++++- .../components/offers/table/OffersTable.tsx | 2 +- apps/portal/src/pages/offers/index.tsx | 14 ++-- 6 files changed, 120 insertions(+), 40 deletions(-) create mode 100644 apps/portal/public/offers-logo.svg diff --git a/apps/portal/public/offers-logo.svg b/apps/portal/public/offers-logo.svg new file mode 100644 index 00000000..6b98c89f --- /dev/null +++ b/apps/portal/public/offers-logo.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/portal/src/components/offers/OffersNavigation.tsx b/apps/portal/src/components/offers/OffersNavigation.tsx index ecb1ca5b..acc3f906 100644 --- a/apps/portal/src/components/offers/OffersNavigation.tsx +++ b/apps/portal/src/components/offers/OffersNavigation.tsx @@ -1,5 +1,3 @@ -import { CurrencyDollarIcon } from '@heroicons/react/24/outline'; - import type { ProductNavigationItems } from '~/components/global/ProductNavigation'; const navigation: ProductNavigationItems = [ @@ -11,10 +9,7 @@ const config = { // TODO: Change this to your own GA4 measurement ID. googleAnalyticsMeasurementID: 'G-34XRGLEVCF', logo: ( - + Tech Offers Repo ), navigation, showGlobalNav: false, diff --git a/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx index b8ae1c7c..9664e7fb 100644 --- a/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx +++ b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx @@ -118,31 +118,33 @@ export default function OfferAnalysis({ ]; return ( - analysis && ( -
- {isError && ( -

- An error occurred while generating profile analysis. -

- )} - {isLoading && } - {!isError && !isLoading && ( -
- - - -
- )} -
- ) + <> + {isLoading && } + {analysis && ( +
+ {isError && ( +

+ An error occurred while generating profile analysis. +

+ )} + {!isError && !isLoading && ( +
+ + + +
+ )} +
+ )} + ); } diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx index 4de2911d..02c9ed29 100644 --- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx +++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx @@ -110,7 +110,11 @@ export default function OffersSubmissionForm({ defaultValues: initialOfferProfileValues, mode: 'all', }); - const { handleSubmit, trigger } = formMethods; + const { + handleSubmit, + trigger, + formState: { isSubmitting, isSubmitSuccessful }, + } = formMethods; const generateAnalysisMutation = trpc.useMutation( ['offers.analysis.generate'], @@ -178,7 +182,7 @@ export default function OffersSubmissionForm({ const onSubmit: SubmitHandler = async (data) => { const result = await trigger(); - if (!result) { + if (!result || isSubmitting || isSubmitSuccessful) { return; } @@ -286,7 +290,13 @@ export default function OffersSubmissionForm({ variant="secondary" onClick={() => setStep(step - 1)} /> -