diff --git a/apps/portal/src/components/offers/table/OffersRow.tsx b/apps/portal/src/components/offers/table/OffersRow.tsx
index 8ab39bdd..d5039014 100644
--- a/apps/portal/src/components/offers/table/OffersRow.tsx
+++ b/apps/portal/src/components/offers/table/OffersRow.tsx
@@ -1,11 +1,13 @@
import Link from 'next/link';
-import type { OfferTableRowData } from '~/components/offers/table/types';
+import type { DashboardOffer } from '../../../types/offers';
+import { convertCurrencyToString } from '../../../utils/offers/currency';
+import { formatDate } from '../../../utils/offers/time';
-export type OfferTableRowProps = Readonly<{ row: OfferTableRowData }>;
+export type OfferTableRowProps = Readonly<{ row: DashboardOffer }>;
export default function OfferTableRow({
- row: { company, date, id, profileId, salary, title, yoe },
+ row: { company, id, income, monthYearReceived, profileId, title, totalYoe },
}: OfferTableRowProps) {
return (
- {company}
+ {company.name}
{title} |
- {yoe} |
- {salary} |
- {date} |
+ {totalYoe} |
+ {convertCurrencyToString(income)} |
+ {formatDate(monthYearReceived)} |
({
- currentPage: 1,
- numOfItems: 1,
+ const [pagination, setPagination] = useState({
+ currentPage: 0,
+ numOfItems: 0,
numOfPages: 0,
totalItems: 0,
});
- const [offers, setOffers] = useState>([]);
+ const [offers, setOffers] = useState>([]);
useEffect(() => {
setPagination({
- currentPage: 1,
- numOfItems: 1,
+ currentPage: 0,
+ numOfItems: 0,
numOfPages: 0,
totalItems: 0,
});
@@ -48,7 +45,7 @@ export default function OffersTable({
companyId: companyFilter,
limit: NUMBER_OF_OFFERS_IN_PAGE,
location: 'Singapore, Singapore', // TODO: Geolocation
- offset: pagination.currentPage - 1,
+ offset: 0,
sortBy: '-monthYearReceived',
title: jobTitleFilter,
yoeCategory: selectedTab,
@@ -56,28 +53,19 @@ export default function OffersTable({
],
{
onSuccess: (response) => {
- const filteredData = response.data.map((res) => {
- return {
- company: res.company.name,
- date: formatDate(res.monthYearReceived),
- id: res.OffersFullTime
- ? res.OffersFullTime!.id
- : res.OffersIntern!.id,
- profileId: res.profileId,
- salary: res.OffersFullTime
- ? res.OffersFullTime?.totalCompensation.value
- : res.OffersIntern?.monthlySalary.value,
- title: res.OffersFullTime ? res.OffersFullTime?.level : '',
- yoe: 100,
- };
- });
- setOffers(filteredData);
- setPagination({
- currentPage: response.paging.currentPage + 1,
- numOfItems: response.paging.numOfItems,
- numOfPages: response.paging.numOfPages,
- totalItems: response.paging.totalItems,
- });
+ // Const filteredData = response.data.map((res) => {
+ // return {
+ // company: res.company.name,
+ // date: res.monthYearReceived,
+ // id: res.id,
+ // profileId: res.profileId,
+ // income: res.income,
+ // title: res.title,
+ // yoe: res.totalYoe,
+ // };
+ // });
+ setOffers(response.data);
+ setPagination(response.paging);
},
},
);
@@ -90,15 +78,15 @@ export default function OffersTable({
label="Table Navigation"
tabs={[
{
- label: 'Fresh Grad (0-3 YOE)',
+ label: 'Fresh Grad (0-2 YOE)',
value: YOE_CATEGORY.ENTRY,
},
{
- label: 'Mid (4-7 YOE)',
+ label: 'Mid (3-5 YOE)',
value: YOE_CATEGORY.MID,
},
{
- label: 'Senior (8+ YOE)',
+ label: 'Senior (6+ YOE)',
value: YOE_CATEGORY.SENIOR,
},
{
@@ -187,14 +175,11 @@ export default function OffersTable({
)}
diff --git a/apps/portal/src/components/offers/table/OffersTablePagination.tsx b/apps/portal/src/components/offers/table/OffersTablePagination.tsx
index e7346c44..0800a529 100644
--- a/apps/portal/src/components/offers/table/OffersTablePagination.tsx
+++ b/apps/portal/src/components/offers/table/OffersTablePagination.tsx
@@ -1,11 +1,11 @@
import { Pagination } from '@tih/ui';
-import type { PaginationType } from '~/components/offers/table/types';
+import type { Paging } from '~/types/offers';
type OffersTablePaginationProps = Readonly<{
endNumber: number;
handlePageChange: (page: number) => void;
- pagination: PaginationType;
+ pagination: Paging;
startNumber: number;
}>;
@@ -30,13 +30,13 @@ export default function OffersTablePagination({
{
- handlePageChange(currPage);
+ handlePageChange(currPage - 1);
}}
/>
diff --git a/apps/portal/src/components/offers/table/types.ts b/apps/portal/src/components/offers/table/types.ts
index 9522a9bb..c7d92680 100644
--- a/apps/portal/src/components/offers/table/types.ts
+++ b/apps/portal/src/components/offers/table/types.ts
@@ -1,13 +1,3 @@
-export type OfferTableRowData = {
- company: string;
- date: string;
- id: string;
- profileId: string;
- salary: number | undefined;
- title: string;
- yoe: number;
-};
-
// eslint-disable-next-line no-shadow
export enum YOE_CATEGORY {
INTERN = 0,
|