From d3c0c21f1bfd6e3926870baffe462bbd677dc822 Mon Sep 17 00:00:00 2001 From: Ai Ling <50992674+ailing35@users.noreply.github.com> Date: Mon, 10 Oct 2022 13:23:22 +0800 Subject: [PATCH 1/7] [offers][feat] Add offers submission, view and list pages (#348) * [offers][feat] add offer table and profile view * [offers][feat] add offers submission form * [offers][style] homepage styling * [offers][refactor] refactor types and constants * [offers][style] style offers form * [offers][fix] fix import error Co-authored-by: Zhang Ziqing --- .../src/components/offers/OffersNavigation.ts | 17 +- .../src/components/offers/OffersTable.tsx | 190 ++++++++ .../src/components/offers/OffersTitle.tsx | 17 +- .../portal/src/components/offers/constants.ts | 136 ++++++ .../offers/forms/BackgroundForm.tsx | 288 ++++++++++++ .../components/offers/forms/FormRadioList.tsx | 23 + .../components/offers/forms/FormSelect.tsx | 26 ++ .../components/offers/forms/FormTextArea.tsx | 27 ++ .../components/offers/forms/FormTextInput.tsx | 26 ++ .../components/offers/forms/OfferAnalysis.tsx | 102 +++++ .../offers/forms/OfferDetailsForm.tsx | 412 ++++++++++++++++++ .../offers/forms/OfferProfileSave.tsx | 73 ++++ .../offers/profile/EducationCard.tsx | 50 +++ .../components/offers/profile/OfferCard.tsx | 124 ++++++ .../offers/profile/ProfilePhotoHolder.tsx | 12 + apps/portal/src/components/offers/types.ts | 110 +++++ .../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 | 66 ++- .../pages/offers/profile/[offerProfileId].tsx | 256 +++++++++++ apps/portal/src/pages/offers/submit.tsx | 111 +++++ 22 files changed, 2260 insertions(+), 15 deletions(-) create mode 100644 apps/portal/src/components/offers/OffersTable.tsx create mode 100644 apps/portal/src/components/offers/constants.ts create mode 100644 apps/portal/src/components/offers/forms/BackgroundForm.tsx create mode 100644 apps/portal/src/components/offers/forms/FormRadioList.tsx create mode 100644 apps/portal/src/components/offers/forms/FormSelect.tsx create mode 100644 apps/portal/src/components/offers/forms/FormTextArea.tsx create mode 100644 apps/portal/src/components/offers/forms/FormTextInput.tsx create mode 100644 apps/portal/src/components/offers/forms/OfferAnalysis.tsx create mode 100644 apps/portal/src/components/offers/forms/OfferDetailsForm.tsx create mode 100644 apps/portal/src/components/offers/forms/OfferProfileSave.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/types.ts 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 create mode 100644 apps/portal/src/pages/offers/submit.tsx diff --git a/apps/portal/src/components/offers/OffersNavigation.ts b/apps/portal/src/components/offers/OffersNavigation.ts index c6d47806..e3746453 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: '/offers/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} + /> +
+ setValue(name || '', val)} + /> + ); +} + +const FormSelect = forwardRef(FormSelectWithRef); + +export default FormSelect; diff --git a/apps/portal/src/components/offers/forms/FormTextArea.tsx b/apps/portal/src/components/offers/forms/FormTextArea.tsx new file mode 100644 index 00000000..f833c3dd --- /dev/null +++ b/apps/portal/src/components/offers/forms/FormTextArea.tsx @@ -0,0 +1,27 @@ +import type { ComponentProps, ForwardedRef } from 'react'; +import { forwardRef } from 'react'; +import type { UseFormRegisterReturn } from 'react-hook-form'; + +import { TextArea } from '~/../../../packages/ui/dist'; + +type TextAreaProps = ComponentProps; + +type FormTextAreaProps = Omit & + Pick, 'onChange'>; + +function FormTextAreaWithRef( + { onChange, ...rest }: FormTextAreaProps, + ref?: ForwardedRef, +) { + return ( +