Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add referrals to Resevoir marketplace #638

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion components/ConnectWallet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react'
import { FC, useEffect } from 'react'
import {
useAccount,
useBalance,
Expand All @@ -11,6 +11,7 @@ import {
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import Link from 'next/link'
import { HiOutlineLogout } from 'react-icons/hi'
import { saveAddress } from '@sharemint/sdk'
import FormatNativeCrypto from './FormatNativeCrypto'
import ConnectWalletButton from 'components/ConnectWalletButton'
import useMounted from 'hooks/useMounted'
Expand All @@ -20,6 +21,9 @@ import { truncateAddress, truncateEns } from 'lib/truncateText'
const DARK_MODE = process.env.NEXT_PUBLIC_DARK_MODE
const DISABLE_POWERED_BY_RESERVOIR =
process.env.NEXT_PUBLIC_DISABLE_POWERED_BY_RESERVOIR
const REFERRAL_SIGN_UP_URL =
process.env.NEXT_PUBLIC_REFERRAL_SIGN_UP_URL ||
'https://sharemint.xyz/marketplace/sharer'

const ConnectWallet: FC = () => {
const account = useAccount()
Expand All @@ -30,6 +34,15 @@ const ConnectWallet: FC = () => {
const wallet = connectors[0]
const isMounted = useMounted()

useEffect(() => {
if (account.address && process.env.NEXT_PUBLIC_SHAREMINT_SLUG) {
saveAddress({
slug: process.env.NEXT_PUBLIC_SHAREMINT_SLUG,
address: account.address,
})
}
}, [])

if (!isMounted) {
return null
}
Expand Down Expand Up @@ -73,6 +86,16 @@ const ConnectWallet: FC = () => {
</a>
</DropdownMenu.Item>
</Link>
<DropdownMenu.Item asChild>
<a
href={REFERRAL_SIGN_UP_URL}
target="_blank"
rel="noreferrer"
className="group flex w-full cursor-pointer items-center justify-between rounded px-4 py-3 outline-none transition hover:bg-neutral-100 focus:bg-neutral-100 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800"
>
Refer a friend
</a>
</DropdownMenu.Item>
<DropdownMenu.Item asChild>
<button
key={wallet.id}
Expand Down
Loading