From f4005a91f849c4d19504f7255e251f59a4c36940 Mon Sep 17 00:00:00 2001 From: Tan Su Yin Date: Fri, 7 Oct 2022 23:08:29 +0800 Subject: [PATCH] [resumes][feat] Fetch all resumes in browse page --- .../resumes/browse/BrowseListItem.tsx | 12 +- apps/portal/src/pages/resumes/index.tsx | 233 +++++++++++++++++- 2 files changed, 233 insertions(+), 12 deletions(-) diff --git a/apps/portal/src/components/resumes/browse/BrowseListItem.tsx b/apps/portal/src/components/resumes/browse/BrowseListItem.tsx index a9d9c438..117b695e 100644 --- a/apps/portal/src/components/resumes/browse/BrowseListItem.tsx +++ b/apps/portal/src/components/resumes/browse/BrowseListItem.tsx @@ -3,19 +3,11 @@ import type { UrlObject } from 'url'; import { ChevronRightIcon } from '@heroicons/react/20/solid'; import { ChatBubbleLeftIcon, StarIcon } from '@heroicons/react/24/outline'; -type ResumeInfo = Readonly<{ - createdAt: Date; - experience: string; - numComments: number; - numStars: number; - role: string; - title: string; - user: string; -}>; +import type { Resume } from '~/types/resume'; type Props = Readonly<{ href: UrlObject | string; - resumeInfo: ResumeInfo; + resumeInfo: Resume; }>; export default function BrowseListItem({ href, resumeInfo }: Props) { diff --git a/apps/portal/src/pages/resumes/index.tsx b/apps/portal/src/pages/resumes/index.tsx index f0f9bad1..fb0ca8b0 100644 --- a/apps/portal/src/pages/resumes/index.tsx +++ b/apps/portal/src/pages/resumes/index.tsx @@ -1,14 +1,243 @@ -import BrowsePageBody from '~/components/resumes/browse/BrowsePageBody'; +import clsx from 'clsx'; +import { Fragment, useState } from 'react'; +import { Disclosure, Menu, Transition } from '@headlessui/react'; +import { + ChevronDownIcon, + MinusIcon, + PlusIcon, +} from '@heroicons/react/20/solid'; +import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'; +import { Tabs, TextInput } from '@tih/ui'; + +import BrowseListItem from '~/components/resumes/browse/BrowseListItem'; +import { + EXPERIENCE, + LOCATION, + ROLES, + SORT_OPTIONS, + TOP_HITS, +} from '~/components/resumes/browse/constants'; +import FilterPill from '~/components/resumes/browse/FilterPill'; + +const filters = [ + { + id: 'roles', + name: 'Roles', + options: ROLES, + }, + { + id: 'experience', + name: 'Experience', + options: EXPERIENCE, + }, + { + id: 'location', + name: 'Location', + options: LOCATION, + }, +]; import ResumeReviewsTitle from '~/components/resumes/ResumeReviewsTitle'; +import { trpc } from '~/utils/trpc'; + export default function ResumeHomePage() { + const [tabsValue, setTabsValue] = useState('all'); + const [searchValue, setSearchValue] = useState(''); + const resumesQuery = trpc.useQuery(['resumes.resume.list']); + return (
- +
+
+
+

Filters

+
+
+
+
+ +
+
+
+ + +
+
+ +
+ + Sort + +
+ + + +
+ {SORT_OPTIONS.map((option) => ( + + {({ active }) => ( + + {option.name} + + )} + + ))} +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+

Categories

+
    + {TOP_HITS.map((category) => ( +
  • + {/* TODO: Replace onClick with filtering function */} + true} + /> +
  • + ))} +
+ + {filters.map((section) => ( + + {({ open }) => ( + <> +

+ + + {section.name} + + + {open ? ( + + +

+ +
+ {section.options.map((option, optionIdx) => ( +
+ + +
+ ))} +
+
+ + )} +
+ ))} +
+
+
+ {resumesQuery.isLoading ? ( +
Loading...
+ ) : ( +
+
    + {resumesQuery.data?.map((resumeObj) => ( +
  • + +
  • + ))} +
+
+ )} +
+
);