diff --git a/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx
index 67c9c9e1..dbb03d67 100644
--- a/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx
+++ b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx
@@ -6,27 +6,18 @@ import OfferPercentileAnalysisText from './OfferPercentileAnalysisText';
import OfferProfileCard from './OfferProfileCard';
import { OVERALL_TAB } from '../constants';
-import type {
- Analysis,
- AnalysisHighestOffer,
- ProfileAnalysis,
-} from '~/types/offers';
-
-type OfferAnalysisData = {
- offer?: AnalysisHighestOffer;
- offerAnalysis?: Analysis;
-};
+import type { AnalysisUnit, ProfileAnalysis } from '~/types/offers';
type OfferAnalysisContentProps = Readonly<{
- analysis: OfferAnalysisData;
+ offerAnalysis: AnalysisUnit;
tab: string;
}>;
function OfferAnalysisContent({
- analysis: { offer, offerAnalysis },
+ offerAnalysis,
tab,
}: OfferAnalysisContentProps) {
- if (!offerAnalysis || !offer || offerAnalysis.noOfOffers === 0) {
+ if (!offerAnalysis || offerAnalysis.noOfOffers === 0) {
if (tab === OVERALL_TAB) {
return (
@@ -44,11 +35,7 @@ function OfferAnalysisContent({
}
return (
<>
-
+
Here are some of the top offers relevant to you:
{offerAnalysis.topPercentileOffers.map((topPercentileOffer) => (
;
@@ -72,55 +59,51 @@ export default function OfferAnalysis({
isLoading,
}: OfferAnalysisProps) {
const [tab, setTab] = useState(OVERALL_TAB);
- const [analysis, setAnalysis] = useState(null);
+ const [analysis, setAnalysis] = useState(
+ allAnalysis.overallAnalysis,
+ );
useEffect(() => {
if (tab === OVERALL_TAB) {
- setAnalysis({
- offer: allAnalysis?.overallHighestOffer,
- offerAnalysis: allAnalysis?.overallAnalysis,
- });
+ setAnalysis(allAnalysis.overallAnalysis);
} else {
- setAnalysis({
- offer: allAnalysis?.overallHighestOffer,
- offerAnalysis: allAnalysis?.companyAnalysis[0],
- });
+ setAnalysis(allAnalysis.companyAnalysis[parseInt(tab, 10)]);
}
}, [tab, allAnalysis]);
- const tabOptions = [
+ const companyTabs = allAnalysis.companyAnalysis.map((value, index) => ({
+ label: value.companyName,
+ value: `${index}`,
+ }));
+
+ let tabOptions = [
{
label: OVERALL_TAB,
value: OVERALL_TAB,
},
- {
- label: allAnalysis?.overallHighestOffer.company.name || '',
- value: allAnalysis?.overallHighestOffer.company.id || '',
- },
];
+ tabOptions = tabOptions.concat(companyTabs);
return (
- analysis && (
-
- {isError && (
-
- An error occurred while generating profile analysis.
-
- )}
- {isLoading &&
}
- {!isError && !isLoading && (
-
-
-
-
-
- )}
-
- )
+
+ {isError && (
+
+ An error occurred while generating profile analysis.
+
+ )}
+ {isLoading &&
}
+ {!isError && !isLoading && (
+
+
+
+
+
+ )}
+
);
}
diff --git a/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx
index d61af844..9b758402 100644
--- a/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx
+++ b/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx
@@ -1,17 +1,15 @@
import { OVERALL_TAB } from '../constants';
-import type { Analysis } from '~/types/offers';
+import type { AnalysisUnit } from '~/types/offers';
type OfferPercentileAnalysisTextProps = Readonly<{
- companyName: string;
- offerAnalysis: Analysis;
+ offerAnalysis: AnalysisUnit;
tab: string;
}>;
export default function OfferPercentileAnalysisText({
tab,
- companyName,
- offerAnalysis: { noOfOffers, percentile },
+ offerAnalysis: { noOfOffers, percentile, companyName },
}: OfferPercentileAnalysisTextProps) {
return tab === OVERALL_TAB ? (
diff --git a/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx
index 13cbd2d8..d708ae20 100644
--- a/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx
+++ b/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx
@@ -41,11 +41,13 @@ export default function OfferProfileCard({
{profileName}
-
-
- Current:
- {previousCompanies[0]}
-
+ {previousCompanies.length > 0 && (
+
+
+ Current:
+ {previousCompanies[0]}
+
+ )}
YOE:
diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
index d5aee9b0..77c2fc89 100644
--- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
@@ -17,12 +17,17 @@ export default function OffersSubmissionAnalysis({
Result
-
+ {!analysis && (
+
Error generating analysis.
+ )}
+ {analysis && (
+
+ )}
);
}
diff --git a/apps/portal/src/pages/offers/submit/result/[offerProfileId].tsx b/apps/portal/src/pages/offers/submit/result/[offerProfileId].tsx
index dd379145..23f38d6b 100644
--- a/apps/portal/src/pages/offers/submit/result/[offerProfileId].tsx
+++ b/apps/portal/src/pages/offers/submit/result/[offerProfileId].tsx
@@ -70,7 +70,9 @@ export default function OffersSubmissionResult() {
return (
<>
{getAnalysis.isLoading && (
-
+
+
+
)}
{!getAnalysis.isLoading && (