From b9f347b7f43a4f7bfc8975c1eb2a1d99fac53afb Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Thu, 11 Aug 2022 12:54:09 -0700 Subject: [PATCH] Use `UserFollowButton` instead of `FollowButton` in `UserPage` (#742) --- web/components/user-page.tsx | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/web/components/user-page.tsx b/web/components/user-page.tsx index 5415ed39..1adf9f2d 100644 --- a/web/components/user-page.tsx +++ b/web/components/user-page.tsx @@ -6,12 +6,7 @@ import { LinkIcon } from '@heroicons/react/solid' import { PencilIcon } from '@heroicons/react/outline' import Confetti from 'react-confetti' -import { - follow, - getPortfolioHistory, - unfollow, - User, -} from 'web/lib/firebase/users' +import { getPortfolioHistory, User } from 'web/lib/firebase/users' import { CreatorContractsList } from './contract/contracts-grid' import { SEO } from './SEO' import { Page } from './page' @@ -31,8 +26,7 @@ import { getContractFromId, listContracts } from 'web/lib/firebase/contracts' import { LoadingIndicator } from './loading-indicator' import { BetsList } from './bets-list' import { FollowersButton, FollowingButton } from './following-button' -import { useFollows } from 'web/hooks/use-follows' -import { FollowButton } from './follow-button' +import { UserFollowButton } from './follow-button' import { PortfolioMetrics } from 'common/user' import { GroupsButton } from 'web/components/groups/groups-button' import { PortfolioValueSection } from './portfolio/portfolio-value-section' @@ -120,19 +114,8 @@ export function UserPage(props: { user: User; currentUser?: User }) { } }, [userBets, usersComments]) - const yourFollows = useFollows(currentUser?.id) - const isFollowing = yourFollows?.includes(user.id) const profit = user.profitCached.allTime - const onFollow = () => { - if (!currentUser) return - follow(currentUser.id, user.id) - } - const onUnfollow = () => { - if (!currentUser) return - unfollow(currentUser.id, user.id) - } - return ( - {!isCurrentUser && ( - - )} + {!isCurrentUser && } {isCurrentUser && ( {' '}