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';
|
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<{
|
type Props = Readonly<{
|
||||||
url: string;
|
url: string;
|
||||||
@ -15,7 +15,7 @@ type Props = Readonly<{
|
|||||||
|
|
||||||
export default function ResumePdf({ url }: Props) {
|
export default function ResumePdf({ url }: Props) {
|
||||||
const [numPages, setNumPages] = useState(0);
|
const [numPages, setNumPages] = useState(0);
|
||||||
const [pageNumber] = useState(1);
|
const [pageNumber, setPageNumber] = useState(1);
|
||||||
const [file, setFile] = useState<File>();
|
const [file, setFile] = useState<File>();
|
||||||
|
|
||||||
const onPdfLoadSuccess = (pdf: PDFDocumentProxy) => {
|
const onPdfLoadSuccess = (pdf: PDFDocumentProxy) => {
|
||||||
@ -38,9 +38,10 @@ export default function ResumePdf({ url }: Props) {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Document
|
<Document
|
||||||
className="h-[calc(100vh-17rem)] overflow-scroll"
|
className="flex h-[calc(100vh-17rem)] flex-row justify-center overflow-scroll"
|
||||||
file={file}
|
file={file}
|
||||||
loading={<Spinner display="block" label="" size="lg" />}
|
loading={<Spinner display="block" label="" size="lg" />}
|
||||||
|
noData=""
|
||||||
onLoadSuccess={onPdfLoadSuccess}>
|
onLoadSuccess={onPdfLoadSuccess}>
|
||||||
<Page pageNumber={pageNumber} />
|
<Page pageNumber={pageNumber} />
|
||||||
</Document>
|
</Document>
|
||||||
@ -52,16 +53,18 @@ export default function ResumePdf({ url }: Props) {
|
|||||||
isLabelHidden={true}
|
isLabelHidden={true}
|
||||||
label="Previous"
|
label="Previous"
|
||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
|
onClick={() => setPageNumber(pageNumber - 1)}
|
||||||
/>
|
/>
|
||||||
<p className="text-md text-gray-600">
|
<p className="text-md text-gray-600">
|
||||||
Page {pageNumber} of {numPages}
|
Page {pageNumber} of {numPages}
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
disabled={pageNumber === numPages}
|
disabled={pageNumber >= numPages}
|
||||||
icon={ArrowRightIcon}
|
icon={ArrowRightIcon}
|
||||||
isLabelHidden={true}
|
isLabelHidden={true}
|
||||||
label="Next"
|
label="Next"
|
||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
|
onClick={() => setPageNumber(pageNumber + 1)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,9 +53,9 @@ export const EXPERIENCE = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const LOCATION = [
|
export const LOCATION = [
|
||||||
{ checked: false, label: 'Singapore', value: 'singapore' },
|
{ checked: false, label: 'Singapore', value: 'Singapore' },
|
||||||
{ checked: false, label: 'United States', value: 'usa' },
|
{ checked: false, label: 'United States', value: 'Usa' },
|
||||||
{ checked: false, label: 'India', value: 'india' },
|
{ checked: false, label: 'India', value: 'India' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const TEST_RESUMES = [
|
export const TEST_RESUMES = [
|
||||||
|
@ -10,15 +10,29 @@ type ICommentsSectionProps = {
|
|||||||
export default function CommentsSection({ resumeId }: ICommentsSectionProps) {
|
export default function CommentsSection({ resumeId }: ICommentsSectionProps) {
|
||||||
const [showCommentsForm, setShowCommentsForm] = useState(false);
|
const [showCommentsForm, setShowCommentsForm] = useState(false);
|
||||||
|
|
||||||
return showCommentsForm ? (
|
return (
|
||||||
<CommentsForm
|
<>
|
||||||
resumeId={resumeId}
|
<div className="relative p-2 lg:hidden">
|
||||||
setShowCommentsForm={setShowCommentsForm}
|
<div aria-hidden="true" className="absolute inset-0 flex items-center">
|
||||||
/>
|
<div className="w-full border-t border-gray-300" />
|
||||||
) : (
|
</div>
|
||||||
<CommentsList
|
<div className="relative flex justify-center">
|
||||||
resumeId={resumeId}
|
<span className="bg-gray-50 px-3 text-lg font-medium text-gray-900">
|
||||||
setShowCommentsForm={setShowCommentsForm}
|
Comments
|
||||||
/>
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{showCommentsForm ? (
|
||||||
|
<CommentsForm
|
||||||
|
resumeId={resumeId}
|
||||||
|
setShowCommentsForm={setShowCommentsForm}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<CommentsList
|
||||||
|
resumeId={resumeId}
|
||||||
|
setShowCommentsForm={setShowCommentsForm}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
||||||
import Error from 'next/error';
|
import Error from 'next/error';
|
||||||
|
import Head from 'next/head';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useSession } from 'next-auth/react';
|
import { useSession } from 'next-auth/react';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
@ -59,88 +60,98 @@ export default function ResumeReviewPage() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{detailsQuery.isError && ErrorPage}
|
{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 && (
|
{detailsQuery.isFetched && detailsQuery.data && (
|
||||||
<main className="flex-1 p-4">
|
<>
|
||||||
<div className="flex flex-row md:space-x-8">
|
<Head>
|
||||||
<h1 className="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">
|
<title>{detailsQuery.data.title}</title>
|
||||||
{detailsQuery.data.title}
|
</Head>
|
||||||
</h1>
|
<main className="h-[calc(100vh-2rem)] flex-1 overflow-y-scroll p-4">
|
||||||
<button
|
<div className="flex flex-row space-x-8">
|
||||||
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"
|
<h1 className="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">
|
||||||
disabled={session?.user === null}
|
{detailsQuery.data.title}
|
||||||
id="star-button"
|
</h1>
|
||||||
type="button"
|
<button
|
||||||
onClick={onStarButtonClick}>
|
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"
|
||||||
<span className="relative inline-flex">
|
disabled={session?.user === null}
|
||||||
<StarIcon
|
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"
|
aria-hidden="true"
|
||||||
className={clsx(
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||||
detailsQuery.data?.stars.length
|
|
||||||
? 'text-orange-400'
|
|
||||||
: 'text-gray-400',
|
|
||||||
'-ml-1 mr-2 h-5 w-5',
|
|
||||||
)}
|
|
||||||
id="star-icon"
|
|
||||||
/>
|
/>
|
||||||
Star
|
{detailsQuery.data.role}
|
||||||
</span>
|
</div>
|
||||||
<span className="relative -ml-px inline-flex">
|
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||||
{detailsQuery.data._count.stars}
|
<MapPinIcon
|
||||||
</span>
|
aria-hidden="true"
|
||||||
</button>
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||||
</div>
|
/>
|
||||||
<div className="flex flex-col pt-1 sm:mt-0 sm:flex-row sm:flex-wrap sm:space-x-8">
|
{detailsQuery.data.location}
|
||||||
<div className="mt-2 flex items-center text-sm text-gray-500">
|
</div>
|
||||||
<BriefcaseIcon
|
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||||
aria-hidden="true"
|
<AcademicCapIcon
|
||||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
aria-hidden="true"
|
||||||
/>
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||||
{detailsQuery.data.role}
|
/>
|
||||||
|
{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>
|
||||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
{detailsQuery.data.additionalInfo && (
|
||||||
<MapPinIcon
|
<div className="flex items-center pt-2 text-sm text-gray-500">
|
||||||
aria-hidden="true"
|
<InformationCircleIcon
|
||||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
aria-hidden="true"
|
||||||
/>
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"
|
||||||
{detailsQuery.data.location}
|
/>
|
||||||
|
{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>
|
||||||
<div className="flex items-center pt-2 text-sm text-gray-500">
|
</main>
|
||||||
<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>
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
import Head from 'next/head';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useSession } from 'next-auth/react';
|
import { useSession } from 'next-auth/react';
|
||||||
import { Fragment, useEffect, useState } from 'react';
|
import { Fragment, useEffect, useState } from 'react';
|
||||||
@ -9,7 +10,7 @@ import {
|
|||||||
PlusIcon,
|
PlusIcon,
|
||||||
} from '@heroicons/react/20/solid';
|
} from '@heroicons/react/20/solid';
|
||||||
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline';
|
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 BrowseListItem from '~/components/resumes/browse/BrowseListItem';
|
||||||
import {
|
import {
|
||||||
@ -50,7 +51,7 @@ export default function ResumeHomePage() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [tabsValue, setTabsValue] = useState(BROWSE_TABS_VALUES.ALL);
|
const [tabsValue, setTabsValue] = useState(BROWSE_TABS_VALUES.ALL);
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const [resumes, setResumes] = useState(Array<Resume>());
|
const [resumes, setResumes] = useState<Array<Resume>>([]);
|
||||||
|
|
||||||
const allResumesQuery = trpc.useQuery(['resumes.resume.all'], {
|
const allResumesQuery = trpc.useQuery(['resumes.resume.all'], {
|
||||||
enabled: tabsValue === BROWSE_TABS_VALUES.ALL,
|
enabled: tabsValue === BROWSE_TABS_VALUES.ALL,
|
||||||
@ -65,19 +66,19 @@ export default function ResumeHomePage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
switch (tabsValue) {
|
switch (tabsValue) {
|
||||||
case BROWSE_TABS_VALUES.ALL: {
|
case BROWSE_TABS_VALUES.ALL: {
|
||||||
setResumes(allResumesQuery.data ?? Array<Resume>());
|
setResumes(allResumesQuery.data ?? []);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BROWSE_TABS_VALUES.STARRED: {
|
case BROWSE_TABS_VALUES.STARRED: {
|
||||||
setResumes(starredResumesQuery.data ?? Array<Resume>());
|
setResumes(starredResumesQuery.data ?? []);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BROWSE_TABS_VALUES.MY: {
|
case BROWSE_TABS_VALUES.MY: {
|
||||||
setResumes(myResumesQuery.data ?? Array<Resume>());
|
setResumes(myResumesQuery.data ?? []);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
setResumes(Array<Resume>());
|
setResumes([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@ -96,205 +97,212 @@ export default function ResumeHomePage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
<>
|
||||||
<div className="ml-4 py-4">
|
<Head>
|
||||||
<ResumeReviewsTitle />
|
<title>Resume Review Portal</title>
|
||||||
</div>
|
</Head>
|
||||||
<div className="mt-4 flex items-start">
|
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
||||||
<div className="w-screen sm:px-4 md:px-8">
|
<div className="ml-4 py-4">
|
||||||
<div className="grid grid-cols-12">
|
<ResumeReviewsTitle />
|
||||||
<div className="col-span-2 self-end">
|
</div>
|
||||||
<h1 className="mb-4 tracking-tight text-gray-900">Filters</h1>
|
<div className="mt-4 flex items-start">
|
||||||
</div>
|
<div className="w-screen sm:px-4 md:px-8">
|
||||||
<div className="col-span-10">
|
<div className="grid grid-cols-12">
|
||||||
<div className="border-grey-200 grid grid-cols-12 items-center gap-4 border-b pb-2">
|
<div className="col-span-2 self-end">
|
||||||
<div className="col-span-7">
|
<h1 className="mb-4 tracking-tight text-gray-900">Filters</h1>
|
||||||
<Tabs
|
</div>
|
||||||
label="Resume Browse Tabs"
|
<div className="col-span-10">
|
||||||
tabs={[
|
<div className="border-grey-200 grid grid-cols-12 items-center gap-4 border-b pb-2">
|
||||||
{
|
<div className="col-span-7">
|
||||||
label: 'All Resumes',
|
<Tabs
|
||||||
value: BROWSE_TABS_VALUES.ALL,
|
label="Resume Browse Tabs"
|
||||||
},
|
tabs={[
|
||||||
{
|
{
|
||||||
label: 'Starred Resumes',
|
label: 'All Resumes',
|
||||||
value: BROWSE_TABS_VALUES.STARRED,
|
value: BROWSE_TABS_VALUES.ALL,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'My Resumes',
|
label: 'Starred Resumes',
|
||||||
value: BROWSE_TABS_VALUES.MY,
|
value: BROWSE_TABS_VALUES.STARRED,
|
||||||
},
|
},
|
||||||
]}
|
{
|
||||||
value={tabsValue}
|
label: 'My Resumes',
|
||||||
onChange={setTabsValue}
|
value: BROWSE_TABS_VALUES.MY,
|
||||||
/>
|
},
|
||||||
</div>
|
]}
|
||||||
<div className="col-span-3 self-end">
|
value={tabsValue}
|
||||||
<form>
|
onChange={setTabsValue}
|
||||||
<TextInput
|
|
||||||
label=""
|
|
||||||
placeholder="Search Resumes"
|
|
||||||
startAddOn={MagnifyingGlassIcon}
|
|
||||||
startAddOnType="icon"
|
|
||||||
type="text"
|
|
||||||
value={searchValue}
|
|
||||||
onChange={setSearchValue}
|
|
||||||
/>
|
/>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
<div className="col-span-3 self-end">
|
||||||
<div className="col-span-1 justify-self-center">
|
<form>
|
||||||
<Menu as="div" className="relative inline-block text-left">
|
<TextInput
|
||||||
<div>
|
label=""
|
||||||
<Menu.Button className="group inline-flex justify-center text-sm font-medium text-gray-700 hover:text-gray-900">
|
placeholder="Search Resumes"
|
||||||
Sort
|
startAddOn={MagnifyingGlassIcon}
|
||||||
<ChevronDownIcon
|
startAddOnType="icon"
|
||||||
aria-hidden="true"
|
type="text"
|
||||||
className="-mr-1 ml-1 h-5 w-5 flex-shrink-0 text-gray-400 group-hover:text-gray-500"
|
value={searchValue}
|
||||||
/>
|
onChange={setSearchValue}
|
||||||
</Menu.Button>
|
/>
|
||||||
</div>
|
</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
|
<Transition
|
||||||
as={Fragment}
|
as={Fragment}
|
||||||
enter="transition ease-out duration-100"
|
enter="transition ease-out duration-100"
|
||||||
enterFrom="transform opacity-0 scale-95"
|
enterFrom="transform opacity-0 scale-95"
|
||||||
enterTo="transform opacity-100 scale-100"
|
enterTo="transform opacity-100 scale-100"
|
||||||
leave="transition ease-in duration-75"
|
leave="transition ease-in duration-75"
|
||||||
leaveFrom="transform opacity-100 scale-100"
|
leaveFrom="transform opacity-100 scale-100"
|
||||||
leaveTo="transform opacity-0 scale-95">
|
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">
|
<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">
|
<div className="py-1">
|
||||||
{SORT_OPTIONS.map((option) => (
|
{SORT_OPTIONS.map((option) => (
|
||||||
<Menu.Item key={option.name}>
|
<Menu.Item key={option.name}>
|
||||||
{({ active }) => (
|
{({ active }) => (
|
||||||
<a
|
<a
|
||||||
className={clsx(
|
className={clsx(
|
||||||
option.current
|
option.current
|
||||||
? 'font-medium text-gray-900'
|
? 'font-medium text-gray-900'
|
||||||
: 'text-gray-500',
|
: 'text-gray-500',
|
||||||
active ? 'bg-gray-100' : '',
|
active ? 'bg-gray-100' : '',
|
||||||
'block px-4 py-2 text-sm',
|
'block px-4 py-2 text-sm',
|
||||||
)}
|
)}
|
||||||
href={option.href}>
|
href={option.href}>
|
||||||
{option.name}
|
{option.name}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</Menu.Items>
|
</Menu.Items>
|
||||||
</Transition>
|
</Transition>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-1">
|
<div className="col-span-1">
|
||||||
<button
|
<button
|
||||||
className="rounded-md bg-indigo-500 py-1 px-3 text-sm text-white"
|
className="rounded-md bg-indigo-500 py-1 px-3 text-sm text-white"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={onClickNew}>
|
onClick={onClickNew}>
|
||||||
New
|
New
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid grid-cols-12">
|
<div className="grid grid-cols-12">
|
||||||
<div className="col-span-2">
|
<div className="col-span-2">
|
||||||
<div className="w-100 pt-4 sm:pr-0 md:pr-4">
|
<div className="w-100 pt-4 sm:pr-0 md:pr-4">
|
||||||
<form>
|
<form>
|
||||||
<h3 className="sr-only">Categories</h3>
|
<h3 className="sr-only">Categories</h3>
|
||||||
<ul
|
<ul
|
||||||
className="flex flex-wrap justify-start gap-4 pb-6 text-sm font-medium text-gray-900"
|
className="flex flex-wrap justify-start gap-4 pb-6 text-sm font-medium text-gray-900"
|
||||||
role="list">
|
role="list">
|
||||||
{TOP_HITS.map((category) => (
|
{TOP_HITS.map((category) => (
|
||||||
<li key={category.name}>
|
<li key={category.name}>
|
||||||
{/* TODO: Replace onClick with filtering function */}
|
{/* TODO: Replace onClick with filtering function */}
|
||||||
<FilterPill
|
<FilterPill
|
||||||
title={category.name}
|
title={category.name}
|
||||||
onClick={() => true}
|
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>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
{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>
|
</div>
|
||||||
</div>
|
</main>
|
||||||
</main>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ export default function SubmitResumeForm() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Upload a resume</title>
|
<title>Upload a Resume</title>
|
||||||
</Head>
|
</Head>
|
||||||
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
||||||
<section
|
<section
|
||||||
|
Reference in New Issue
Block a user