diff --git a/apps/portal/src/components/offers/profile/ProfileHeader.tsx b/apps/portal/src/components/offers/profile/ProfileHeader.tsx
index c37b40ff..d35ec3fa 100644
--- a/apps/portal/src/components/offers/profile/ProfileHeader.tsx
+++ b/apps/portal/src/components/offers/profile/ProfileHeader.tsx
@@ -119,9 +119,11 @@ export default function ProfileHeader({
Current:
- {`${background?.experiences[0].companyName ?? '-'} ${
- background?.experiences[0].jobLevel
- } ${background?.experiences[0].jobTitle}`}
+
+ {`${background?.experiences[0]?.companyName ?? '-'} ${
+ background?.experiences[0]?.jobLevel || ''
+ } ${background?.experiences[0]?.jobTitle || ''}`}
+
diff --git a/apps/portal/src/components/offers/table/OffersRow.tsx b/apps/portal/src/components/offers/table/OffersRow.tsx
index f7bf4dc6..9e131a7e 100644
--- a/apps/portal/src/components/offers/table/OffersRow.tsx
+++ b/apps/portal/src/components/offers/table/OffersRow.tsx
@@ -1,6 +1,6 @@
import Link from 'next/link';
-import { convertCurrencyToString } from '~/utils/offers/currency';
+import { convertMoneyToString } from '~/utils/offers/currency';
import { formatDate } from '~/utils/offers/time';
import type { DashboardOffer } from '~/types/offers';
@@ -21,7 +21,7 @@ export default function OfferTableRow({
{title} |
{totalYoe} |
- {convertCurrencyToString(income)} |
+ {convertMoneyToString(income)} |
{formatDate(monthYearReceived)} |
{
if (res.offersFullTime) {
const filteredOffer: OfferEntity = {
- base: convertCurrencyToString(
- res.offersFullTime.baseSalary,
- ),
- bonus: convertCurrencyToString(res.offersFullTime.bonus),
+ base: convertMoneyToString(res.offersFullTime.baseSalary),
+ bonus: convertMoneyToString(res.offersFullTime.bonus),
companyName: res.company.name,
id: res.offersFullTime.id,
jobLevel: res.offersFullTime.level,
@@ -61,12 +59,11 @@ export default function OfferProfile() {
negotiationStrategy: res.negotiationStrategy || '',
otherComment: res.comments || '',
receivedMonth: formatDate(res.monthYearReceived),
- stocks: convertCurrencyToString(res.offersFullTime.stocks),
- totalCompensation: convertCurrencyToString(
+ stocks: convertMoneyToString(res.offersFullTime.stocks),
+ totalCompensation: convertMoneyToString(
res.offersFullTime.totalCompensation,
),
};
-
return filteredOffer;
}
const filteredOffer: OfferEntity = {
@@ -74,7 +71,7 @@ export default function OfferProfile() {
id: res.offersIntern!.id,
jobTitle: res.offersIntern!.title,
location: res.location,
- monthlySalary: convertCurrencyToString(
+ monthlySalary: convertMoneyToString(
res.offersIntern!.monthlySalary,
),
negotiationStrategy: res.negotiationStrategy || '',
@@ -89,46 +86,29 @@ export default function OfferProfile() {
if (data?.background) {
const transformedBackground = {
- educations: [
- {
- endDate: data?.background.educations[0].endDate
- ? formatDate(data.background.educations[0].endDate)
- : '-',
- field: data.background.educations[0].field || '-',
- school: data.background.educations[0].school || '-',
- startDate: data.background.educations[0].startDate
- ? formatDate(data.background.educations[0].startDate)
- : '-',
- type: data.background.educations[0].type || '-',
- },
- ],
- experiences: [
- data.background.experiences &&
- data.background.experiences.length > 0
- ? {
- companyName:
- data.background.experiences[0].company?.name ?? '-',
- duration:
- String(data.background.experiences[0].durationInMonths) ??
- '-',
- jobLevel: data.background.experiences[0].level ?? '',
- jobTitle: data.background.experiences[0].title ?? '-',
- monthlySalary: data.background.experiences[0].monthlySalary
- ? convertCurrencyToString(
- data.background.experiences[0].monthlySalary,
- )
- : '-',
- totalCompensation: data.background.experiences[0]
- .totalCompensation
- ? convertCurrencyToString(
- data.background.experiences[0].totalCompensation,
- )
- : '-',
- }
- : {},
- ],
+ educations: data.background.educations.map((education) => ({
+ endDate: education.endDate ? formatDate(education.endDate) : '-',
+ field: education.field || '-',
+ school: education.school || '-',
+ startDate: education.startDate
+ ? formatDate(education.startDate)
+ : '-',
+ type: education.type || '-',
+ })),
+ experiences: data.background.experiences.map((experience) => ({
+ companyName: experience.company?.name ?? '-',
+ duration: String(experience.durationInMonths) ?? '-',
+ jobLevel: experience.level ?? '',
+ jobTitle: experience.title ?? '-',
+ monthlySalary: experience.monthlySalary
+ ? convertMoneyToString(experience.monthlySalary)
+ : '-',
+ totalCompensation: experience.totalCompensation
+ ? convertMoneyToString(experience.totalCompensation)
+ : '-',
+ })),
profileName: data.profileName,
- specificYoes: data.background.specificYoes ?? [],
+ specificYoes: data.background.specificYoes,
totalYoe: String(data.background.totalYoe) || '-',
};
setBackground(transformedBackground);
diff --git a/apps/portal/src/utils/offers/currency/index.tsx b/apps/portal/src/utils/offers/currency/index.tsx
index 8afe5860..373d2984 100644
--- a/apps/portal/src/utils/offers/currency/index.tsx
+++ b/apps/portal/src/utils/offers/currency/index.tsx
@@ -1,6 +1,6 @@
import type { Money } from '~/components/offers/types';
-export function convertCurrencyToString({ currency, value }: Money) {
+export function convertMoneyToString({ currency, value }: Money) {
if (!value) {
return '-';
}
|