diff --git a/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx
index 9664e7fb..2cf876f2 100644
--- a/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx
+++ b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx
@@ -6,29 +6,20 @@ 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;
+ analysis: AnalysisUnit;
isSubmission: boolean;
tab: string;
}>;
function OfferAnalysisContent({
- analysis: { offer, offerAnalysis },
+ analysis,
tab,
isSubmission,
}: OfferAnalysisContentProps) {
- if (!offerAnalysis || !offer || offerAnalysis.noOfOffers === 0) {
+ if (!analysis || analysis.noOfOffers === 0) {
if (tab === OVERALL_TAB) {
return (
@@ -47,9 +38,8 @@ function OfferAnalysisContent({
return (
<>
@@ -57,7 +47,7 @@ function OfferAnalysisContent({
? 'Here are some of the top offers relevant to you:'
: 'Relevant top offers:'}
- {offerAnalysis.topPercentileOffers.map((topPercentileOffer) => (
+ {analysis.topPercentileOffers.map((topPercentileOffer) => (
(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 (
- <>
+
+ {isError && (
+
+ An error occurred while generating profile analysis.
+
+ )}
{isLoading &&
}
- {analysis && (
+ {!isError && !isLoading && (
- {isError && (
-
- An error occurred while generating profile analysis.
-
- )}
- {!isError && !isLoading && (
-
-
-
-
-
- )}
+
+
+
)}
- >
+
);
}
diff --git a/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx
index 9b77f209..6ab2f7a6 100644
--- a/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx
+++ b/apps/portal/src/components/offers/offerAnalysis/OfferPercentileAnalysisText.tsx
@@ -1,18 +1,16 @@
import { OVERALL_TAB } from '../constants';
-import type { Analysis } from '~/types/offers';
+import type { AnalysisUnit } from '~/types/offers';
type OfferPercentileAnalysisTextProps = Readonly<{
- companyName: string;
+ analysis: AnalysisUnit;
isSubmission: boolean;
- offerAnalysis: Analysis;
tab: string;
}>;
export default function OfferPercentileAnalysisText({
tab,
- companyName,
- offerAnalysis: { noOfOffers, percentile },
+ analysis: { noOfOffers, percentile, companyName },
isSubmission,
}: 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 6d57e2b8..9ded08d2 100644
--- a/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx
+++ b/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx
@@ -47,11 +47,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 82b4895f..77c2fc89 100644
--- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionAnalysis.tsx
@@ -17,13 +17,17 @@ export default function OffersSubmissionAnalysis({
Result
-
+ {!analysis && (
+
Error generating analysis.
+ )}
+ {analysis && (
+
+ )}
);
}