From 670777474bdc18fec09faf33b0abffbf6aae9dcc Mon Sep 17 00:00:00 2001 From: Zhang Ziqing Date: Sun, 9 Oct 2022 23:30:20 +0800 Subject: [PATCH] [offers][feat] add offer table and profile view commit 3ad2f6bf3bafdd91072b21aac8c19f146594566e Author: Zhang Ziqing Date: Sun Oct 9 23:22:38 2022 +0800 [offers][feat] add offer table commit 78e1eb81bdcc44dfd131e5379e6909b338ae9d80 Author: Zhang Ziqing Date: Sun Oct 9 17:17:46 2022 +0800 [offers][feat] add offer profile tab and background tab component --- .../src/components/offers/OffersNavigation.ts | 17 +- .../src/components/offers/OffersTable.tsx | 190 +++++++++++++ .../offers/profile/EducationCard.tsx | 60 ++++ .../components/offers/profile/OfferCard.tsx | 124 +++++++++ .../offers/profile/ProfilePhotoHolder.tsx | 12 + .../offers/util/currency/CurrencyEnum.tsx | 172 ++++++++++++ .../offers/util/currency/CurrencySelector.tsx | 30 ++ .../src/components/offers/util/time/index.tsx | 7 + apps/portal/src/pages/offers/index.tsx | 4 +- .../pages/offers/profile/[offerProfileId].tsx | 256 ++++++++++++++++++ 10 files changed, 857 insertions(+), 15 deletions(-) create mode 100644 apps/portal/src/components/offers/OffersTable.tsx create mode 100644 apps/portal/src/components/offers/profile/EducationCard.tsx create mode 100644 apps/portal/src/components/offers/profile/OfferCard.tsx create mode 100644 apps/portal/src/components/offers/profile/ProfilePhotoHolder.tsx create mode 100644 apps/portal/src/components/offers/util/currency/CurrencyEnum.tsx create mode 100644 apps/portal/src/components/offers/util/currency/CurrencySelector.tsx create mode 100644 apps/portal/src/components/offers/util/time/index.tsx create mode 100644 apps/portal/src/pages/offers/profile/[offerProfileId].tsx diff --git a/apps/portal/src/components/offers/OffersNavigation.ts b/apps/portal/src/components/offers/OffersNavigation.ts index c6d47806..8e020e4c 100644 --- a/apps/portal/src/components/offers/OffersNavigation.ts +++ b/apps/portal/src/components/offers/OffersNavigation.ts @@ -1,23 +1,14 @@ import type { ProductNavigationItems } from '~/components/global/ProductNavigation'; const navigation: ProductNavigationItems = [ - { - children: [ - { href: '#', name: 'Technical Support' }, - { href: '#', name: 'Sales' }, - { href: '#', name: 'General' }, - ], - href: '#', - name: 'Inboxes', - }, - { children: [], href: '#', name: 'Reporting' }, - { children: [], href: '#', name: 'Settings' }, + { href: '/offers', name: 'Home' }, + { href: '/submit', name: 'Benchmark your offer' }, ]; const config = { navigation, - showGlobalNav: true, - title: 'Offers', + showGlobalNav: false, + title: 'Tech Offers Repo', }; export default config; diff --git a/apps/portal/src/components/offers/OffersTable.tsx b/apps/portal/src/components/offers/OffersTable.tsx new file mode 100644 index 00000000..ded79547 --- /dev/null +++ b/apps/portal/src/components/offers/OffersTable.tsx @@ -0,0 +1,190 @@ +import { useState } from 'react'; +import { HorizontalDivider, Pagination, Select, Tabs } from '@tih/ui'; + +import CurrencySelector from '~/components/offers/util/currency/CurrencySelector'; + +type TableRow = { + company: string; + date: string; + salary: string; + title: string; + yoe: string; +}; + +// eslint-disable-next-line no-shadow +enum YOE_CATEGORY { + INTERN = 0, + ENTRY = 1, + MID = 2, + SENIOR = 3, +} + +export default function OffersTable() { + const [currency, setCurrency] = useState('SGD'); + const [selectedTab, setSelectedTab] = useState(YOE_CATEGORY.ENTRY); + const [selectedPage, setSelectedPage] = useState(1); + + function renderTabs() { + return ( +
+
+ setSelectedTab(value)} + /> +
+
+ ); + } + + function renderFilters() { + return ( +
+
+ All offers in + setCurrency(value)} + selectedCurrency={currency} + /> +
+ handleCurrencyChange(currency)} + /> + ); +} diff --git a/apps/portal/src/components/offers/util/time/index.tsx b/apps/portal/src/components/offers/util/time/index.tsx new file mode 100644 index 00000000..86f21ab9 --- /dev/null +++ b/apps/portal/src/components/offers/util/time/index.tsx @@ -0,0 +1,7 @@ +export function formatDate(value: Date | number | string) { + const date = new Date(value); + // Const day = date.toLocaleString('default', { day: '2-digit' }); + const month = date.toLocaleString('default', { month: 'short' }); + const year = date.toLocaleString('default', { year: 'numeric' }); + return `${month} ${year}`; +} diff --git a/apps/portal/src/pages/offers/index.tsx b/apps/portal/src/pages/offers/index.tsx index 4fa89c65..9fdb6fbe 100644 --- a/apps/portal/src/pages/offers/index.tsx +++ b/apps/portal/src/pages/offers/index.tsx @@ -1,10 +1,10 @@ -import OffersTitle from '~/components/offers/OffersTitle'; +import OffersTable from '~/components/offers/OffersTable'; export default function OffersHomePage() { return (
- +
); diff --git a/apps/portal/src/pages/offers/profile/[offerProfileId].tsx b/apps/portal/src/pages/offers/profile/[offerProfileId].tsx new file mode 100644 index 00000000..487e3d3d --- /dev/null +++ b/apps/portal/src/pages/offers/profile/[offerProfileId].tsx @@ -0,0 +1,256 @@ +import { useState } from 'react'; +import { + AcademicCapIcon, + BookmarkSquareIcon, + BriefcaseIcon, + BuildingOffice2Icon, + CalendarDaysIcon, + ClipboardDocumentIcon, + PencilSquareIcon, + ShareIcon, + TrashIcon, +} from '@heroicons/react/24/outline'; +import { Button, Dialog, Tabs } from '@tih/ui'; + +import { EducationBackgroundType } from '~/components/offers/profile/EducationCard'; +import EducationCard from '~/components/offers/profile/EducationCard'; +import OfferCard from '~/components/offers/profile/OfferCard'; +import ProfilePhotoHolder from '~/components/offers/profile/ProfilePhotoHolder'; + +export default function OfferProfile() { + const [selectedTab, setSelectedTab] = useState('offers'); + const [isDialogOpen, setIsDialogOpen] = useState(false); + function renderActionList() { + return ( +
+
+ ); + } + function ProfileHeader() { + return ( +
+
+
+ +
+
+
+

anonymised-name

+
+ {renderActionList()} +
+
+
+ + Current: + Level 4 Google +
+
+ + YOE: + 4 +
+
+
+ +
+ setSelectedTab(value)} + /> +
+
+ ); + } + + function ProfileDetails() { + if (selectedTab === 'offers') { + return ( + <> + {[ + { + base: undefined, + bonus: undefined, + companyName: 'Meta', + id: 1, + jobLevel: 'G5', + jobTitle: 'Software Engineer', + location: 'Singapore', + monthlySalary: undefined, + negotiationStrategy: + 'Nostrud nulla aliqua deserunt commodo id aute.', + otherComment: + 'Pariatur ut est voluptate incididunt consequat do veniam quis irure adipisicing. Deserunt laborum dolor quis voluptate enim.', + receivedMonth: 'Jun 2022', + stocks: undefined, + totalCompensation: undefined, + }, + { + companyName: 'Meta', + id: 2, + jobLevel: 'G5', + jobTitle: 'Software Engineer', + location: 'Singapore', + receivedMonth: 'Jun 2022', + }, + { + companyName: 'Meta', + id: 3, + jobLevel: 'G5', + jobTitle: 'Software Engineer', + location: 'Singapore', + receivedMonth: 'Jun 2022', + }, + ].map((offer) => ( + + ))} + + ); + } + if (selectedTab === 'background') { + return ( + <> +
+ + Work Experience +
+ +
+ + Education +
+ + + ); + } + return
Detail page for {selectedTab}
; + } + + function ProfileComments() { + return ( +
+
+
+

+ Discussions feature coming soon +

+ {/*