From 7fc49b348100c05c4250f6f4d59c2b7e3dcc8be6 Mon Sep 17 00:00:00 2001 From: Sunday Ogbonna Date: Wed, 12 Jul 2023 14:29:15 +0100 Subject: [PATCH 01/10] feat: add top users panel with dummy data --- .../atoms/TopUserCard/top-user-card.tsx | 76 ++++++++++++++----- .../contributor-highlight-card.tsx | 5 +- .../TopUsersPanel/top-user-panel.tsx | 8 +- lib/hooks/useFetchTopUsers.ts | 22 ++++++ pages/feed/index.tsx | 2 + 5 files changed, 88 insertions(+), 25 deletions(-) create mode 100644 lib/hooks/useFetchTopUsers.ts diff --git a/components/atoms/TopUserCard/top-user-card.tsx b/components/atoms/TopUserCard/top-user-card.tsx index 548a6a602f..67c4557553 100644 --- a/components/atoms/TopUserCard/top-user-card.tsx +++ b/components/atoms/TopUserCard/top-user-card.tsx @@ -1,31 +1,73 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; + +import Link from "next/link"; +import { useRouter } from "next/router"; import { getAvatarByUsername } from "lib/utils/github"; +import useFollowUser from "lib/hooks/useFollowUser"; +import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; + import Avatar from "../Avatar/avatar"; import Button from "../Button/button"; export interface TopUserCardProps { - clasName?: string; - following: boolean; - username: string; + login: string; } -/** - * - * additional props to handle follow button click will be added in future versions - */ -const TopUserCard = ({ username, following }: TopUserCardProps) => { +const TopUserCard = ({ login }: TopUserCardProps) => { + const router = useRouter(); + const currentPath = router.asPath; + const { data: isFollowing, follow, unFollow } = useFollowUser(login); + const [host, setHost] = useState(""); + const { sessionToken, signIn } = useSupabaseAuth(); + + const handleFollowUser = async () => { + try { + if (isFollowing) { + await unFollow(); + return; + } + await follow(); + } catch (error) { + console.log(error); + } + }; + + useEffect(() => { + if (typeof window !== "undefined") { + setHost(window.location.origin as string); + } + }, []); + return ( -
-
- -

{username}

-
- {following ? ( - ) : ( - )} diff --git a/components/molecules/ContributorHighlight/contributor-highlight-card.tsx b/components/molecules/ContributorHighlight/contributor-highlight-card.tsx index f91fe5d001..abeb017fd9 100644 --- a/components/molecules/ContributorHighlight/contributor-highlight-card.tsx +++ b/components/molecules/ContributorHighlight/contributor-highlight-card.tsx @@ -229,10 +229,7 @@ const ContributorHighlightCard = ({ ) : ( -
await signIn({ provider: "github" })} - className="flex gap-2.5 py-1 items-center pl-3 pr-7" - > +
signIn({ provider: "github" })} className="flex gap-2.5 py-1 items-center pl-3 pr-7"> Follow {user}
diff --git a/components/molecules/TopUsersPanel/top-user-panel.tsx b/components/molecules/TopUsersPanel/top-user-panel.tsx index 77d647b813..0f0580ff56 100644 --- a/components/molecules/TopUsersPanel/top-user-panel.tsx +++ b/components/molecules/TopUsersPanel/top-user-panel.tsx @@ -1,15 +1,15 @@ import React from "react"; -import TopUserCard, { TopUserCardProps } from "components/atoms/TopUserCard/top-user-card"; +import TopUserCard from "components/atoms/TopUserCard/top-user-card"; interface TopUsersPanelProps { - users: TopUserCardProps[]; + users: string[]; } const TopUsersPanel = ({ users }: TopUsersPanelProps) => { return (

Top Users

- {users.map((user, i) => ( - + {users.map((login, i) => ( + ))}
); diff --git a/lib/hooks/useFetchTopUsers.ts b/lib/hooks/useFetchTopUsers.ts new file mode 100644 index 0000000000..d1de83888d --- /dev/null +++ b/lib/hooks/useFetchTopUsers.ts @@ -0,0 +1,22 @@ +import useSWR, { Fetcher } from "swr"; +import publicApiFetcher from "lib/utils/public-api-fetcher"; + +interface TopUsersResponse { + data: { login: string }[]; +} + +const useFetchTopUsers = (limit: number) => { + const { data, error, mutate } = useSWR( + limit ? `users/top?limit=${limit}` : null, + publicApiFetcher as Fetcher + ); + + return { + data: data?.data ?? [], + isLoading: !error && !data, + isError: !!error, + mutate, + }; +}; + +export { useFetchTopUsers }; diff --git a/pages/feed/index.tsx b/pages/feed/index.tsx index 48be54f280..08622877e1 100644 --- a/pages/feed/index.tsx +++ b/pages/feed/index.tsx @@ -29,6 +29,7 @@ import NewsletterForm from "components/molecules/NewsletterForm/newsletter-form" import UserCard, { MetaObj } from "components/atoms/UserCard/user-card"; import FeaturedHighlightsPanel from "components/molecules/FeaturedHighlightsPanel/featured-highlights-panel"; import { useFetchFeaturedHighlights } from "lib/hooks/useFetchFeaturedHighlights"; +import TopUsersPanel from "components/molecules/TopUsersPanel/top-user-panel"; type activeTabType = "home" | "following"; type highlightReposType = { repoName: string; repoIcon: string; full_name: string }; @@ -139,6 +140,7 @@ const Feeds: WithPageLayout = (props: HighlightSSRProps) => { />
)} +
{singleHighlight && ( Date: Wed, 12 Jul 2023 14:44:30 +0100 Subject: [PATCH 02/10] fix: build error --- pages/feed/index.tsx | 2 +- stories/atoms/top-user-card.stories.tsx | 10 ++++------ stories/molecules/top-users-panel.stories.tsx | 13 ++++--------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/pages/feed/index.tsx b/pages/feed/index.tsx index 08622877e1..183aca9ddb 100644 --- a/pages/feed/index.tsx +++ b/pages/feed/index.tsx @@ -129,7 +129,7 @@ const Feeds: WithPageLayout = (props: HighlightSSRProps) => { twitterCard="summary_large_image" />
-
+
{user && (
= (args) => ; +const TopUserCardTemplate: StoryFn = (args) => ; export const Following = TopUserCardTemplate.bind({}); export const NotFollowing = TopUserCardTemplate.bind({}); Following.args = { - username: "diivi", - following: true, + login: "diivi", }; NotFollowing.args = { - username: "ogdev-01", - following: false, + login: "ogdev-01", }; diff --git a/stories/molecules/top-users-panel.stories.tsx b/stories/molecules/top-users-panel.stories.tsx index 29e7280c84..8b0eb99b9e 100644 --- a/stories/molecules/top-users-panel.stories.tsx +++ b/stories/molecules/top-users-panel.stories.tsx @@ -1,20 +1,15 @@ -import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Meta, StoryFn } from "@storybook/react"; import TopUsersPanel from "components/molecules/TopUsersPanel/top-user-panel"; const storyConfig = { title: "Design System/Molecules/TopUsersPanel", -} as ComponentMeta; +} as Meta; export default storyConfig; -const sampleUsers = [ - { username: "bdougie", following: true }, - { username: "diivi", following: false }, - { username: "ogdev-01", following: false }, - { username: "brandonroberts", following: true }, -]; +const sampleUsers = ["bdougie", "diivi", "ogdev-01", "brandonroberts"]; -const TopUsersPanelTemplate: ComponentStory = (args) => ; +const TopUsersPanelTemplate: StoryFn = (args) => ; export const Default = TopUsersPanelTemplate.bind({}); From 8a0dd017f7a2837883f345d5c5d2fa52173ab512 Mon Sep 17 00:00:00 2001 From: Sunday Ogbonna Date: Wed, 12 Jul 2023 17:48:25 +0100 Subject: [PATCH 03/10] feat: add live data and optimize ui --- .../TopUsersPanel/top-user-panel.tsx | 20 ++++++++++++++++--- lib/hooks/useFetchTopUsers.ts | 10 ++++------ pages/feed/index.tsx | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/components/molecules/TopUsersPanel/top-user-panel.tsx b/components/molecules/TopUsersPanel/top-user-panel.tsx index 0f0580ff56..6c40e2231c 100644 --- a/components/molecules/TopUsersPanel/top-user-panel.tsx +++ b/components/molecules/TopUsersPanel/top-user-panel.tsx @@ -1,14 +1,28 @@ import React from "react"; import TopUserCard from "components/atoms/TopUserCard/top-user-card"; +import { useFetchTopUsers } from "lib/hooks/useFetchTopUsers"; +import SkeletonWrapper from "components/atoms/SkeletonLoader/skeleton-wrapper"; interface TopUsersPanelProps { - users: string[]; + loggedInUserLogin: string; } -const TopUsersPanel = ({ users }: TopUsersPanelProps) => { +const TopUsersPanel = ({ loggedInUserLogin }: TopUsersPanelProps) => { + const { data, isLoading } = useFetchTopUsers(); + + const topUsersWithoutLoggedInUser = data ? data.filter((user) => user.login !== loggedInUserLogin) : []; + const top3Users = topUsersWithoutLoggedInUser.slice(0, 3).map((user) => user.login); + return (

Top Users

- {users.map((login, i) => ( + + {isLoading && + Array.from({ length: 3 }).map((_, i) => ( +
+ +
+ ))} + {top3Users.map((login, i) => ( ))}
diff --git a/lib/hooks/useFetchTopUsers.ts b/lib/hooks/useFetchTopUsers.ts index d1de83888d..ef3d78ce78 100644 --- a/lib/hooks/useFetchTopUsers.ts +++ b/lib/hooks/useFetchTopUsers.ts @@ -1,18 +1,16 @@ import useSWR, { Fetcher } from "swr"; import publicApiFetcher from "lib/utils/public-api-fetcher"; -interface TopUsersResponse { - data: { login: string }[]; -} +type TopUsersResponse = { login: string }[]; -const useFetchTopUsers = (limit: number) => { +const useFetchTopUsers = () => { const { data, error, mutate } = useSWR( - limit ? `users/top?limit=${limit}` : null, + "users/top", publicApiFetcher as Fetcher ); return { - data: data?.data ?? [], + data: data ?? [], isLoading: !error && !data, isError: !!error, mutate, diff --git a/pages/feed/index.tsx b/pages/feed/index.tsx index 183aca9ddb..c6a1968f02 100644 --- a/pages/feed/index.tsx +++ b/pages/feed/index.tsx @@ -54,12 +54,12 @@ const Feeds: WithPageLayout = (props: HighlightSSRProps) => { const { id } = router.query; const singleHighlight = props.highlight; - const highlightId = props.highlight?.id as string; const { data: followersRepo } = useFetchFollowersHighlightRepos(); const { data, mutate, setPage, isLoading, meta } = useFetchAllHighlights(selectedRepo); const { data: emojis } = useFetchAllEmojis(); + const { data: loggedInUser, isLoading: loggedInUserLoading } = useFetchUser(user?.user_metadata.user_name as string); const { followers_count, following_count, highlights_count } = loggedInUser || {}; @@ -140,7 +140,7 @@ const Feeds: WithPageLayout = (props: HighlightSSRProps) => { />
)} - +
{singleHighlight && ( Date: Wed, 12 Jul 2023 17:49:44 +0100 Subject: [PATCH 04/10] fix: build error --- stories/molecules/top-users-panel.stories.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stories/molecules/top-users-panel.stories.tsx b/stories/molecules/top-users-panel.stories.tsx index 8b0eb99b9e..a9836db06f 100644 --- a/stories/molecules/top-users-panel.stories.tsx +++ b/stories/molecules/top-users-panel.stories.tsx @@ -7,12 +7,10 @@ const storyConfig = { export default storyConfig; -const sampleUsers = ["bdougie", "diivi", "ogdev-01", "brandonroberts"]; - const TopUsersPanelTemplate: StoryFn = (args) => ; export const Default = TopUsersPanelTemplate.bind({}); Default.args = { - users: sampleUsers, + loggedInUserLogin: "ogdev-01", }; From 5c3965d11adc42518edff4a069cfc943d3b0ad4f Mon Sep 17 00:00:00 2001 From: Sunday Ogbonna Date: Wed, 12 Jul 2023 20:12:05 +0100 Subject: [PATCH 05/10] fix: unfollow issue --- components/atoms/TopUserCard/top-user-card.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/atoms/TopUserCard/top-user-card.tsx b/components/atoms/TopUserCard/top-user-card.tsx index 67c4557553..d4f74c0981 100644 --- a/components/atoms/TopUserCard/top-user-card.tsx +++ b/components/atoms/TopUserCard/top-user-card.tsx @@ -16,17 +16,18 @@ export interface TopUserCardProps { const TopUserCard = ({ login }: TopUserCardProps) => { const router = useRouter(); const currentPath = router.asPath; - const { data: isFollowing, follow, unFollow } = useFollowUser(login); + + const { isError: notFollowing, follow, unFollow } = useFollowUser(login); const [host, setHost] = useState(""); const { sessionToken, signIn } = useSupabaseAuth(); const handleFollowUser = async () => { try { - if (isFollowing) { - await unFollow(); + if (notFollowing) { + await follow(); return; } - await follow(); + await unFollow(); } catch (error) { console.log(error); } @@ -46,7 +47,7 @@ const TopUserCard = ({ login }: TopUserCardProps) => {

{login}

- {sessionToken && isFollowing ? ( + {sessionToken && !notFollowing ? (
); From 5a09b62ee96a9f50ca8c6dde3999bf32f7ae072b Mon Sep 17 00:00:00 2001 From: Sunday Ogbonna Date: Thu, 13 Jul 2023 08:48:54 +0100 Subject: [PATCH 07/10] misc: remove console log --- components/molecules/TopUsersPanel/top-user-panel.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/molecules/TopUsersPanel/top-user-panel.tsx b/components/molecules/TopUsersPanel/top-user-panel.tsx index 8d1c743a37..15d11f5fc2 100644 --- a/components/molecules/TopUsersPanel/top-user-panel.tsx +++ b/components/molecules/TopUsersPanel/top-user-panel.tsx @@ -13,7 +13,6 @@ const TopUsersPanel = ({ loggedInUserLogin }: TopUsersPanelProps) => { const topUsersWithoutLoggedInUser = data ? data.filter((user) => user.login !== loggedInUserLogin) : []; const top3Users = topUsersWithoutLoggedInUser.slice(0, 3).map((user) => user.login); - console.log(loggedInUserLogin); return (
From fa42e4c548ea4b5541bde4536f04a03680cfcce5 Mon Sep 17 00:00:00 2001 From: Sunday Ogbonna Date: Sun, 16 Jul 2023 22:53:08 +0100 Subject: [PATCH 08/10] chore: add global mutation and update general naming --- .../top-contributor-card.tsx} | 9 +++------ .../top-contributors-panel.tsx} | 10 +++++----- lib/hooks/useFollowUser.ts | 7 +++++-- pages/feed/index.tsx | 4 ++-- stories/atoms/top-user-card.stories.tsx | 10 +++++----- .../molecules/top-contributors-panel.stories.tsx | 16 ++++++++++++++++ stories/molecules/top-users-panel.stories.tsx | 16 ---------------- 7 files changed, 36 insertions(+), 36 deletions(-) rename components/atoms/{TopUserCard/top-user-card.tsx => TopContributorCard/top-contributor-card.tsx} (90%) rename components/molecules/{TopUsersPanel/top-user-panel.tsx => TopContributorsPanel/top-contributors-panel.tsx} (77%) create mode 100644 stories/molecules/top-contributors-panel.stories.tsx delete mode 100644 stories/molecules/top-users-panel.stories.tsx diff --git a/components/atoms/TopUserCard/top-user-card.tsx b/components/atoms/TopContributorCard/top-contributor-card.tsx similarity index 90% rename from components/atoms/TopUserCard/top-user-card.tsx rename to components/atoms/TopContributorCard/top-contributor-card.tsx index 362134a055..6754205a8f 100644 --- a/components/atoms/TopUserCard/top-user-card.tsx +++ b/components/atoms/TopContributorCard/top-contributor-card.tsx @@ -9,12 +9,11 @@ import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; import Avatar from "../Avatar/avatar"; import Button from "../Button/button"; -export interface TopUserCardProps { +export interface TopContributorCardProps { login: string; - refreshCallback?: () => void; } -const TopUserCard = ({ login, refreshCallback }: TopUserCardProps) => { +const TopContributorCard = ({ login }: TopContributorCardProps) => { const router = useRouter(); const currentPath = router.asPath; @@ -31,8 +30,6 @@ const TopUserCard = ({ login, refreshCallback }: TopUserCardProps) => { await unFollow(); } catch (error) { console.log(error); - } finally { - refreshCallback && refreshCallback(); } }; @@ -79,4 +76,4 @@ const TopUserCard = ({ login, refreshCallback }: TopUserCardProps) => { ); }; -export default TopUserCard; +export default TopContributorCard; diff --git a/components/molecules/TopUsersPanel/top-user-panel.tsx b/components/molecules/TopContributorsPanel/top-contributors-panel.tsx similarity index 77% rename from components/molecules/TopUsersPanel/top-user-panel.tsx rename to components/molecules/TopContributorsPanel/top-contributors-panel.tsx index 15d11f5fc2..d4051e3819 100644 --- a/components/molecules/TopUsersPanel/top-user-panel.tsx +++ b/components/molecules/TopContributorsPanel/top-contributors-panel.tsx @@ -1,13 +1,13 @@ import React from "react"; import { useSWRConfig } from "swr"; -import TopUserCard from "components/atoms/TopUserCard/top-user-card"; +import TopContributorCard from "components/atoms/TopContributorCard/top-contributor-card"; import { useFetchTopUsers } from "lib/hooks/useFetchTopUsers"; import SkeletonWrapper from "components/atoms/SkeletonLoader/skeleton-wrapper"; -interface TopUsersPanelProps { +interface TopContributorsPanelProps { loggedInUserLogin: string; } -const TopUsersPanel = ({ loggedInUserLogin }: TopUsersPanelProps) => { +const TopContributorsPanel = ({ loggedInUserLogin }: TopContributorsPanelProps) => { const { data, isLoading } = useFetchTopUsers(); const { mutate } = useSWRConfig(); @@ -25,10 +25,10 @@ const TopUsersPanel = ({ loggedInUserLogin }: TopUsersPanelProps) => {
))} {top3Users.map((login, i) => ( - mutate(`users/${loggedInUserLogin}`)} key={i} login={login} /> + ))} ); }; -export default TopUsersPanel; +export default TopContributorsPanel; diff --git a/lib/hooks/useFollowUser.ts b/lib/hooks/useFollowUser.ts index d5395a951e..788cbc4797 100644 --- a/lib/hooks/useFollowUser.ts +++ b/lib/hooks/useFollowUser.ts @@ -1,4 +1,4 @@ -import useSWR, { Fetcher } from "swr"; +import useSWR, { Fetcher, useSWRConfig } from "swr"; import publicApiFetcher from "lib/utils/public-api-fetcher"; import useSupabaseAuth from "./useSupabaseAuth"; @@ -6,7 +6,8 @@ interface FollowUserResponse { data: DbFollowUser; } const useFollowUser = (username: string) => { - const { sessionToken } = useSupabaseAuth(); + const { sessionToken, user } = useSupabaseAuth(); + const { mutate: GlobalMutate } = useSWRConfig(); // adding this to mutate the global user data to update the users card status on follow/unfollow const { data, error, mutate } = useSWR( username ? `users/${username}/follow` : null, @@ -23,6 +24,7 @@ const useFollowUser = (username: string) => { if (req && req.ok) { mutate(); + GlobalMutate(`user/${user?.user_metadata?.username}`); } }; @@ -36,6 +38,7 @@ const useFollowUser = (username: string) => { if (req && req.ok) { mutate(); + GlobalMutate(`user/${user?.user_metadata?.username}`); } }; diff --git a/pages/feed/index.tsx b/pages/feed/index.tsx index c6a1968f02..653e2e56e6 100644 --- a/pages/feed/index.tsx +++ b/pages/feed/index.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict"; import clsx from "clsx"; +import TopContributorsPanel from "components/molecules/TopContributorsPanel/top-contributors-panel"; import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; import { useFetchAllHighlights } from "lib/hooks/useFetchAllHighlights"; import { useFetchHighlightRepos } from "lib/hooks/useFetchHiglightRepos"; @@ -29,7 +30,6 @@ import NewsletterForm from "components/molecules/NewsletterForm/newsletter-form" import UserCard, { MetaObj } from "components/atoms/UserCard/user-card"; import FeaturedHighlightsPanel from "components/molecules/FeaturedHighlightsPanel/featured-highlights-panel"; import { useFetchFeaturedHighlights } from "lib/hooks/useFetchFeaturedHighlights"; -import TopUsersPanel from "components/molecules/TopUsersPanel/top-user-panel"; type activeTabType = "home" | "following"; type highlightReposType = { repoName: string; repoIcon: string; full_name: string }; @@ -140,7 +140,7 @@ const Feeds: WithPageLayout = (props: HighlightSSRProps) => { /> )} - + {singleHighlight && ( = (args) => ; +const TopContributorCardTemplate: StoryFn = (args) => ; -export const Following = TopUserCardTemplate.bind({}); -export const NotFollowing = TopUserCardTemplate.bind({}); +export const Following = TopContributorCardTemplate.bind({}); +export const NotFollowing = TopContributorCardTemplate.bind({}); Following.args = { login: "diivi", diff --git a/stories/molecules/top-contributors-panel.stories.tsx b/stories/molecules/top-contributors-panel.stories.tsx new file mode 100644 index 0000000000..3f3445414c --- /dev/null +++ b/stories/molecules/top-contributors-panel.stories.tsx @@ -0,0 +1,16 @@ +import { Meta, StoryFn } from "@storybook/react"; +import TopContributorsPanel from "components/molecules/TopContributorsPanel/top-contributors-panel"; + +const storyConfig = { + title: "Design System/Molecules/TopContributorsPanel", +} as Meta; + +export default storyConfig; + +const TopContributorsPanelTemplate: StoryFn = (args) => ; + +export const Default = TopContributorsPanelTemplate.bind({}); + +Default.args = { + loggedInUserLogin: "ogdev-01", +}; diff --git a/stories/molecules/top-users-panel.stories.tsx b/stories/molecules/top-users-panel.stories.tsx deleted file mode 100644 index a9836db06f..0000000000 --- a/stories/molecules/top-users-panel.stories.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Meta, StoryFn } from "@storybook/react"; -import TopUsersPanel from "components/molecules/TopUsersPanel/top-user-panel"; - -const storyConfig = { - title: "Design System/Molecules/TopUsersPanel", -} as Meta; - -export default storyConfig; - -const TopUsersPanelTemplate: StoryFn = (args) => ; - -export const Default = TopUsersPanelTemplate.bind({}); - -Default.args = { - loggedInUserLogin: "ogdev-01", -}; From 2e46a6f5bb0fde8998b0c6c204f495014ed60794 Mon Sep 17 00:00:00 2001 From: Sunday Ogbonna Date: Mon, 17 Jul 2023 15:30:45 +0100 Subject: [PATCH 09/10] chore: review changes --- .../TopContributorCard/top-contributor-card.tsx | 6 +++--- .../TopContributorsPanel/top-contributors-panel.tsx | 12 +++++------- ...seFetchTopUsers.ts => useFetchTopContributors.ts} | 4 ++-- lib/hooks/useFollowUser.ts | 6 +++--- 4 files changed, 13 insertions(+), 15 deletions(-) rename lib/hooks/{useFetchTopUsers.ts => useFetchTopContributors.ts} (84%) diff --git a/components/atoms/TopContributorCard/top-contributor-card.tsx b/components/atoms/TopContributorCard/top-contributor-card.tsx index 6754205a8f..d6fded5a88 100644 --- a/components/atoms/TopContributorCard/top-contributor-card.tsx +++ b/components/atoms/TopContributorCard/top-contributor-card.tsx @@ -21,7 +21,7 @@ const TopContributorCard = ({ login }: TopContributorCardProps) => { const [host, setHost] = useState(""); const { sessionToken, signIn } = useSupabaseAuth(); - const handleFollowUser = async () => { + const handleFollowContributor = async () => { try { if (notFollowing) { await follow(); @@ -51,7 +51,7 @@ const TopContributorCard = ({ login }: TopContributorCardProps) => {