Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { useIsFollowing } from 'web/hooks/use-follows'
|
|
import { isBlocked, usePrivateUser, useUser } from 'web/hooks/use-user'
|
|
import { track } from 'web/lib/service/analytics'
|
|
import { Button } from './button'
|
|
import clsx from 'clsx'
|
|
|
|
export function FollowButton(props: {
|
|
userId: string
|
|
size?: '2xs' | 'xs' | 'sm'
|
|
golden?: boolean
|
|
}) {
|
|
const { userId, size = 'sm', golden } = props
|
|
const user = useUser()
|
|
const { isFollowing, toggleFollow } = useIsFollowing(user?.id, userId)
|
|
const privateUser = usePrivateUser()
|
|
if (!user || user.id === userId) return null
|
|
if (isBlocked(privateUser, userId)) return <div />
|
|
|
|
// Use golden styling when not following and golden prop is true
|
|
const useGolden = golden && !isFollowing
|
|
|
|
return (
|
|
<Button
|
|
size={size}
|
|
color={isFollowing ? 'gray-outline' : useGolden ? 'gold' : 'indigo'}
|
|
className={clsx(
|
|
'my-auto',
|
|
size === 'sm' && 'min-w-[84px]',
|
|
size === 'xs' && 'min-w-[80px]',
|
|
size === '2xs' && 'min-w-[68px]',
|
|
useGolden && 'shadow-[0_0_8px_rgba(234,179,8,0.4)]'
|
|
)}
|
|
onClick={(e) => {
|
|
e.preventDefault()
|
|
track(isFollowing ? 'unfollow' : 'follow')
|
|
toggleFollow()
|
|
}}
|
|
>
|
|
{isFollowing ? 'Following' : 'Follow'}
|
|
</Button>
|
|
)
|
|
}
|