Skip to content

Commit

Permalink
Migrate to Lens v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 4, 2024
1 parent 26496c0 commit 8581b76
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions apps/web/src/components/Account/AccountFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import { AccountFeedType } from "@hey/data/enums";
import { type AnyPost, MainContentFocus, usePostsQuery } from "@hey/indexer";
import {
type AnyPost,
MainContentFocus,
PageSize,
PostType,
type PostsRequest,
usePostsQuery
} from "@hey/indexer";
import { Card, EmptyState, ErrorMessage } from "@hey/ui";
import type { FC } from "react";
import { useEffect, useRef } from "react";
Expand Down Expand Up @@ -58,35 +65,23 @@ const AccountFeed: FC<AccountFeedProps> = ({
return filters;
};

const publicationTypes: PublicationType[] =
const postTypes: PostType[] =
type === AccountFeedType.Feed
? [PublicationType.Post, PublicationType.Mirror, PublicationType.Quote]
? [PostType.Root, PostType.Repost, PostType.Quote]
: type === AccountFeedType.Replies
? [PublicationType.Comment]
? [PostType.Comment]
: type === AccountFeedType.Media
? [
PublicationType.Post,
PublicationType.Comment,
PublicationType.Quote
]
: [
PublicationType.Post,
PublicationType.Comment,
PublicationType.Mirror
];
? [PostType.Root, PostType.Comment, PostType.Quote]
: [PostType.Root, PostType.Comment, PostType.Repost, PostType.Quote];

const metadata =
type === AccountFeedType.Media
? { mainContentFocus: getMediaFilters() }
: null;
const request: PublicationsRequest = {
limit: LimitType.TwentyFive,
where: {
metadata,
publicationTypes,
...(type !== AccountFeedType.Collects
? { from: [address] }
: { actedBy: address })
}

const request: PostsRequest = {
pageSize: PageSize.Fifty,
filter: { metadata, postTypes, authors: [address] }
};

const { data, error, fetchMore, loading, refetch } = usePostsQuery({
Expand Down

0 comments on commit 8581b76

Please sign in to comment.