diff --git a/apps/portal/src/components/offers/OffersNavigation.tsx b/apps/portal/src/components/offers/OffersNavigation.tsx
index 4de1fc5e..26719933 100644
--- a/apps/portal/src/components/offers/OffersNavigation.tsx
+++ b/apps/portal/src/components/offers/OffersNavigation.tsx
@@ -12,7 +12,6 @@ const navigationAuthenticated: ProductNavigationItems = [
];
const config = {
- // TODO: Change this to your own GA4 measurement ID.
googleAnalyticsMeasurementID: 'G-34XRGLEVCF',
logo: (
diff --git a/apps/portal/src/components/offers/dashboard/DashboardProfileCard.tsx b/apps/portal/src/components/offers/dashboard/DashboardProfileCard.tsx
index af4a0cfe..1fcd6e57 100644
--- a/apps/portal/src/components/offers/dashboard/DashboardProfileCard.tsx
+++ b/apps/portal/src/components/offers/dashboard/DashboardProfileCard.tsx
@@ -2,6 +2,7 @@ import { useRouter } from 'next/router';
import { ArrowRightIcon, XMarkIcon } from '@heroicons/react/24/outline';
import { Button, useToast } from '@tih/ui';
+import { useGoogleAnalytics } from '~/components/global/GoogleAnalytics';
import DashboardOfferCard from '~/components/offers/dashboard/DashboardOfferCard';
import { formatDate } from '~/utils/offers/time';
@@ -10,7 +11,6 @@ import { trpc } from '~/utils/trpc';
import ProfilePhotoHolder from '../profile/ProfilePhotoHolder';
import type { UserProfile, UserProfileOffer } from '~/types/offers';
-
type Props = Readonly<{
profile: UserProfile;
}>;
@@ -22,6 +22,7 @@ export default function DashboardProfileCard({
const router = useRouter();
const trpcContext = trpc.useContext();
const PROFILE_URL = `/offers/profile/${id}?token=${token}`;
+ const { event: gaEvent } = useGoogleAnalytics();
const removeSavedProfileMutation = trpc.useMutation(
'offers.user.profile.removeFromUserProfile',
{
@@ -97,7 +98,14 @@ export default function DashboardProfileCard({
label="Read full profile"
size="md"
variant="secondary"
- onClick={() => router.push(PROFILE_URL)}
+ onClick={() => {
+ gaEvent({
+ action: 'offers.view_profile_from_dashboard',
+ category: 'engagement',
+ label: 'View profile from dashboard',
+ });
+ router.push(PROFILE_URL);
+ }}
/>
diff --git a/apps/portal/src/components/offers/landing/LeftTextCard.tsx b/apps/portal/src/components/offers/features/LeftTextCard.tsx
similarity index 100%
rename from apps/portal/src/components/offers/landing/LeftTextCard.tsx
rename to apps/portal/src/components/offers/features/LeftTextCard.tsx
diff --git a/apps/portal/src/components/offers/landing/RightTextCard.tsx b/apps/portal/src/components/offers/features/RightTextCard.tsx
similarity index 100%
rename from apps/portal/src/components/offers/landing/RightTextCard.tsx
rename to apps/portal/src/components/offers/features/RightTextCard.tsx
diff --git a/apps/portal/src/components/offers/landing/images/offers-analysis.png b/apps/portal/src/components/offers/features/images/offers-analysis.png
similarity index 100%
rename from apps/portal/src/components/offers/landing/images/offers-analysis.png
rename to apps/portal/src/components/offers/features/images/offers-analysis.png
diff --git a/apps/portal/src/components/offers/landing/images/offers-browse.png b/apps/portal/src/components/offers/features/images/offers-browse.png
similarity index 100%
rename from apps/portal/src/components/offers/landing/images/offers-browse.png
rename to apps/portal/src/components/offers/features/images/offers-browse.png
diff --git a/apps/portal/src/components/offers/landing/images/offers-profile.png b/apps/portal/src/components/offers/features/images/offers-profile.png
similarity index 100%
rename from apps/portal/src/components/offers/landing/images/offers-profile.png
rename to apps/portal/src/components/offers/features/images/offers-profile.png
diff --git a/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx b/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
index 26d358a4..351e8c4c 100644
--- a/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
+++ b/apps/portal/src/components/offers/offersSubmission/OffersProfileSave.tsx
@@ -1,9 +1,14 @@
// Import { useState } from 'react';
// import { setTimeout } from 'timers';
+import { useState } from 'react';
import { DocumentDuplicateIcon } from '@heroicons/react/20/solid';
+import { BookmarkSquareIcon, CheckIcon } from '@heroicons/react/24/outline';
import { Button, TextInput, useToast } from '@tih/ui';
+import { useGoogleAnalytics } from '~/components/global/GoogleAnalytics';
+
import { copyProfileLink, getProfileLink } from '~/utils/offers/link';
+import { trpc } from '~/utils/trpc';
type OfferProfileSaveProps = Readonly<{
profileId: string;
@@ -15,16 +20,39 @@ export default function OffersProfileSave({
token,
}: OfferProfileSaveProps) {
const { showToast } = useToast();
- // Const [isSaving, setSaving] = useState(false);
- // const [isSaved, setSaved] = useState(false);
+ const { event: gaEvent } = useGoogleAnalytics();
+ const [isSaved, setSaved] = useState(false);
+
+ const saveMutation = trpc.useMutation(
+ ['offers.user.profile.addToUserProfile'],
+ {
+ onError: () => {
+ showToast({
+ title: `Failed to saved to dashboard!`,
+ variant: 'failure',
+ });
+ },
+ onSuccess: () => {
+ showToast({
+ title: `Saved to your repository!`,
+ variant: 'success',
+ });
+ },
+ },
+ );
- // Const saveProfile = () => {
- // setSaving(true);
- // setTimeout(() => {
- // setSaving(false);
- // setSaved(true);
- // }, 5);
- // };
+ const handleSave = () => {
+ saveMutation.mutate({
+ profileId,
+ token: token as string,
+ });
+ setSaved(true);
+ gaEvent({
+ action: 'offers.profile_submission_save_to_profile',
+ category: 'engagement',
+ label: 'Save to profile in profile submission',
+ });
+ };
return (
@@ -57,24 +85,29 @@ export default function OffersProfileSave({
title: `Profile edit link copied to clipboard!`,
variant: 'success',
});
+ gaEvent({
+ action: 'offers.profile_submission_copy_edit_profile_link',
+ category: 'engagement',
+ label: 'Copy Edit Profile Link in Profile Submission',
+ });
}}
/>
- {/*
+
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.
+ profile under your account's respository. It will still only be
+ editable by you.