diff --git a/apps/portal/src/components/offers/profile/ProfileComments.tsx b/apps/portal/src/components/offers/profile/ProfileComments.tsx index d30645a8..5a8ba614 100644 --- a/apps/portal/src/components/offers/profile/ProfileComments.tsx +++ b/apps/portal/src/components/offers/profile/ProfileComments.tsx @@ -1,7 +1,13 @@ import { signIn, useSession } from 'next-auth/react'; import { useState } from 'react'; import { ClipboardDocumentIcon, ShareIcon } from '@heroicons/react/24/outline'; -import { Button, HorizontalDivider, Spinner, TextArea } from '@tih/ui'; +import { + Button, + HorizontalDivider, + Spinner, + TextArea, + useToast, +} from '@tih/ui'; import ExpandableCommentCard from '~/components/offers/profile/comments/ExpandableCommentCard'; @@ -30,6 +36,7 @@ export default function ProfileComments({ const { data: session, status } = useSession(); const [currentReply, setCurrentReply] = useState(''); const [replies, setReplies] = useState>(); + const { showToast } = useToast(); const commentsQuery = trpc.useQuery( ['offers.comments.getComments', { profileId }], @@ -51,6 +58,10 @@ export default function ProfileComments({ }); function handleComment(message: string) { + if (!currentReply.length) { + return; + } + if (isEditable) { // If it is with edit permission, send comment to API with username = null createCommentMutation.mutate( @@ -104,7 +115,13 @@ export default function ProfileComments({ label="Copy profile edit link" size="sm" variant="secondary" - onClick={() => copyProfileLink(profileId, token)} + onClick={() => { + copyProfileLink(profileId, token); + showToast({ + title: `Profile edit link copied to clipboard!`, + variant: 'success', + }); + }} /> )}