|
|
@ -3,7 +3,7 @@ import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
|
|
|
import Error from 'next/error';
|
|
|
|
import Error from 'next/error';
|
|
|
|
import Head from 'next/head';
|
|
|
|
import Head from 'next/head';
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
import { useSession } from 'next-auth/react';
|
|
|
|
import { signIn, useSession } from 'next-auth/react';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
AcademicCapIcon,
|
|
|
|
AcademicCapIcon,
|
|
|
@ -14,9 +14,10 @@ import {
|
|
|
|
PencilSquareIcon,
|
|
|
|
PencilSquareIcon,
|
|
|
|
StarIcon,
|
|
|
|
StarIcon,
|
|
|
|
} from '@heroicons/react/20/solid';
|
|
|
|
} 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 ResumePdf from '~/components/resumes/ResumePdf';
|
|
|
|
import ResumeExpandableText from '~/components/resumes/shared/ResumeExpandableText';
|
|
|
|
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;
|
|
|
|
session?.user?.id != null && session.user.id === detailsQuery.data?.userId;
|
|
|
|
|
|
|
|
|
|
|
|
const [isEditMode, setIsEditMode] = useState(false);
|
|
|
|
const [isEditMode, setIsEditMode] = useState(false);
|
|
|
|
|
|
|
|
const [showCommentsForm, setShowCommentsForm] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
const onStarButtonClick = () => {
|
|
|
|
const onStarButtonClick = () => {
|
|
|
|
if (session?.user?.id == null) {
|
|
|
|
if (session?.user?.id == null) {
|
|
|
@ -81,6 +83,32 @@ export default function ResumeReviewPage() {
|
|
|
|
setIsEditMode(true);
|
|
|
|
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) {
|
|
|
|
if (isEditMode && detailsQuery.data != null) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<SubmitResumeForm
|
|
|
|
<SubmitResumeForm
|
|
|
@ -120,10 +148,19 @@ export default function ResumeReviewPage() {
|
|
|
|
</Head>
|
|
|
|
</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">
|
|
|
|
<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">
|
|
|
|
<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}
|
|
|
|
{detailsQuery.data.title}
|
|
|
|
</h1>
|
|
|
|
</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
|
|
|
|
<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"
|
|
|
|
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}
|
|
|
|
disabled={starMutation.isLoading || unstarMutation.isLoading}
|
|
|
@ -152,42 +189,36 @@ export default function ResumeReviewPage() {
|
|
|
|
{detailsQuery.data?._count.stars}
|
|
|
|
{detailsQuery.data?._count.stars}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
{userIsOwner && (
|
|
|
|
|
|
|
|
<button
|
|
|
|
<div className="hidden xl:block">{renderReviewButton()}</div>
|
|
|
|
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>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="flex flex-col lg:mt-0 lg:flex-row lg:flex-wrap lg:space-x-8">
|
|
|
|
<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
|
|
|
|
<BriefcaseIcon
|
|
|
|
aria-hidden="true"
|
|
|
|
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}
|
|
|
|
{detailsQuery.data.role}
|
|
|
|
</div>
|
|
|
|
</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
|
|
|
|
<MapPinIcon
|
|
|
|
aria-hidden="true"
|
|
|
|
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}
|
|
|
|
{detailsQuery.data.location}
|
|
|
|
</div>
|
|
|
|
</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
|
|
|
|
<AcademicCapIcon
|
|
|
|
aria-hidden="true"
|
|
|
|
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}
|
|
|
|
{detailsQuery.data.experience}
|
|
|
|
</div>
|
|
|
|
</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
|
|
|
|
<CalendarIcon
|
|
|
|
aria-hidden="true"
|
|
|
|
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, {
|
|
|
|
{`Uploaded ${formatDistanceToNow(detailsQuery.data.createdAt, {
|
|
|
|
addSuffix: true,
|
|
|
|
addSuffix: true,
|
|
|
@ -195,10 +226,10 @@ export default function ResumeReviewPage() {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{detailsQuery.data.additionalInfo && (
|
|
|
|
{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
|
|
|
|
<InformationCircleIcon
|
|
|
|
aria-hidden="true"
|
|
|
|
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
|
|
|
|
<ResumeExpandableText
|
|
|
|
key={detailsQuery.data.additionalInfo}
|
|
|
|
key={detailsQuery.data.additionalInfo}
|
|
|
@ -206,12 +237,35 @@ export default function ResumeReviewPage() {
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</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} />
|
|
|
|
<ResumePdf url={detailsQuery.data.url} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="grow">
|
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</main>
|
|
|
|