import { XMarkIcon } from "@heroicons/react/24/outline";
import {
type AccountFragment,
PageSize,
useAccountRecommendationsQuery
} from "@hey/indexer";
import { memo, useState } from "react";
import Suggested from "@/components/Home/Suggested";
import DismissRecommendedAccount from "@/components/Shared/Account/DismissRecommendedAccount";
import SingleAccount from "@/components/Shared/Account/SingleAccount";
import SingleAccountShimmer from "@/components/Shared/Shimmer/SingleAccountShimmer";
import Skeleton from "@/components/Shared/Skeleton";
import { Card, ErrorMessage, H5, Modal } from "@/components/Shared/UI";
import { useAccountStore } from "@/store/persisted/useAccountStore";
const Title = memo(() =>
Who to Follow
);
const WhoToFollow = () => {
const { currentAccount } = useAccountStore();
const [showMore, setShowMore] = useState(false);
const { data, error, loading } = useAccountRecommendationsQuery({
variables: {
request: {
account: currentAccount?.address,
pageSize: PageSize.Fifty,
shuffle: true
}
}
});
if (loading) {
return (
{Array.from({ length: 5 }, (_, index) => `placeholder-${index}`).map(
(id) => (
)
)}
);
}
if (!data?.mlAccountRecommendations.items.length) {
return null;
}
const recommendedAccounts = data?.mlAccountRecommendations.items.filter(
(account) =>
!account.operations?.isBlockedByMe &&
!account.operations?.isFollowedByMe &&
!account.operations?.hasBlockedMe
) as AccountFragment[];
if (!recommendedAccounts?.length) {
return null;
}
return (
<>
{recommendedAccounts?.slice(0, 5).map((account) => (
))}
{recommendedAccounts.length > 5 && (
)}
setShowMore(false)}
show={showMore}
title="Suggested for you"
>
>
);
};
export default memo(WhoToFollow);