Skip to content

Commit

Permalink
Remove Leafwatch Completely
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 6, 2024
1 parent 7851eeb commit 83239bb
Show file tree
Hide file tree
Showing 33 changed files with 12 additions and 582 deletions.
28 changes: 0 additions & 28 deletions apps/api/tests/analytics/impressions.spec.ts

This file was deleted.

34 changes: 0 additions & 34 deletions apps/api/tests/analytics/overview.spec.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/web/public/sw.js

This file was deleted.

20 changes: 1 addition & 19 deletions apps/web/src/components/Account/AccountFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { useEffect, useRef } from "react";
import type { StateSnapshot, VirtuosoHandle } from "react-virtuoso";
import { Virtuoso } from "react-virtuoso";
import { useAccountFeedStore } from "src/store/non-persisted/useAccountFeedStore";
import { useImpressionsStore } from "src/store/non-persisted/useImpressionsStore";
import { useTipsStore } from "src/store/non-persisted/useTipsStore";
import { useAccountStore } from "src/store/persisted/useAccountStore";
import { useTransactionStore } from "src/store/persisted/useTransactionStore";

Expand All @@ -42,8 +40,6 @@ const AccountFeed: FC<AccountFeedProps> = ({
}) => {
const { currentAccount } = useAccountStore();
const { mediaFeedFilters } = useAccountFeedStore();
const { fetchAndStoreViews } = useImpressionsStore();
const { fetchAndStoreTips } = useTipsStore();
const { indexedPostHash } = useTransactionStore();
const virtuoso = useRef<VirtuosoHandle>(null);

Expand Down Expand Up @@ -85,14 +81,6 @@ const AccountFeed: FC<AccountFeedProps> = ({
};

const { data, error, fetchMore, loading, refetch } = usePostsQuery({
onCompleted: async ({ posts }) => {
const ids =
posts?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
},
skip: !address,
variables: { request }
});
Expand All @@ -117,15 +105,9 @@ const AccountFeed: FC<AccountFeedProps> = ({

const onEndReached = async () => {
if (hasMore) {
const { data } = await fetchMore({
await fetchMore({
variables: { request: { ...request, cursor: pageInfo?.next } }
});
const ids =
data?.posts?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
}
};

Expand Down
20 changes: 1 addition & 19 deletions apps/web/src/components/Bookmarks/BookmarksFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import type { FC } from "react";
import { useRef } from "react";
import type { StateSnapshot, VirtuosoHandle } from "react-virtuoso";
import { Virtuoso } from "react-virtuoso";
import { useImpressionsStore } from "src/store/non-persisted/useImpressionsStore";
import { useTipsStore } from "src/store/non-persisted/useTipsStore";

let virtuosoState: any = { ranges: [], screenTop: 0 };

Expand All @@ -23,8 +21,6 @@ interface BookmarksFeedProps {
}

const BookmarksFeed: FC<BookmarksFeedProps> = ({ focus }) => {
const { fetchAndStoreViews } = useImpressionsStore();
const { fetchAndStoreTips } = useTipsStore();
const virtuoso = useRef<VirtuosoHandle>(null);

const request: PostBookmarksRequest = {
Expand All @@ -33,14 +29,6 @@ const BookmarksFeed: FC<BookmarksFeedProps> = ({ focus }) => {
};

const { data, error, fetchMore, loading } = usePostBookmarksQuery({
onCompleted: async ({ postBookmarks }) => {
const ids =
postBookmarks?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
},
variables: { request }
});

Expand All @@ -58,15 +46,9 @@ const BookmarksFeed: FC<BookmarksFeedProps> = ({ focus }) => {

const onEndReached = async () => {
if (hasMore) {
const { data } = await fetchMore({
await fetchMore({
variables: { request: { ...request, cursor: pageInfo?.next } }
});
const ids =
data?.postBookmarks?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
}
};

Expand Down
20 changes: 1 addition & 19 deletions apps/web/src/components/Comment/CommentFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { OptmisticPostType } from "@hey/types/enums";
import { Card, EmptyState, ErrorMessage } from "@hey/ui";
import type { FC } from "react";
import { Virtuoso } from "react-virtuoso";
import { useImpressionsStore } from "src/store/non-persisted/useImpressionsStore";
import { useTipsStore } from "src/store/non-persisted/useTipsStore";
import { useTransactionStore } from "src/store/persisted/useTransactionStore";

interface CommentFeedProps {
Expand All @@ -26,8 +24,6 @@ interface CommentFeedProps {
const CommentFeed: FC<CommentFeedProps> = ({ postId }) => {
const { txnQueue } = useTransactionStore();
const { showHiddenComments } = useHiddenCommentFeedStore();
const { fetchAndStoreViews } = useImpressionsStore();
const { fetchAndStoreTips } = useTipsStore();

const request: PostReferencesRequest = {
pageSize: PageSize.Fifty,
Expand All @@ -39,14 +35,6 @@ const CommentFeed: FC<CommentFeedProps> = ({ postId }) => {
};

const { data, error, fetchMore, loading } = usePostReferencesQuery({
onCompleted: async ({ postReferences }) => {
const ids =
postReferences?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
},
skip: !postId,
variables: { request }
});
Expand All @@ -63,15 +51,9 @@ const CommentFeed: FC<CommentFeedProps> = ({ postId }) => {

const onEndReached = async () => {
if (hasMore) {
const { data } = await fetchMore({
await fetchMore({
variables: { request: { ...request, cursor: pageInfo?.next } }
});
const ids =
data?.postReferences?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
}
};

Expand Down
20 changes: 1 addition & 19 deletions apps/web/src/components/Comment/NoneRelevantFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { Card, StackedAvatars } from "@hey/ui";
import type { FC } from "react";
import { useState } from "react";
import { Virtuoso } from "react-virtuoso";
import { useImpressionsStore } from "src/store/non-persisted/useImpressionsStore";
import { useTipsStore } from "src/store/non-persisted/useTipsStore";

interface NoneRelevantFeedProps {
postId: string;
Expand All @@ -24,8 +22,6 @@ interface NoneRelevantFeedProps {
const NoneRelevantFeed: FC<NoneRelevantFeedProps> = ({ postId }) => {
const { showHiddenComments } = useHiddenCommentFeedStore();
const [showMore, setShowMore] = useState(false);
const { fetchAndStoreViews } = useImpressionsStore();
const { fetchAndStoreTips } = useTipsStore();

const request: PostReferencesRequest = {
pageSize: PageSize.Fifty,
Expand All @@ -37,14 +33,6 @@ const NoneRelevantFeed: FC<NoneRelevantFeedProps> = ({ postId }) => {
};

const { data, fetchMore } = usePostReferencesQuery({
onCompleted: async ({ postReferences }) => {
const ids =
postReferences?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
},
skip: !postId,
variables: { request }
});
Expand All @@ -56,15 +44,9 @@ const NoneRelevantFeed: FC<NoneRelevantFeedProps> = ({ postId }) => {

const onEndReached = async () => {
if (hasMore) {
const { data } = await fetchMore({
await fetchMore({
variables: { request: { ...request, cursor: pageInfo?.next } }
});
const ids =
data?.postReferences?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
}
};

Expand Down
14 changes: 1 addition & 13 deletions apps/web/src/components/Explore/ExploreFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import type { FC } from "react";
import { useRef } from "react";
import type { StateSnapshot, VirtuosoHandle } from "react-virtuoso";
import { Virtuoso } from "react-virtuoso";
import { useImpressionsStore } from "src/store/non-persisted/useImpressionsStore";
import { useTipsStore } from "src/store/non-persisted/useTipsStore";

let virtuosoState: any = { ranges: [], screenTop: 0 };

Expand All @@ -21,8 +19,6 @@ const ExploreFeed: FC<ExploreFeedProps> = ({
feedType = ExplorePublicationsOrderByType.LensCurated,
focus
}) => {
const { fetchAndStoreViews } = useImpressionsStore();
const { fetchAndStoreTips } = useTipsStore();
const virtuoso = useRef<VirtuosoHandle>(null);

const request: ExplorePublicationRequest = {
Expand All @@ -35,11 +31,6 @@ const ExploreFeed: FC<ExploreFeedProps> = ({
};

const { data, error, fetchMore, loading } = useExplorePublicationsQuery({
onCompleted: async ({ explorePublications }) => {
const ids = explorePublications?.items?.map((p) => p.id) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
},
variables: { request }
});

Expand All @@ -57,12 +48,9 @@ const ExploreFeed: FC<ExploreFeedProps> = ({

const onEndReached = async () => {
if (hasMore) {
const { data } = await fetchMore({
await fetchMore({
variables: { request: { ...request, cursor: pageInfo?.next } }
});
const ids = data?.explorePublications?.items?.map((p) => p.id) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
}
};

Expand Down
10 changes: 0 additions & 10 deletions apps/web/src/components/Explore/ImageFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import { type AnyPost, MainContentFocus } from "@hey/indexer";
import { EmptyState, ErrorMessage } from "@hey/ui";
import type { FC } from "react";
import { useImpressionsStore } from "src/store/non-persisted/useImpressionsStore";
import { useTipsStore } from "src/store/non-persisted/useTipsStore";

interface ImageFeedProps {
feedType: ExplorePublicationsOrderByType;
Expand All @@ -14,9 +12,6 @@ interface ImageFeedProps {
const ImageFeed: FC<ImageFeedProps> = ({
feedType = ExplorePublicationsOrderByType.LensCurated
}) => {
const { fetchAndStoreViews } = useImpressionsStore();
const { fetchAndStoreTips } = useTipsStore();

const request: ExplorePublicationRequest = {
limit: LimitType.Fifty,
orderBy: feedType,
Expand All @@ -29,11 +24,6 @@ const ImageFeed: FC<ImageFeedProps> = ({
};

const { data, error, loading } = useExplorePublicationsQuery({
onCompleted: async ({ explorePublications }) => {
const ids = explorePublications?.items?.map((p) => p.id) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
},
variables: { request }
});

Expand Down
20 changes: 1 addition & 19 deletions apps/web/src/components/Group/GroupFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import type { FC } from "react";
import { useEffect, useRef } from "react";
import type { StateSnapshot, VirtuosoHandle } from "react-virtuoso";
import { Virtuoso } from "react-virtuoso";
import { useImpressionsStore } from "src/store/non-persisted/useImpressionsStore";
import { useTipsStore } from "src/store/non-persisted/useTipsStore";

let virtuosoState: any = { ranges: [], screenTop: 0 };

Expand All @@ -22,8 +20,6 @@ interface GroupFeedProps {
}

const GroupFeed: FC<GroupFeedProps> = ({ handle }) => {
const { fetchAndStoreViews } = useImpressionsStore();
const { fetchAndStoreTips } = useTipsStore();
const virtuoso = useRef<VirtuosoHandle>(null);

useEffect(() => {
Expand All @@ -36,14 +32,6 @@ const GroupFeed: FC<GroupFeedProps> = ({ handle }) => {
};

const { data, error, fetchMore, loading } = usePostsQuery({
onCompleted: async ({ posts }) => {
const ids =
posts?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
},
skip: !handle,
variables: { request }
});
Expand All @@ -62,15 +50,9 @@ const GroupFeed: FC<GroupFeedProps> = ({ handle }) => {

const onEndReached = async () => {
if (hasMore) {
const { data } = await fetchMore({
await fetchMore({
variables: { request: { ...request, cursor: pageInfo?.next } }
});
const ids =
data?.posts?.items?.map((post) =>
post.__typename === "Repost" ? post.repostOf?.id : post.id
) || [];
await fetchAndStoreViews(ids);
await fetchAndStoreTips(ids);
}
};

Expand Down
Loading

0 comments on commit 83239bb

Please sign in to comment.