diff --git a/apps/portal/src/components/resumes/SignInButton.tsx b/apps/portal/src/components/resumes/SignInButton.tsx new file mode 100644 index 00000000..8718e588 --- /dev/null +++ b/apps/portal/src/components/resumes/SignInButton.tsx @@ -0,0 +1,24 @@ +import { signIn } from 'next-auth/react'; + +type Props = Readonly<{ + text: string; +}>; + +export default function SignInButton({ text }: Props) { + return ( +
+

+ { + event.preventDefault(); + signIn(); + }}> + Sign in + {' '} + {text} +

+
+ ); +} diff --git a/apps/portal/src/components/resumes/comments/CommentsList.tsx b/apps/portal/src/components/resumes/comments/CommentsList.tsx index d40b500a..e3d9f532 100644 --- a/apps/portal/src/components/resumes/comments/CommentsList.tsx +++ b/apps/portal/src/components/resumes/comments/CommentsList.tsx @@ -1,11 +1,13 @@ +import { useSession } from 'next-auth/react'; import { useState } from 'react'; import { Tabs } from '@tih/ui'; +import { Button } from '@tih/ui'; import { trpc } from '~/utils/trpc'; import CommentListItems from './CommentListItems'; -import CommentsListButton from './CommentsListButton'; import { COMMENTS_SECTIONS } from './constants'; +import SignInButton from '../SignInButton'; type CommentsListProps = Readonly<{ resumeId: string; @@ -16,13 +18,27 @@ export default function CommentsList({ resumeId, setShowCommentsForm, }: CommentsListProps) { + const { data: sessionData } = useSession(); const [tab, setTab] = useState(COMMENTS_SECTIONS[0].value); const commentsQuery = trpc.useQuery(['resumes.reviews.list', { resumeId }]); + const renderButton = () => { + if (sessionData === null) { + return ; + } + return ( +