diff --git a/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx b/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
index f113ffdb..fbf357dc 100644
--- a/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
@@ -1,9 +1,9 @@
import { useRouter } from 'next/router';
-import { useState } from 'react';
-import { setTimeout } from 'timers';
-import { CheckIcon, DocumentDuplicateIcon } from '@heroicons/react/20/solid';
-import { BookmarkSquareIcon, EyeIcon } from '@heroicons/react/24/outline';
-import { Button, TextInput } from '@tih/ui';
+// Import { useState } from 'react';
+// import { setTimeout } from 'timers';
+import { DocumentDuplicateIcon } from '@heroicons/react/20/solid';
+import { EyeIcon } from '@heroicons/react/24/outline';
+import { Button, TextInput, useToast } from '@tih/ui';
import {
copyProfileLink,
@@ -20,18 +20,18 @@ export default function OffersProfileSave({
profileId,
token,
}: OfferProfileSaveProps) {
- const [linkCopied, setLinkCopied] = useState(false);
- const [isSaving, setSaving] = useState(false);
- const [isSaved, setSaved] = useState(false);
+ const { showToast } = useToast();
+ // Const [isSaving, setSaving] = useState(false);
+ // const [isSaved, setSaved] = useState(false);
const router = useRouter();
- const saveProfile = () => {
- setSaving(true);
- setTimeout(() => {
- setSaving(false);
- setSaved(true);
- }, 5);
- };
+ // Const saveProfile = () => {
+ // setSaving(true);
+ // setTimeout(() => {
+ // setSaving(false);
+ // setSaved(true);
+ // }, 5);
+ // };
return (
@@ -44,7 +44,7 @@ export default function OffersProfileSave({
To keep you offer profile strictly anonymous, only people who have the
link below can edit it.
-
+
{
- copyProfileLink(profileId, token), setLinkCopied(true);
+ copyProfileLink(profileId, token);
+ showToast({
+ title: `Profile edit link copied to clipboard!`,
+ variant: 'success',
+ });
}}
/>
-
- {linkCopied && (
-
Link copied to clipboard!
- )}
-
-
-
+ {/*
If you do not want to keep the edit link, you can opt to save this
profile under your user account. It will still only be editable by
you.
@@ -83,7 +81,7 @@ export default function OffersProfileSave({
variant="primary"
onClick={saveProfile}
/>
-
+
*/}
('');
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',
+ });
+ }}
/>
)}
copyProfileLink(profileId)}
+ onClick={() => {
+ copyProfileLink(profileId);
+ showToast({
+ title: `Public profile link copied to clipboard!`,
+ variant: 'success',
+ });
+ }}
/>
Discussions
@@ -131,7 +154,7 @@ export default function ProfileComments({
0) {
// If it is with edit permission, send comment to API with username = null
createCommentMutation.mutate(
@@ -132,6 +136,7 @@ export default function CommentCard({
);
@@ -131,11 +133,18 @@ export default function OfferProfile() {
const trpcContext = trpc.useContext();
const deleteMutation = trpc.useMutation(['offers.profile.delete'], {
onError: () => {
- alert('Error deleting profile'); // TODO: replace with toast
+ showToast({
+ title: `Error deleting offers profile.`,
+ variant: 'failure',
+ });
},
onSuccess: () => {
trpcContext.invalidateQueries(['offers.profile.listOne']);
router.push('/offers');
+ showToast({
+ title: `Offers profile successfully deleted!`,
+ variant: 'success',
+ });
},
});
diff --git a/apps/portal/src/utils/offers/link.tsx b/apps/portal/src/utils/offers/link.tsx
index 9e111aad..a0496c3e 100644
--- a/apps/portal/src/utils/offers/link.tsx
+++ b/apps/portal/src/utils/offers/link.tsx
@@ -3,7 +3,6 @@ export function getProfileLink(profileId: string, token?: string) {
}
export function copyProfileLink(profileId: string, token?: string) {
- // TODO: Add notification
navigator.clipboard.writeText(getProfileLink(profileId, token));
}