From 7d15aa43cfc842a75f114c1bed0577b3c5c7019f Mon Sep 17 00:00:00 2001 From: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com> Date: Wed, 12 Oct 2022 19:12:14 +0800 Subject: [PATCH] [offers][feat] integrate profile delete API and set loading status (#367) --- .../src/components/offers/OffersTable.tsx | 18 +- .../components/offers/profile/OfferCard.tsx | 17 +- .../offers/profile/ProfileComments.tsx | 58 +++ .../offers/profile/ProfileDetails.tsx | 79 ++++ .../offers/profile/ProfileHeader.tsx | 167 ++++++++ apps/portal/src/components/offers/types.ts | 18 +- .../pages/offers/profile/[offerProfileId].tsx | 393 +++++------------- 7 files changed, 442 insertions(+), 308 deletions(-) create mode 100644 apps/portal/src/components/offers/profile/ProfileComments.tsx create mode 100644 apps/portal/src/components/offers/profile/ProfileDetails.tsx create mode 100644 apps/portal/src/components/offers/profile/ProfileHeader.tsx diff --git a/apps/portal/src/components/offers/OffersTable.tsx b/apps/portal/src/components/offers/OffersTable.tsx index e8a28b55..5bebccc9 100644 --- a/apps/portal/src/components/offers/OffersTable.tsx +++ b/apps/portal/src/components/offers/OffersTable.tsx @@ -1,4 +1,4 @@ -import { useRouter } from 'next/router'; +import Link from 'next/link'; import { useEffect, useState } from 'react'; import { HorizontalDivider, Pagination, Select, Tabs } from '@tih/ui'; @@ -40,7 +40,6 @@ type Pagination = { const NUMBER_OF_OFFERS_IN_PAGE = 10; export default function OffersTable({ jobTitleFilter }: OffersTableProps) { - const router = useRouter(); const [currency, setCurrency] = useState('SGD'); // TODO const [selectedTab, setSelectedTab] = useState(YOE_CATEGORY.ENTRY); const [pagination, setPagination] = useState({ @@ -180,10 +179,6 @@ export default function OffersTable({ jobTitleFilter }: OffersTableProps) { ); } - const handleClickViewProfile = (profileId: string) => { - router.push(`/offers/profile/${profileId}`); - }; - const handlePageChange = (currPage: number) => { setPagination({ ...pagination, currentPage: currPage }); }; @@ -211,11 +206,17 @@ export default function OffersTable({ jobTitleFilter }: OffersTableProps) { {salary} {date} - handleClickViewProfile(profileId)}> View Profile - + */} + + + View Profile + {/* @@ -244,7 +245,6 @@ export default function OffersTable({ jobTitleFilter }: OffersTableProps) { {`of `} {pagination.totalItems} - {/* {pagination.numOfPages * NUMBER_OF_OFFERS_IN_PAGE} */} void; + handleCopyPublicLink: () => void; + isDisabled: boolean; + isEditable: boolean; + isLoading: boolean; +}>; + +export default function ProfileComments({ + handleCopyEditLink, + handleCopyPublicLink, + isDisabled, + isEditable, + isLoading, +}: ProfileHeaderProps) { + if (isLoading) { + return ( +
+ +
+ ); + } + return ( +
+
+ {isEditable && ( +
+

+ Discussions feature coming soon +

+ {/*