From 760b1398a1dc7e3bf8c50a8abb35e4ea6054d8db Mon Sep 17 00:00:00 2001 From: chidii Date: Wed, 29 Jul 2026 13:58:28 -0700 Subject: [PATCH 1/2] test: add FollowButton unit tests --- .../__tests__/FollowButton.test.tsx | Bin 0 -> 3868 bytes src/components/common/FollowButton.tsx | 42 ++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/components/__tests__/FollowButton.test.tsx create mode 100644 src/components/common/FollowButton.tsx diff --git a/src/components/__tests__/FollowButton.test.tsx b/src/components/__tests__/FollowButton.test.tsx new file mode 100644 index 0000000000000000000000000000000000000000..69f0e29bcf70aef821f94cba5d4d40bce78ca44e GIT binary patch literal 3868 zcmeHKO>fgc5S=p;|G~F75_MWQLJ*`-QHcXWd|bG=@rFb=4zk^*5$azD-kXi_dhIBQ z8Y)$wDvfu&GdnZy?c2$(pEH@ucUed-r3CT=pInS&lHh+Xk1#G|taF^@cp@_$zm_Xq zS?cUkV$7FvroIBX(Umzyb3FCr1>PC>DzPe)uW}?Qo-W`i#%Co1^%-NY604uWrX3k$ zveD4e=)T;OQ5m^L9!BjszJh%_3eHw>bnU|EQ~WJtDI>YW+7izhJWUW^l}jWM;vMUF zuI~q$cbBEz#g9Bhj+^%CX+EL!vFlKt<3CYh+_ZAhDKPJP2@v%ZHDJ6M;v%9Gd{=SV z%6I#B{f6?a;kQ`{%Z6AhlgmpmCDEt~U^A32@=zYgG0-@X$MOVY#$Gi1**J#CYXbCB zyfw-fR@%*nD~MQxbs4hn|5^1BV>h$zl>=0-uUvB35w1C8v{DhcXpqYY9Q=SMGV~l7 zvDWSmM_^pdhaUX)5f|C<208E~(E1uPr^*PjEW^l0nwDhu&H8&6Ty4Evblu4A2Gv~= zEy0CL&Pv7J{5H0YWD$^7Bqc%!jehf^3TMGT(UyOlg}Z`rVca8u*_OntQ)0VyifsUn#wZlBkD zq-NDMw_4YwSw6e{D!RO-&XW;j_6k{TQm}pa+urZ~bNF!jNe1{8BH!y<@qVz_&tVrP zQ~A0TIRVEDuL&+%bz!5(Y|d-g`I)>DO-@bnHRjy)?grc(3#)hb?fmwZ>EdttwA zu%2Cxzm{2@KogF&uC}uO_5Jo8BvrMk+wQNe+xMna`B#d6#dvnM7Qer_@AjVfEtpoH XDgL60aO>E}?(W8G>xAvg`5Wdp&-$xv literal 0 HcmV?d00001 diff --git a/src/components/common/FollowButton.tsx b/src/components/common/FollowButton.tsx new file mode 100644 index 00000000..8d88d30d --- /dev/null +++ b/src/components/common/FollowButton.tsx @@ -0,0 +1,42 @@ +import { useState } from 'react'; +import { Button } from '@/components/ui/button'; + +interface FollowButtonProps { + creatorAddress: string; + isFollowing: boolean; + onFollow: (creatorAddress: string) => Promise; + onUnfollow: (creatorAddress: string) => Promise; +} + +export default function FollowButton({ + creatorAddress, + isFollowing, + onFollow, + onUnfollow, +}: FollowButtonProps) { + const [loading, setLoading] = useState(false); + + const handleClick = async () => { + setLoading(true); + try { + if (isFollowing) { + await onUnfollow(creatorAddress); + } else { + await onFollow(creatorAddress); + } + } finally { + setLoading(false); + } + }; + + return ( + + ); +} \ No newline at end of file From eabd83cc0705f2bff4b7651f26e6f61ef403051b Mon Sep 17 00:00:00 2001 From: chidii Date: Wed, 29 Jul 2026 14:11:14 -0700 Subject: [PATCH 2/2] test: fix FollowButton test file encoding --- .../__tests__/FollowButton.test.tsx | Bin 3868 -> 2026 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/components/__tests__/FollowButton.test.tsx b/src/components/__tests__/FollowButton.test.tsx index 69f0e29bcf70aef821f94cba5d4d40bce78ca44e..002529ee5743d4f32dd2a0898959d59edb5f7cd8 100644 GIT binary patch literal 2026 zcmc&#(Qeu>6#WAJ;i@ljq%_d&v7_4PR;|(=ripIPCcY_F9UIw(fDr$_8yrIzt;Qz0 zy@2H8p6h$=IVZB38S7yU7PUZ|fh#Pc&Y+YQKP^!E3~Da@ow2Zi(wYjA_a2>>`tef9 ziRE_Hx5x{hT=!%I6G$*}f*DAv$K?z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