|
|
|
@ -3,7 +3,7 @@ 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 { signIn, useSession } from 'next-auth/react';
|
|
|
|
|
import { useState } from 'react';
|
|
|
|
|
import {
|
|
|
|
|
AcademicCapIcon,
|
|
|
|
@ -14,9 +14,10 @@ import {
|
|
|
|
|
PencilSquareIcon,
|
|
|
|
|
StarIcon,
|
|
|
|
|
} from '@heroicons/react/20/solid';
|
|
|
|
|
import { Spinner } from '@tih/ui';
|
|
|
|
|
import { Button, Spinner } from '@tih/ui';
|
|
|
|
|
|
|
|
|
|
import ResumeCommentsSection from '~/components/resumes/comments/ResumeCommentsSection';
|
|
|
|
|
import ResumeCommentsForm from '~/components/resumes/comments/ResumeCommentsForm';
|
|
|
|
|
import ResumeCommentsList from '~/components/resumes/comments/ResumeCommentsList';
|
|
|
|
|
import ResumePdf from '~/components/resumes/ResumePdf';
|
|
|
|
|
import ResumeExpandableText from '~/components/resumes/shared/ResumeExpandableText';
|
|
|
|
|
|
|
|
|
@ -59,6 +60,7 @@ export default function ResumeReviewPage() {
|
|
|
|
|
session?.user?.id != null && session.user.id === detailsQuery.data?.userId;
|
|
|
|
|
|
|
|
|
|
const [isEditMode, setIsEditMode] = useState(false);
|
|
|
|
|
const [showCommentsForm, setShowCommentsForm] = useState(false);
|
|
|
|
|
|
|
|
|
|
const onStarButtonClick = () => {
|
|
|
|
|
if (session?.user?.id == null) {
|
|
|
|
@ -81,6 +83,32 @@ export default function ResumeReviewPage() {
|
|
|
|
|
setIsEditMode(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const renderReviewButton = () => {
|
|
|
|
|
if (session === null) {
|
|
|
|
|
return (
|
|
|
|
|
<div className=" flex h-10 justify-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-[400] hover:cursor-pointer hover:bg-slate-50">
|
|
|
|
|
<a
|
|
|
|
|
href="/api/auth/signin"
|
|
|
|
|
onClick={(event) => {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
signIn();
|
|
|
|
|
}}>
|
|
|
|
|
Sign in to join discussion
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
<Button
|
|
|
|
|
className="h-10 py-2"
|
|
|
|
|
display="block"
|
|
|
|
|
label="Add your review"
|
|
|
|
|
variant="tertiary"
|
|
|
|
|
onClick={() => setShowCommentsForm(true)}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (isEditMode && detailsQuery.data != null) {
|
|
|
|
|
return (
|
|
|
|
|
<SubmitResumeForm
|
|
|
|
@ -120,10 +148,19 @@ export default function ResumeReviewPage() {
|
|
|
|
|
</Head>
|
|
|
|
|
<main className="h-[calc(100vh-2rem)] flex-1 space-y-2 overflow-y-auto py-4 px-8 xl:px-12 2xl:pr-16">
|
|
|
|
|
<div className="flex justify-between">
|
|
|
|
|
<h1 className="text-2xl font-semibold leading-7 text-slate-900 sm:truncate sm:text-3xl sm:tracking-tight">
|
|
|
|
|
<h1 className="pr-2 text-2xl font-semibold leading-7 text-slate-900 sm:truncate sm:text-3xl sm:tracking-tight">
|
|
|
|
|
{detailsQuery.data.title}
|
|
|
|
|
</h1>
|
|
|
|
|
<div className="flex gap-4">
|
|
|
|
|
<div className="flex gap-4 xl:pr-4">
|
|
|
|
|
{userIsOwner && (
|
|
|
|
|
<button
|
|
|
|
|
className="p h-10 rounded-md border border-slate-300 bg-white py-1 px-2 text-center"
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={onEditButtonClick}>
|
|
|
|
|
<PencilSquareIcon className="text-primary-600 hover:text-primary-300 h-6 w-6" />
|
|
|
|
|
</button>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
className="isolate inline-flex h-10 items-center space-x-4 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 disabled:hover:bg-white"
|
|
|
|
|
disabled={starMutation.isLoading || unstarMutation.isLoading}
|
|
|
|
@ -152,42 +189,36 @@ export default function ResumeReviewPage() {
|
|
|
|
|
{detailsQuery.data?._count.stars}
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
{userIsOwner && (
|
|
|
|
|
<button
|
|
|
|
|
className="p h-10 rounded-md border border-slate-300 bg-white py-1 px-2 text-center"
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={onEditButtonClick}>
|
|
|
|
|
<PencilSquareIcon className="text-primary-600 hover:text-primary-300 h-6 w-6" />
|
|
|
|
|
</button>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<div className="hidden xl:block">{renderReviewButton()}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex flex-col lg:mt-0 lg:flex-row lg:flex-wrap lg:space-x-8">
|
|
|
|
|
<div className="mt-2 flex items-center text-sm text-slate-500">
|
|
|
|
|
<div className="mt-2 flex items-center text-sm text-slate-600 xl:mt-1">
|
|
|
|
|
<BriefcaseIcon
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-indigo-400"
|
|
|
|
|
/>
|
|
|
|
|
{detailsQuery.data.role}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center pt-2 text-sm text-slate-500">
|
|
|
|
|
<div className="flex items-center pt-2 text-sm text-slate-600 xl:pt-1">
|
|
|
|
|
<MapPinIcon
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-indigo-400"
|
|
|
|
|
/>
|
|
|
|
|
{detailsQuery.data.location}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center pt-2 text-sm text-slate-500">
|
|
|
|
|
<div className="flex items-center pt-2 text-sm text-slate-600 xl:pt-1">
|
|
|
|
|
<AcademicCapIcon
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-indigo-400"
|
|
|
|
|
/>
|
|
|
|
|
{detailsQuery.data.experience}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center pt-2 text-sm text-slate-500">
|
|
|
|
|
<div className="flex items-center pt-2 text-sm text-slate-600 xl:pt-1">
|
|
|
|
|
<CalendarIcon
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-indigo-400"
|
|
|
|
|
/>
|
|
|
|
|
{`Uploaded ${formatDistanceToNow(detailsQuery.data.createdAt, {
|
|
|
|
|
addSuffix: true,
|
|
|
|
@ -195,10 +226,10 @@ export default function ResumeReviewPage() {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{detailsQuery.data.additionalInfo && (
|
|
|
|
|
<div className="flex items-start whitespace-pre-wrap pt-2 text-sm text-slate-500">
|
|
|
|
|
<div className="flex items-start whitespace-pre-wrap pt-2 text-sm text-slate-600 xl:pt-1">
|
|
|
|
|
<InformationCircleIcon
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
|
|
|
|
className="mr-1.5 h-5 w-5 flex-shrink-0 text-indigo-400"
|
|
|
|
|
/>
|
|
|
|
|
<ResumeExpandableText
|
|
|
|
|
key={detailsQuery.data.additionalInfo}
|
|
|
|
@ -206,12 +237,35 @@ export default function ResumeReviewPage() {
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<div className="flex w-full flex-col gap-6 py-4 lg:flex-row">
|
|
|
|
|
<div className="w-full lg:w-[780px]">
|
|
|
|
|
|
|
|
|
|
<div className="flex w-full flex-col gap-6 py-4 xl:flex-row xl:py-0">
|
|
|
|
|
<div className="w-full xl:w-1/2">
|
|
|
|
|
<ResumePdf url={detailsQuery.data.url} />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="grow">
|
|
|
|
|
<ResumeCommentsSection resumeId={resumeId as string} />
|
|
|
|
|
<div className="relative p-2 xl:hidden">
|
|
|
|
|
<div
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
className="absolute inset-0 flex items-center">
|
|
|
|
|
<div className="w-full border-t border-slate-300" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="relative flex justify-center">
|
|
|
|
|
<span className="bg-slate-50 px-3 text-lg font-medium text-slate-900">
|
|
|
|
|
Reviews
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="mb-4 xl:hidden">{renderReviewButton()}</div>
|
|
|
|
|
|
|
|
|
|
{showCommentsForm ? (
|
|
|
|
|
<ResumeCommentsForm
|
|
|
|
|
resumeId={resumeId as string}
|
|
|
|
|
setShowCommentsForm={setShowCommentsForm}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<ResumeCommentsList resumeId={resumeId as string} />
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
|
|
|
|