diff --git a/apps/portal/src/components/offers/constants.ts b/apps/portal/src/components/offers/constants.ts index 63a57d0e..10e3b0b1 100644 --- a/apps/portal/src/components/offers/constants.ts +++ b/apps/portal/src/components/offers/constants.ts @@ -110,9 +110,30 @@ export const educationFieldOptions = [ ]; export enum FieldError { - NonNegativeNumber = 'Please fill in a non-negative number in this field.', - Number = 'Please fill in a number in this field.', - Required = 'Please fill in this field.', + NON_NEGATIVE_NUMBER = 'Please fill in a non-negative number in this field.', + NUMBER = 'Please fill in a number in this field.', + REQUIRED = 'Please fill in this field.', } export const OVERALL_TAB = 'Overall'; + +export enum ProfileDetailTab { + ANALYSIS = 'Offer Engine Analysis', + BACKGROUND = 'Background', + OFFERS = 'Offers', +} + +export const profileDetailTabs = [ + { + label: ProfileDetailTab.OFFERS, + value: ProfileDetailTab.OFFERS, + }, + { + label: ProfileDetailTab.BACKGROUND, + value: ProfileDetailTab.BACKGROUND, + }, + { + label: ProfileDetailTab.ANALYSIS, + value: ProfileDetailTab.ANALYSIS, + }, +]; diff --git a/apps/portal/src/components/offers/offersSubmission/analysis/OfferAnalysis.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx similarity index 71% rename from apps/portal/src/components/offers/offersSubmission/analysis/OfferAnalysis.tsx rename to apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx index 19d944d1..67c9c9e1 100644 --- a/apps/portal/src/components/offers/offersSubmission/analysis/OfferAnalysis.tsx +++ b/apps/portal/src/components/offers/offerAnalysis/OfferAnalysis.tsx @@ -2,11 +2,9 @@ import { useEffect } from 'react'; import { useState } from 'react'; import { HorizontalDivider, Spinner, Tabs } from '@tih/ui'; -import { trpc } from '~/utils/trpc'; - import OfferPercentileAnalysisText from './OfferPercentileAnalysisText'; import OfferProfileCard from './OfferProfileCard'; -import { OVERALL_TAB } from '../../constants'; +import { OVERALL_TAB } from '../constants'; import type { Analysis, @@ -29,10 +27,18 @@ function OfferAnalysisContent({ tab, }: OfferAnalysisContentProps) { if (!offerAnalysis || !offer || offerAnalysis.noOfOffers === 0) { + if (tab === OVERALL_TAB) { + return ( +
+ You are the first to submit an offer for your job title and YOE! Check + back later when there are more submissions. +
+ ); + } return (- You are the first to submit an offer for these companies! Check back - later when there are more submissions. + You are the first to submit an offer for this company, job title and + YOE! Check back later when there are more submissions.
); } @@ -55,12 +61,17 @@ function OfferAnalysisContent({ } type OfferAnalysisProps = Readonly<{ - profileId?: string; + allAnalysis?: ProfileAnalysis | null; + isError: boolean; + isLoading: boolean; }>; -export default function OfferAnalysis({ profileId }: OfferAnalysisProps) { +export default function OfferAnalysis({ + allAnalysis, + isError, + isLoading, +}: OfferAnalysisProps) { const [tab, setTab] = useState(OVERALL_TAB); - const [allAnalysis, setAllAnalysis] = useStateAn error occurred while generating profile analysis.
)} - {getAnalysisResult.isLoading && ( -+ Your highest offer is from {companyName}, which is{' '} + {percentile.toFixed(1)} percentile out of {noOfOffers}{' '} + offers received for the same job title and YOE(±1) in the last year. +
+ ) : ( ++ Your offer from {companyName} is {percentile.toFixed(1)}{' '} + percentile out of {noOfOffers} offers received in {companyName} for + the same job title and YOE(±1) in the last year. +
+ ); +} diff --git a/apps/portal/src/components/offers/offersSubmission/analysis/OfferProfileCard.tsx b/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx similarity index 54% rename from apps/portal/src/components/offers/offersSubmission/analysis/OfferProfileCard.tsx rename to apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx index 50bbcd06..af786c4b 100644 --- a/apps/portal/src/components/offers/offersSubmission/analysis/OfferProfileCard.tsx +++ b/apps/portal/src/components/offers/offerAnalysis/OfferProfileCard.tsx @@ -1,10 +1,14 @@ +import { + BuildingOffice2Icon, + CalendarDaysIcon, +} from '@heroicons/react/24/outline'; import { JobType } from '@prisma/client'; import { HorizontalDivider } from '~/../../../packages/ui/dist'; import { convertMoneyToString } from '~/utils/offers/currency'; import { formatDate } from '~/utils/offers/time'; -import ProfilePhotoHolder from '../../profile/ProfilePhotoHolder'; +import ProfilePhotoHolder from '../profile/ProfilePhotoHolder'; import type { AnalysisOffer } from '~/types/offers'; @@ -27,29 +31,37 @@ export default function OfferProfileCard({ }, }: OfferProfileCardProps) { return ( -{profileName}
-Previous company: {previousCompanies[0]}
-YOE: {totalYoe} year(s)
+{profileName}
+{title}
-+
{title}
+Company: {company.name}, {location}
-Level: {level}
+Level: {level}
{formatDate(monthYearReceived)}
+{formatDate(monthYearReceived)}
{jobType === JobType.FULLTIME
? `${convertMoneyToString(income)} / year`
diff --git a/apps/portal/src/components/offers/offersSubmission/OfferProfileSave.tsx b/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
similarity index 98%
rename from apps/portal/src/components/offers/offersSubmission/OfferProfileSave.tsx
rename to apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
index 9ba39af3..f113ffdb 100644
--- a/apps/portal/src/components/offers/offersSubmission/OfferProfileSave.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
@@ -16,7 +16,7 @@ type OfferProfileSaveProps = Readonly<{
token?: string;
}>;
-export default function OfferProfileSave({
+export default function OffersProfileSave({
profileId,
token,
}: OfferProfileSaveProps) {
diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx
index 931e94f3..95d43be8 100644
--- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx
@@ -6,8 +6,7 @@ import { JobType } from '@prisma/client';
import { Button } from '@tih/ui';
import { Breadcrumbs } from '~/components/offers/Breadcrumb';
-import OfferAnalysis from '~/components/offers/offersSubmission/analysis/OfferAnalysis';
-import OfferProfileSave from '~/components/offers/offersSubmission/OfferProfileSave';
+import OffersProfileSave from '~/components/offers/offersSubmission/OffersProfileSave';
import BackgroundForm from '~/components/offers/offersSubmission/submissionForm/BackgroundForm';
import OfferDetailsForm from '~/components/offers/offersSubmission/submissionForm/OfferDetailsForm';
import type {
@@ -20,7 +19,12 @@ import { cleanObject, removeInvalidMoneyData } from '~/utils/offers/form';
import { getCurrentMonth, getCurrentYear } from '~/utils/offers/time';
import { trpc } from '~/utils/trpc';
-import type { CreateOfferProfileResponse } from '~/types/offers';
+import OfferAnalysis from '../offerAnalysis/OfferAnalysis';
+
+import type {
+ CreateOfferProfileResponse,
+ ProfileAnalysis,
+} from '~/types/offers';
const defaultOfferValues = {
comments: '',
@@ -78,6 +82,7 @@ export default function OffersSubmissionForm({
id: profileId || '',
token: token || '',
});
+ const [analysis, setAnalysis] = useState
- Your highest offer is from {companyName}, which is{' '}
- {percentile} percentile out of {noOfOffers} offers received
- for the same job title and YOE(+/-1) in the last year.
-
- Your offer from {companyName} is {percentile} percentile out
- of {noOfOffers} offers received in {companyName} for the same job
- title and YOE(+/-1) in the last year.
-
- {totalCompensation - ? `TC: ${totalCompensation}` - : `Monthly Salary: ${monthlySalary}`} -
+ <> ++ {totalCompensation && `TC: ${totalCompensation}`} + {monthlySalary && `Monthly Salary: ${monthlySalary}`} +
++ Base / year: {base} ⋅ Stocks / year: {stocks} ⋅ Bonus / year:{' '} + {bonus} +
+- Base / year: {base} ⋅ Stocks / year: {stocks} ⋅ Bonus / year:{' '} - {bonus} -
+ {negotiationStrategy && ( +No background information available.
+