mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 12:43:12 +08:00
[resumes][fix] add spinners and responsive UI for review + browse pages (#334)
This commit is contained in:
@ -7,7 +7,7 @@ import { Button, Spinner } from '@tih/ui';
|
||||
|
||||
import { RESUME_STORAGE_KEY } from '~/constants/file-storage-keys';
|
||||
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js`;
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.js`;
|
||||
|
||||
type Props = Readonly<{
|
||||
url: string;
|
||||
@ -15,7 +15,7 @@ type Props = Readonly<{
|
||||
|
||||
export default function ResumePdf({ url }: Props) {
|
||||
const [numPages, setNumPages] = useState(0);
|
||||
const [pageNumber] = useState(1);
|
||||
const [pageNumber, setPageNumber] = useState(1);
|
||||
const [file, setFile] = useState<File>();
|
||||
|
||||
const onPdfLoadSuccess = (pdf: PDFDocumentProxy) => {
|
||||
@ -38,9 +38,10 @@ export default function ResumePdf({ url }: Props) {
|
||||
return (
|
||||
<div>
|
||||
<Document
|
||||
className="h-[calc(100vh-17rem)] overflow-scroll"
|
||||
className="flex h-[calc(100vh-17rem)] flex-row justify-center overflow-scroll"
|
||||
file={file}
|
||||
loading={<Spinner display="block" label="" size="lg" />}
|
||||
noData=""
|
||||
onLoadSuccess={onPdfLoadSuccess}>
|
||||
<Page pageNumber={pageNumber} />
|
||||
</Document>
|
||||
@ -52,16 +53,18 @@ export default function ResumePdf({ url }: Props) {
|
||||
isLabelHidden={true}
|
||||
label="Previous"
|
||||
variant="tertiary"
|
||||
onClick={() => setPageNumber(pageNumber - 1)}
|
||||
/>
|
||||
<p className="text-md text-gray-600">
|
||||
Page {pageNumber} of {numPages}
|
||||
</p>
|
||||
<Button
|
||||
disabled={pageNumber === numPages}
|
||||
disabled={pageNumber >= numPages}
|
||||
icon={ArrowRightIcon}
|
||||
isLabelHidden={true}
|
||||
label="Next"
|
||||
variant="tertiary"
|
||||
onClick={() => setPageNumber(pageNumber + 1)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,9 +53,9 @@ export const EXPERIENCE = [
|
||||
];
|
||||
|
||||
export const LOCATION = [
|
||||
{ checked: false, label: 'Singapore', value: 'singapore' },
|
||||
{ checked: false, label: 'United States', value: 'usa' },
|
||||
{ checked: false, label: 'India', value: 'india' },
|
||||
{ checked: false, label: 'Singapore', value: 'Singapore' },
|
||||
{ checked: false, label: 'United States', value: 'Usa' },
|
||||
{ checked: false, label: 'India', value: 'India' },
|
||||
];
|
||||
|
||||
export const TEST_RESUMES = [
|
||||
|
@ -10,15 +10,29 @@ type ICommentsSectionProps = {
|
||||
export default function CommentsSection({ resumeId }: ICommentsSectionProps) {
|
||||
const [showCommentsForm, setShowCommentsForm] = useState(false);
|
||||
|
||||
return showCommentsForm ? (
|
||||
<CommentsForm
|
||||
resumeId={resumeId}
|
||||
setShowCommentsForm={setShowCommentsForm}
|
||||
/>
|
||||
) : (
|
||||
<CommentsList
|
||||
resumeId={resumeId}
|
||||
setShowCommentsForm={setShowCommentsForm}
|
||||
/>
|
||||
return (
|
||||
<>
|
||||
<div className="relative p-2 lg:hidden">
|
||||
<div aria-hidden="true" className="absolute inset-0 flex items-center">
|
||||
<div className="w-full border-t border-gray-300" />
|
||||
</div>
|
||||
<div className="relative flex justify-center">
|
||||
<span className="bg-gray-50 px-3 text-lg font-medium text-gray-900">
|
||||
Comments
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{showCommentsForm ? (
|
||||
<CommentsForm
|
||||
resumeId={resumeId}
|
||||
setShowCommentsForm={setShowCommentsForm}
|
||||
/>
|
||||
) : (
|
||||
<CommentsList
|
||||
resumeId={resumeId}
|
||||
setShowCommentsForm={setShowCommentsForm}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import clsx from 'clsx';
|
||||
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
||||
import Error from 'next/error';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useSession } from 'next-auth/react';
|
||||
import { useEffect } from 'react';
|
||||
@ -59,88 +60,98 @@ export default function ResumeReviewPage() {
|
||||
return (
|
||||
<>
|
||||
{detailsQuery.isError && ErrorPage}
|
||||
{detailsQuery.isLoading && <Spinner display="block" label="" size="lg" />}
|
||||
{detailsQuery.isLoading && (
|
||||
<div className="w-full pt-4">
|
||||
{' '}
|
||||
<Spinner display="block" size="lg" />{' '}
|
||||
</div>
|
||||
)}
|
||||
{detailsQuery.isFetched && detailsQuery.data && (
|
||||
<main className="flex-1 p-4">
|
||||
<div className="flex flex-row md:space-x-8">
|
||||
<h1 className="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">
|
||||
{detailsQuery.data.title}
|
||||
</h1>
|
||||
<button
|
||||
className="isolate inline-flex max-h-10 items-center space-x-4 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500"
|
||||
disabled={session?.user === null}
|
||||
id="star-button"
|
||||
type="button"
|
||||
onClick={onStarButtonClick}>
|
||||
<span className="relative inline-flex">
|
||||
<StarIcon
|
||||
<>
|
||||
<Head>
|
||||
<title>{detailsQuery.data.title}</title>
|
||||
</Head>
|
||||
<main className="h-[calc(100vh-2rem)] flex-1 overflow-y-scroll p-4">
|
||||
<div className="flex flex-row space-x-8">
|
||||
<h1 className="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">
|
||||
{detailsQuery.data.title}
|
||||
</h1>
|
||||
<button
|
||||
className="isolate inline-flex max-h-10 items-center space-x-4 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500"
|
||||
disabled={session?.user === null}
|
||||
id="star-button"
|
||||
type="button"
|
||||
onClick={onStarButtonClick}>
|
||||
<span className="relative inline-flex">
|
||||
<StarIcon
|
||||
aria-hidden="true"
|
||||
className={clsx(
|
||||
detailsQuery.data?.stars.length
|
||||
? 'text-orange-400'
|
||||
: 'text-gray-400',
|
||||
'-ml-1 mr-2 h-5 w-5',
|
||||
)}
|
||||
id="star-icon"
|
||||
/>
|
||||
Star
|
||||
</span>
|
||||
<span className="relative -ml-px inline-flex">
|
||||
{detailsQuery.data._count.stars}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex flex-col pt-1 lg:mt-0 lg:flex-row lg:flex-wrap lg:space-x-8">
|
||||
<div className="mt-2 flex items-center text-sm text-gray-500">
|
||||
<BriefcaseIcon
|
||||
aria-hidden="true"
|
||||
className={clsx(
|
||||
detailsQuery.data?.stars.length
|
||||
? 'text-orange-400'
|
||||
: 'text-gray-400',
|
||||
'-ml-1 mr-2 h-5 w-5',
|
||||
)}
|
||||
id="star-icon"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
Star
|
||||
</span>
|
||||
<span className="relative -ml-px inline-flex">
|
||||
{detailsQuery.data._count.stars}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex flex-col pt-1 sm:mt-0 sm:flex-row sm:flex-wrap sm:space-x-8">
|
||||
<div className="mt-2 flex items-center text-sm text-gray-500">
|
||||
<BriefcaseIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{detailsQuery.data.role}
|
||||
{detailsQuery.data.role}
|
||||
</div>
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<MapPinIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{detailsQuery.data.location}
|
||||
</div>
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<AcademicCapIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{detailsQuery.data.experience}
|
||||
</div>
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<CalendarIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{`Uploaded ${formatDistanceToNow(
|
||||
new Date(detailsQuery.data.createdAt),
|
||||
{ addSuffix: true },
|
||||
)} by ${detailsQuery.data.user.name}`}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<MapPinIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{detailsQuery.data.location}
|
||||
{detailsQuery.data.additionalInfo && (
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<InformationCircleIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{detailsQuery.data.additionalInfo}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex w-full flex-col py-4 lg:flex-row">
|
||||
<div className="w-full lg:w-[800px]">
|
||||
<ResumePdf url={detailsQuery.data.url} />
|
||||
</div>
|
||||
<div className="mx-8 grow">
|
||||
<CommentsSection resumeId={resumeId as string} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<AcademicCapIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{detailsQuery.data.experience}
|
||||
</div>
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<CalendarIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{`Uploaded ${formatDistanceToNow(
|
||||
new Date(detailsQuery.data.createdAt),
|
||||
{ addSuffix: true },
|
||||
)} by ${detailsQuery.data.user.name}`}
|
||||
</div>
|
||||
</div>
|
||||
{detailsQuery.data.additionalInfo && (
|
||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||
<InformationCircleIcon
|
||||
aria-hidden="true"
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||
/>
|
||||
{detailsQuery.data.additionalInfo}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex h-full w-full flex-row py-4">
|
||||
<div className="w-1/2">
|
||||
<ResumePdf url={detailsQuery.data.url} />
|
||||
</div>
|
||||
<div className="mx-8 w-1/2">
|
||||
<CommentsSection resumeId={resumeId as string} />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import clsx from 'clsx';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useSession } from 'next-auth/react';
|
||||
import { Fragment, useEffect, useState } from 'react';
|
||||
@ -9,7 +10,7 @@ import {
|
||||
PlusIcon,
|
||||
} from '@heroicons/react/20/solid';
|
||||
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline';
|
||||
import { Tabs, TextInput } from '@tih/ui';
|
||||
import { Spinner, Tabs, TextInput } from '@tih/ui';
|
||||
|
||||
import BrowseListItem from '~/components/resumes/browse/BrowseListItem';
|
||||
import {
|
||||
@ -50,7 +51,7 @@ export default function ResumeHomePage() {
|
||||
const router = useRouter();
|
||||
const [tabsValue, setTabsValue] = useState(BROWSE_TABS_VALUES.ALL);
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [resumes, setResumes] = useState(Array<Resume>());
|
||||
const [resumes, setResumes] = useState<Array<Resume>>([]);
|
||||
|
||||
const allResumesQuery = trpc.useQuery(['resumes.resume.all'], {
|
||||
enabled: tabsValue === BROWSE_TABS_VALUES.ALL,
|
||||
@ -65,19 +66,19 @@ export default function ResumeHomePage() {
|
||||
useEffect(() => {
|
||||
switch (tabsValue) {
|
||||
case BROWSE_TABS_VALUES.ALL: {
|
||||
setResumes(allResumesQuery.data ?? Array<Resume>());
|
||||
setResumes(allResumesQuery.data ?? []);
|
||||
break;
|
||||
}
|
||||
case BROWSE_TABS_VALUES.STARRED: {
|
||||
setResumes(starredResumesQuery.data ?? Array<Resume>());
|
||||
setResumes(starredResumesQuery.data ?? []);
|
||||
break;
|
||||
}
|
||||
case BROWSE_TABS_VALUES.MY: {
|
||||
setResumes(myResumesQuery.data ?? Array<Resume>());
|
||||
setResumes(myResumesQuery.data ?? []);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
setResumes(Array<Resume>());
|
||||
setResumes([]);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
@ -96,205 +97,212 @@ export default function ResumeHomePage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
||||
<div className="ml-4 py-4">
|
||||
<ResumeReviewsTitle />
|
||||
</div>
|
||||
<div className="mt-4 flex items-start">
|
||||
<div className="w-screen sm:px-4 md:px-8">
|
||||
<div className="grid grid-cols-12">
|
||||
<div className="col-span-2 self-end">
|
||||
<h1 className="mb-4 tracking-tight text-gray-900">Filters</h1>
|
||||
</div>
|
||||
<div className="col-span-10">
|
||||
<div className="border-grey-200 grid grid-cols-12 items-center gap-4 border-b pb-2">
|
||||
<div className="col-span-7">
|
||||
<Tabs
|
||||
label="Resume Browse Tabs"
|
||||
tabs={[
|
||||
{
|
||||
label: 'All Resumes',
|
||||
value: BROWSE_TABS_VALUES.ALL,
|
||||
},
|
||||
{
|
||||
label: 'Starred Resumes',
|
||||
value: BROWSE_TABS_VALUES.STARRED,
|
||||
},
|
||||
{
|
||||
label: 'My Resumes',
|
||||
value: BROWSE_TABS_VALUES.MY,
|
||||
},
|
||||
]}
|
||||
value={tabsValue}
|
||||
onChange={setTabsValue}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-3 self-end">
|
||||
<form>
|
||||
<TextInput
|
||||
label=""
|
||||
placeholder="Search Resumes"
|
||||
startAddOn={MagnifyingGlassIcon}
|
||||
startAddOnType="icon"
|
||||
type="text"
|
||||
value={searchValue}
|
||||
onChange={setSearchValue}
|
||||
<>
|
||||
<Head>
|
||||
<title>Resume Review Portal</title>
|
||||
</Head>
|
||||
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
||||
<div className="ml-4 py-4">
|
||||
<ResumeReviewsTitle />
|
||||
</div>
|
||||
<div className="mt-4 flex items-start">
|
||||
<div className="w-screen sm:px-4 md:px-8">
|
||||
<div className="grid grid-cols-12">
|
||||
<div className="col-span-2 self-end">
|
||||
<h1 className="mb-4 tracking-tight text-gray-900">Filters</h1>
|
||||
</div>
|
||||
<div className="col-span-10">
|
||||
<div className="border-grey-200 grid grid-cols-12 items-center gap-4 border-b pb-2">
|
||||
<div className="col-span-7">
|
||||
<Tabs
|
||||
label="Resume Browse Tabs"
|
||||
tabs={[
|
||||
{
|
||||
label: 'All Resumes',
|
||||
value: BROWSE_TABS_VALUES.ALL,
|
||||
},
|
||||
{
|
||||
label: 'Starred Resumes',
|
||||
value: BROWSE_TABS_VALUES.STARRED,
|
||||
},
|
||||
{
|
||||
label: 'My Resumes',
|
||||
value: BROWSE_TABS_VALUES.MY,
|
||||
},
|
||||
]}
|
||||
value={tabsValue}
|
||||
onChange={setTabsValue}
|
||||
/>
|
||||
</form>
|
||||
</div>
|
||||
<div className="col-span-1 justify-self-center">
|
||||
<Menu as="div" className="relative inline-block text-left">
|
||||
<div>
|
||||
<Menu.Button className="group inline-flex justify-center text-sm font-medium text-gray-700 hover:text-gray-900">
|
||||
Sort
|
||||
<ChevronDownIcon
|
||||
aria-hidden="true"
|
||||
className="-mr-1 ml-1 h-5 w-5 flex-shrink-0 text-gray-400 group-hover:text-gray-500"
|
||||
/>
|
||||
</Menu.Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-3 self-end">
|
||||
<form>
|
||||
<TextInput
|
||||
label=""
|
||||
placeholder="Search Resumes"
|
||||
startAddOn={MagnifyingGlassIcon}
|
||||
startAddOnType="icon"
|
||||
type="text"
|
||||
value={searchValue}
|
||||
onChange={setSearchValue}
|
||||
/>
|
||||
</form>
|
||||
</div>
|
||||
<div className="col-span-1 justify-self-center">
|
||||
<Menu as="div" className="relative inline-block text-left">
|
||||
<div>
|
||||
<Menu.Button className="group inline-flex justify-center text-sm font-medium text-gray-700 hover:text-gray-900">
|
||||
Sort
|
||||
<ChevronDownIcon
|
||||
aria-hidden="true"
|
||||
className="-mr-1 ml-1 h-5 w-5 flex-shrink-0 text-gray-400 group-hover:text-gray-500"
|
||||
/>
|
||||
</Menu.Button>
|
||||
</div>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
enter="transition ease-out duration-100"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95">
|
||||
<Menu.Items className="absolute right-0 z-10 mt-2 w-40 origin-top-right rounded-md bg-white shadow-2xl ring-1 ring-black ring-opacity-5 focus:outline-none">
|
||||
<div className="py-1">
|
||||
{SORT_OPTIONS.map((option) => (
|
||||
<Menu.Item key={option.name}>
|
||||
{({ active }) => (
|
||||
<a
|
||||
className={clsx(
|
||||
option.current
|
||||
? 'font-medium text-gray-900'
|
||||
: 'text-gray-500',
|
||||
active ? 'bg-gray-100' : '',
|
||||
'block px-4 py-2 text-sm',
|
||||
)}
|
||||
href={option.href}>
|
||||
{option.name}
|
||||
</a>
|
||||
)}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</div>
|
||||
</Menu.Items>
|
||||
</Transition>
|
||||
</Menu>
|
||||
</div>
|
||||
<div className="col-span-1">
|
||||
<button
|
||||
className="rounded-md bg-indigo-500 py-1 px-3 text-sm text-white"
|
||||
type="button"
|
||||
onClick={onClickNew}>
|
||||
New
|
||||
</button>
|
||||
<Transition
|
||||
as={Fragment}
|
||||
enter="transition ease-out duration-100"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95">
|
||||
<Menu.Items className="absolute right-0 z-10 mt-2 w-40 origin-top-right rounded-md bg-white shadow-2xl ring-1 ring-black ring-opacity-5 focus:outline-none">
|
||||
<div className="py-1">
|
||||
{SORT_OPTIONS.map((option) => (
|
||||
<Menu.Item key={option.name}>
|
||||
{({ active }) => (
|
||||
<a
|
||||
className={clsx(
|
||||
option.current
|
||||
? 'font-medium text-gray-900'
|
||||
: 'text-gray-500',
|
||||
active ? 'bg-gray-100' : '',
|
||||
'block px-4 py-2 text-sm',
|
||||
)}
|
||||
href={option.href}>
|
||||
{option.name}
|
||||
</a>
|
||||
)}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</div>
|
||||
</Menu.Items>
|
||||
</Transition>
|
||||
</Menu>
|
||||
</div>
|
||||
<div className="col-span-1">
|
||||
<button
|
||||
className="rounded-md bg-indigo-500 py-1 px-3 text-sm text-white"
|
||||
type="button"
|
||||
onClick={onClickNew}>
|
||||
New
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12">
|
||||
<div className="col-span-2">
|
||||
<div className="w-100 pt-4 sm:pr-0 md:pr-4">
|
||||
<form>
|
||||
<h3 className="sr-only">Categories</h3>
|
||||
<ul
|
||||
className="flex flex-wrap justify-start gap-4 pb-6 text-sm font-medium text-gray-900"
|
||||
role="list">
|
||||
{TOP_HITS.map((category) => (
|
||||
<li key={category.name}>
|
||||
{/* TODO: Replace onClick with filtering function */}
|
||||
<FilterPill
|
||||
title={category.name}
|
||||
onClick={() => true}
|
||||
<div className="grid grid-cols-12">
|
||||
<div className="col-span-2">
|
||||
<div className="w-100 pt-4 sm:pr-0 md:pr-4">
|
||||
<form>
|
||||
<h3 className="sr-only">Categories</h3>
|
||||
<ul
|
||||
className="flex flex-wrap justify-start gap-4 pb-6 text-sm font-medium text-gray-900"
|
||||
role="list">
|
||||
{TOP_HITS.map((category) => (
|
||||
<li key={category.name}>
|
||||
{/* TODO: Replace onClick with filtering function */}
|
||||
<FilterPill
|
||||
title={category.name}
|
||||
onClick={() => true}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{filters.map((section) => (
|
||||
<Disclosure
|
||||
key={section.id}
|
||||
as="div"
|
||||
className="border-b border-gray-200 py-6">
|
||||
{({ open }) => (
|
||||
<>
|
||||
<h3 className="-my-3 flow-root">
|
||||
<Disclosure.Button className="flex w-full items-center justify-between py-3 text-sm text-gray-400 hover:text-gray-500">
|
||||
<span className="font-medium text-gray-900">
|
||||
{section.name}
|
||||
</span>
|
||||
<span className="ml-6 flex items-center">
|
||||
{open ? (
|
||||
<MinusIcon
|
||||
aria-hidden="true"
|
||||
className="h-5 w-5"
|
||||
/>
|
||||
) : (
|
||||
<PlusIcon
|
||||
aria-hidden="true"
|
||||
className="h-5 w-5"
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
</Disclosure.Button>
|
||||
</h3>
|
||||
<Disclosure.Panel className="pt-6">
|
||||
<div className="space-y-4">
|
||||
{section.options.map((option, optionIdx) => (
|
||||
<div
|
||||
key={option.value}
|
||||
className="flex items-center">
|
||||
<input
|
||||
className="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
|
||||
defaultChecked={option.checked}
|
||||
defaultValue={option.value}
|
||||
id={`filter-${section.id}-${optionIdx}`}
|
||||
name={`${section.id}[]`}
|
||||
type="checkbox"
|
||||
/>
|
||||
<label
|
||||
className="ml-3 text-sm text-gray-600"
|
||||
htmlFor={`filter-${section.id}-${optionIdx}`}>
|
||||
{option.label}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Disclosure.Panel>
|
||||
</>
|
||||
)}
|
||||
</Disclosure>
|
||||
))}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{allResumesQuery.isLoading ||
|
||||
starredResumesQuery.isLoading ||
|
||||
myResumesQuery.isLoading ? (
|
||||
<div className="col-span-10 pt-4">
|
||||
<Spinner display="block" size="lg" />
|
||||
</div>
|
||||
) : (
|
||||
<div className="col-span-10 pr-8">
|
||||
<ul role="list">
|
||||
{resumes.map((resumeObj) => (
|
||||
<li key={resumeObj.id}>
|
||||
<BrowseListItem
|
||||
href={`resumes/${resumeObj.id}`}
|
||||
resumeInfo={resumeObj}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{filters.map((section) => (
|
||||
<Disclosure
|
||||
key={section.id}
|
||||
as="div"
|
||||
className="border-b border-gray-200 py-6">
|
||||
{({ open }) => (
|
||||
<>
|
||||
<h3 className="-my-3 flow-root">
|
||||
<Disclosure.Button className="flex w-full items-center justify-between py-3 text-sm text-gray-400 hover:text-gray-500">
|
||||
<span className="font-medium text-gray-900">
|
||||
{section.name}
|
||||
</span>
|
||||
<span className="ml-6 flex items-center">
|
||||
{open ? (
|
||||
<MinusIcon
|
||||
aria-hidden="true"
|
||||
className="h-5 w-5"
|
||||
/>
|
||||
) : (
|
||||
<PlusIcon
|
||||
aria-hidden="true"
|
||||
className="h-5 w-5"
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
</Disclosure.Button>
|
||||
</h3>
|
||||
<Disclosure.Panel className="pt-6">
|
||||
<div className="space-y-4">
|
||||
{section.options.map((option, optionIdx) => (
|
||||
<div
|
||||
key={option.value}
|
||||
className="flex items-center">
|
||||
<input
|
||||
className="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
|
||||
defaultChecked={option.checked}
|
||||
defaultValue={option.value}
|
||||
id={`filter-${section.id}-${optionIdx}`}
|
||||
name={`${section.id}[]`}
|
||||
type="checkbox"
|
||||
/>
|
||||
<label
|
||||
className="ml-3 text-sm text-gray-600"
|
||||
htmlFor={`filter-${section.id}-${optionIdx}`}>
|
||||
{option.label}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Disclosure.Panel>
|
||||
</>
|
||||
)}
|
||||
</Disclosure>
|
||||
))}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{allResumesQuery.isLoading ||
|
||||
starredResumesQuery.isLoading ||
|
||||
myResumesQuery.isLoading ? (
|
||||
<div>Loading...</div>
|
||||
) : (
|
||||
<div className="col-span-10 pr-8">
|
||||
<ul role="list">
|
||||
{resumes.map((resumeObj) => (
|
||||
<li key={resumeObj.id}>
|
||||
<BrowseListItem
|
||||
href={`resumes/${resumeObj.id}`}
|
||||
resumeInfo={resumeObj}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ export default function SubmitResumeForm() {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Upload a resume</title>
|
||||
<title>Upload a Resume</title>
|
||||
</Head>
|
||||
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
||||
<section
|
||||
|
Reference in New Issue
Block a user