-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathindex.tsx
More file actions
51 lines (44 loc) · 1.35 KB
/
index.tsx
File metadata and controls
51 lines (44 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use client'
import type { Address } from 'viem'
import { useAccount } from 'wagmi'
import { useConnectModal } from '@rainbow-me/rainbowkit'
import {
FollowButton as IdentityFollowButton,
useTransactions,
type InitialFollowingState,
} from '@encrypteddegen/identity-kit'
import { useSounds } from '#/contexts/sounds-context'
import { FOLLOW_BUTTON_SOUND } from '#/lib/constants/follow-button'
interface FollowButtonProps {
address: Address
className?: string
isBlockedBy?: boolean
disabled?: boolean
initialState?: InitialFollowingState
}
const FollowButton: React.FC<FollowButtonProps> = ({
address,
className = '',
isBlockedBy,
initialState,
...props
}) => {
const { openConnectModal } = useConnectModal()
const { address: connectedAddress } = useAccount()
const { selectedVolume } = useSounds()
const { selectedList } = useTransactions()
if (address.toLowerCase() === connectedAddress?.toLowerCase()) return <div className='h-[39px] w-[110px]' />
return (
<IdentityFollowButton
lookupAddress={address}
connectedAddress={connectedAddress}
onDisconnectedClick={openConnectModal}
className={className}
selectedList={selectedList}
initialState={initialState}
sounds={selectedVolume === 'no sounds' ? undefined : FOLLOW_BUTTON_SOUND}
{...props}
/>
)
}
export default FollowButton