Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rip hog #609

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ NEXT_PUBLIC_API_URL="https://api-mumbai.lens.dev"
NEXT_PUBLIC_RELAY_ON=false
NEXT_PUBLIC_SENTRY_DSN=""
NEXT_PUBLIC_ALCHEMY_KEY=""
NEXT_PUBLIC_POSTHOG_TOKEN=""
NEXT_PUBLIC_PERSONAL_POSTHOG_TOKEN=""
NEXT_PUBLIC_MIXPANEL_TOKEN=""
NEXT_PUBLIC_ESTUARY_KEY=""
SENTRY_AUTH_TOKEN=""
SENTRY_IGNORE_API_RESOLUTION_ERROR=true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
"interweave": "^13.0.0",
"interweave-autolink": "^5.1.0",
"jwt-decode": "^3.1.2",
"mixpanel-browser": "^2.45.0",
"next": "^12.2.6-canary.8",
"next-themes": "^0.2.0",
"next-transpile-modules": "^9.0.0",
"plyr-react": "^5.1.0",
"posthog-js": "^1.29.3",
"react": "^18.2.0",
"react-cool-inview": "^3.0.1",
"react-copy-to-clipboard": "^5.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Comment/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Spinner } from '@components/UI/Spinner';
import { LensterPublication } from '@generated/lenstertypes';
import { CommentFields } from '@gql/CommentFields';
import { CollectionIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import React, { FC } from 'react';
import { useInView } from 'react-cool-inview';
import { useAppStore } from 'src/store/app';
Expand Down Expand Up @@ -70,7 +70,7 @@ const Feed: FC<Props> = ({ publication, onlyFollowers = false, isFollowing = tru
profileId: currentProfile?.id ?? null
}
});
Hog.track(PAGINATION.COMMENT_FEED);
Mixpanel.track(PAGINATION.COMMENT_FEED);
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/Comment/New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ChatAlt2Icon } from '@heroicons/react/outline';
import { defaultFeeData, defaultModuleData, getModule } from '@lib/getModule';
import getSignature from '@lib/getSignature';
import getTags from '@lib/getTags';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import onError from '@lib/onError';
import splitSignature from '@lib/splitSignature';
import trimify from '@lib/trimify';
Expand Down Expand Up @@ -79,7 +79,7 @@ const NewComment: FC<Props> = ({ setShowModal, hideCard = false, publication })
setAttachments([]);
setSelectedModule(defaultModuleData);
setFeeData(defaultFeeData);
Hog.track(COMMENT.NEW);
Mixpanel.track(COMMENT.NEW);
};

const { isLoading: signLoading, signTypedDataAsync } = useSignTypedData({ onError });
Expand Down
6 changes: 3 additions & 3 deletions src/components/Crowdfund/New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { PlusIcon } from '@heroicons/react/outline';
import getIPFSLink from '@lib/getIPFSLink';
import getSignature from '@lib/getSignature';
import getTokenImage from '@lib/getTokenImage';
import { Hog } from '@lib/hog';
import imagekitURL from '@lib/imagekitURL';
import { Mixpanel } from '@lib/mixpanel';
import onError from '@lib/onError';
import splitSignature from '@lib/splitSignature';
import uploadMediaToIPFS from '@lib/uploadMediaToIPFS';
Expand Down Expand Up @@ -86,11 +86,11 @@ const NewCrowdfund: NextPage = () => {
const [selectedCurrencySymobol, setSelectedCurrencySymobol] = useState('WMATIC');

useEffect(() => {
Hog.track('Pageview', { path: PAGEVIEW.CREATE_CROWDFUND });
Mixpanel.track('Pageview', { path: PAGEVIEW.CREATE_CROWDFUND });
}, []);

const onCompleted = () => {
Hog.track(CROWDFUND.NEW);
Mixpanel.track(CROWDFUND.NEW);
};

const { isLoading: signLoading, signTypedDataAsync } = useSignTypedData({ onError });
Expand Down
4 changes: 2 additions & 2 deletions src/components/Explore/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CommentFields } from '@gql/CommentFields';
import { MirrorFields } from '@gql/MirrorFields';
import { PostFields } from '@gql/PostFields';
import { CollectionIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import React, { FC } from 'react';
import { useInView } from 'react-cool-inview';
import { useAppStore } from 'src/store/app';
Expand Down Expand Up @@ -79,7 +79,7 @@ const Feed: FC<Props> = ({ feedType = PublicationSortCriteria.CuratedProfiles })
profileId: currentProfile?.id ?? null
}
});
Hog.track(PAGINATION.EXPLORE_FEED);
Mixpanel.track(PAGINATION.EXPLORE_FEED);
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/Explore/FeedType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SparklesIcon,
SwitchHorizontalIcon
} from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import clsx from 'clsx';
import { useRouter } from 'next/router';
import React, { Dispatch, FC, ReactNode } from 'react';
Expand All @@ -33,7 +33,7 @@ const FeedType: FC<Props> = ({ setFeedType, feedType }) => {
onClick={() => {
push({ query: { type: type.toLowerCase() } });
setFeedType(type);
Hog.track(`Switch to ${type.toLowerCase()} type in explore`);
Mixpanel.track(`Switch to ${type.toLowerCase()} type in explore`);
}}
className={clsx(
{
Expand Down
4 changes: 2 additions & 2 deletions src/components/Explore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Trending from '@components/Home/Trending';
import Footer from '@components/Shared/Footer';
import Seo from '@components/utils/Seo';
import { PublicationSortCriteria } from '@generated/types';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import { NextPage } from 'next';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react';
Expand All @@ -30,7 +30,7 @@ const Explore: NextPage = () => {
);

useEffect(() => {
Hog.track('Pageview', { path: PAGEVIEW.EXPLORE });
Mixpanel.track('Pageview', { path: PAGEVIEW.EXPLORE });
}, []);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Home/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CommentFields } from '@gql/CommentFields';
import { MirrorFields } from '@gql/MirrorFields';
import { PostFields } from '@gql/PostFields';
import { CollectionIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import React, { FC } from 'react';
import { useInView } from 'react-cool-inview';
import { useAppStore } from 'src/store/app';
Expand Down Expand Up @@ -69,7 +69,7 @@ const Feed: FC = () => {
profileId: currentProfile?.id ?? null
}
});
Hog.track(PAGINATION.HOME_FEED);
Mixpanel.track(PAGINATION.HOME_FEED);
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/Home/RecommendedProfiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Profile } from '@generated/types';
import { ProfileFields } from '@gql/ProfileFields';
import { DotsCircleHorizontalIcon, UsersIcon } from '@heroicons/react/outline';
import { SparklesIcon } from '@heroicons/react/solid';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import React, { FC, useState } from 'react';
import { MISCELLANEOUS } from 'src/tracking';

Expand Down Expand Up @@ -87,7 +87,7 @@ const RecommendedProfiles: FC = () => {
className="bg-gray-50 dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 border-t dark:border-t-gray-700/80 text-sm w-full rounded-b-xl text-left px-5 py-3 flex items-center space-x-2 text-gray-600 dark:text-gray-300"
onClick={() => {
setShowSuggestedModal(true);
Hog.track(MISCELLANEOUS.OPEN_RECOMMENDED_PROFILES);
Mixpanel.track(MISCELLANEOUS.OPEN_RECOMMENDED_PROFILES);
}}
>
<DotsCircleHorizontalIcon className="h-4 w-4" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Home/SetProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Card, CardBody } from '@components/UI/Card';
import { MinusCircleIcon, PencilAltIcon, PhotographIcon } from '@heroicons/react/outline';
import { CheckCircleIcon } from '@heroicons/react/solid';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import clsx from 'clsx';
import Link from 'next/link';
import { FC } from 'react';
Expand Down Expand Up @@ -49,7 +49,7 @@ const SetProfile: FC = () => {
</div>
<div className="flex items-center space-x-1.5 text-sm font-bold">
<PencilAltIcon className="w-4 h-4" />
<Link href="/settings" onClick={() => Hog.track(MISCELLANEOUS.NAVIGATE_UPDATE_PROFILE)}>
<Link href="/settings" onClick={() => Mixpanel.track(MISCELLANEOUS.NAVIGATE_UPDATE_PROFILE)}>
Update profile here
</Link>
</div>
Expand Down
10 changes: 2 additions & 8 deletions src/components/Home/Trending.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Card, CardBody } from '@components/UI/Card';
import { ErrorMessage } from '@components/UI/ErrorMessage';
import { TagResult, TagSortCriteria } from '@generated/types';
import { TrendingUpIcon } from '@heroicons/react/solid';
import { featureEnabled, Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import nFormatter from '@lib/nFormatter';
import Link from 'next/link';
import React, { FC } from 'react';
Expand All @@ -31,19 +31,13 @@ const Title = () => {
};

const Trending: FC = () => {
const isFeatureEnabled = featureEnabled('trending-widget');
const { data, loading, error } = useQuery(TRENDING_QUERY, {
variables: {
request: { limit: 7, sort: TagSortCriteria.MostPopular }
},
skip: !isFeatureEnabled,
pollInterval: 10000
});

if (!isFeatureEnabled) {
return null;
}

if (loading) {
return (
<>
Expand Down Expand Up @@ -73,7 +67,7 @@ const Trending: FC = () => {
<div key={tag?.tag}>
<Link
href={`/search?q=${tag?.tag}&type=pubs`}
onClick={() => Hog.track(MISCELLANEOUS.OPEN_TRENDING_TAG)}
onClick={() => Mixpanel.track(MISCELLANEOUS.OPEN_TRENDING_TAG)}
>
<div className="font-bold">{tag?.tag}</div>
<div className="text-[12px] text-gray-500">{nFormatter(tag?.total)} Publications</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Announcement from '@components/Home/Announcement';
import NewPost from '@components/Publication/New';
import Footer from '@components/Shared/Footer';
import Seo from '@components/utils/Seo';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import { NextPage } from 'next';
import React, { useEffect } from 'react';
import { useAppStore } from 'src/store/app';
Expand All @@ -20,7 +20,7 @@ import Trending from './Trending';

const Home: NextPage = () => {
useEffect(() => {
Hog.track('Pageview', { path: PAGEVIEW.HOME });
Mixpanel.track('Pageview', { path: PAGEVIEW.HOME });
}, []);

const currentProfile = useAppStore((state) => state.currentProfile);
Expand Down
12 changes: 9 additions & 3 deletions src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@ import { Profile } from '@generated/types';
import { ProfileFields } from '@gql/ProfileFields';
import getIsAuthTokensAvailable from '@lib/getIsAuthTokensAvailable';
import getToastOptions from '@lib/getToastOptions';
import { posthogInit } from '@lib/hog';
import resetAuthData from '@lib/resetAuthData';
import mixpanel from 'mixpanel-browser';
import Head from 'next/head';
import { useTheme } from 'next-themes';
import { FC, ReactNode, useEffect } from 'react';
import { Toaster } from 'react-hot-toast';
import { CHAIN_ID } from 'src/constants';
import { CHAIN_ID, MIXPANEL_API_HOST, MIXPANEL_TOKEN } from 'src/constants';
import { useAppPersistStore, useAppStore } from 'src/store/app';
import { useAccount, useDisconnect, useNetwork } from 'wagmi';

import Loading from './Loading';
import Navbar from './Shared/Navbar';
import useIsMounted from './utils/hooks/useIsMounted';

posthogInit();
if (MIXPANEL_TOKEN) {
mixpanel.init(MIXPANEL_TOKEN, {
ignore_dnt: true,
api_host: MIXPANEL_API_HOST,
batch_requests: false
});
}

export const USER_PROFILES_QUERY = gql`
query UserProfiles($ownedBy: [EthereumAddress!]) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Notification/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { gql, useQuery } from '@apollo/client';
import { LightningBoltIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import Link from 'next/link';
import { FC, useEffect, useState } from 'react';
import { useAppPersistStore, useAppStore } from 'src/store/app';
Expand Down Expand Up @@ -41,7 +41,7 @@ const NotificationIcon: FC = () => {
onClick={() => {
setNotificationCount(data?.notifications?.pageInfo?.totalCount);
setShowBadge(false);
Hog.track(NOTIFICATION.OPEN);
Mixpanel.track(NOTIFICATION.OPEN);
}}
>
<LightningBoltIcon className="w-5 h-5 sm:w-6 sm:h-6" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Notification/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CollectModuleFields } from '@gql/CollectModuleFields';
import { MetadataFields } from '@gql/MetadataFields';
import { ProfileFields } from '@gql/ProfileFields';
import { MailIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import { FC } from 'react';
import { useInView } from 'react-cool-inview';
import { useAppStore } from 'src/store/app';
Expand Down Expand Up @@ -173,7 +173,7 @@ const List: FC = () => {
}
}
});
Hog.track(PAGINATION.NOTIFICATION_FEED);
Mixpanel.track(PAGINATION.NOTIFICATION_FEED);
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/Notification/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Seo from '@components/utils/Seo';
import { LightningBoltIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import { FC, useEffect } from 'react';
import { APP_NAME } from 'src/constants';
import Custom404 from 'src/pages/404';
Expand All @@ -13,7 +13,7 @@ const Notification: FC = () => {
const currentProfile = useAppStore((state) => state.currentProfile);

useEffect(() => {
Hog.track('Pageview', { path: PAGEVIEW.NOTIFICATION });
Mixpanel.track('Pageview', { path: PAGEVIEW.NOTIFICATION });
}, []);

if (!currentProfile) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Pages/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TextArea } from '@components/UI/TextArea';
import Seo from '@components/utils/Seo';
import { PencilAltIcon } from '@heroicons/react/outline';
import { CheckCircleIcon } from '@heroicons/react/solid';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import { useRouter } from 'next/router';
import React, { FC, useEffect } from 'react';
import { APP_NAME, CONTACT_EMAIL } from 'src/constants';
Expand All @@ -27,7 +27,7 @@ const newContactSchema = object({

const Contact: FC = () => {
useEffect(() => {
Hog.track('Pageview', { path: PAGEVIEW.CONTACT });
Mixpanel.track('Pageview', { path: PAGEVIEW.CONTACT });
}, []);

const { push } = useRouter();
Expand Down
4 changes: 2 additions & 2 deletions src/components/Pages/Privacy.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Footer from '@components/Shared/Footer';
import Seo from '@components/utils/Seo';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import React, { FC, useEffect } from 'react';
import { APP_NAME } from 'src/constants';
import { PAGEVIEW } from 'src/tracking';

const Privacy: FC = () => {
useEffect(() => {
Hog.track('Pageview', { path: PAGEVIEW.PRIVACY });
Mixpanel.track('Pageview', { path: PAGEVIEW.PRIVACY });
}, []);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Pages/Thanks.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Footer from '@components/Shared/Footer';
import Seo from '@components/utils/Seo';
import { HeartIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import { useTheme } from 'next-themes';
import React, { FC, Fragment, ReactNode, useEffect } from 'react';
import { APP_NAME, STATIC_ASSETS } from 'src/constants';
Expand Down Expand Up @@ -38,7 +38,7 @@ const Brand: FC<Props> = ({ name, logo, url, size, children }) => {

const Thanks: FC = () => {
useEffect(() => {
Hog.track('Pageview', { path: PAGEVIEW.THANKS });
Mixpanel.track('Pageview', { path: PAGEVIEW.THANKS });
}, []);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Profile/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CommentFields } from '@gql/CommentFields';
import { MirrorFields } from '@gql/MirrorFields';
import { PostFields } from '@gql/PostFields';
import { CollectionIcon } from '@heroicons/react/outline';
import { Hog } from '@lib/hog';
import { Mixpanel } from '@lib/mixpanel';
import React, { FC } from 'react';
import { useInView } from 'react-cool-inview';
import { useAppStore } from 'src/store/app';
Expand Down Expand Up @@ -98,7 +98,7 @@ const Feed: FC<Props> = ({ profile, type }) => {
profileId: currentProfile?.id ?? null
}
});
Hog.track(PAGINATION.PROFILE_FEED);
Mixpanel.track(PAGINATION.PROFILE_FEED);
}
});

Expand Down
Loading