feat: init @crossbell/connect-kit
This commit is contained in:
+9
-1
@@ -22,6 +22,14 @@
|
||||
"@codemirror/language": "6.3.1",
|
||||
"@codemirror/state": "6.1.4",
|
||||
"@codemirror/view": "6.7.0",
|
||||
"@crossbell/connect-kit": "0.0.6",
|
||||
"@crossbell/contract": "0.0.6",
|
||||
"@crossbell/indexer": "0.0.6",
|
||||
"@crossbell/ui": "0.0.6",
|
||||
"@crossbell/util-ethers": "0.0.6",
|
||||
"@crossbell/util-hooks": "0.0.6",
|
||||
"@crossbell/util-ipfs": "0.0.6",
|
||||
"@crossbell/util-metadata": "0.0.6",
|
||||
"@emoji-mart/data": "1.1.1",
|
||||
"@emoji-mart/react": "1.1.1",
|
||||
"@floating-ui/react-dom-interactions": "0.13.3",
|
||||
@@ -30,7 +38,6 @@
|
||||
"@iconify-json/akar-icons": "1.1.12",
|
||||
"@iconify-json/tabler": "1.1.54",
|
||||
"@monaco-editor/react": "4.4.6",
|
||||
"@rainbow-me/rainbowkit": "0.8.1",
|
||||
"@tanstack/react-query": "4.22.0",
|
||||
"@tanstack/react-query-devtools": "4.22.0",
|
||||
"@tanstack/react-query-persist-client": "4.22.0",
|
||||
@@ -46,6 +53,7 @@
|
||||
"ethers": "5.7.2",
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"idb-keyval": "6.2.0",
|
||||
"immer": "9.0.17",
|
||||
"ioredis": "5.2.4",
|
||||
"js-yaml": "4.1.0",
|
||||
"jsonfeed-to-rss": "^3.0.6",
|
||||
|
||||
Generated
+586
-189
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ import { Avatar } from "~/components/ui/Avatar"
|
||||
import { Input } from "~/components/ui/Input"
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useConnectModal } from "@rainbow-me/rainbowkit"
|
||||
import { useConnectModal } from "@crossbell/connect-kit"
|
||||
import { useState, useEffect } from "react"
|
||||
import { useCommentPage } from "~/queries/page"
|
||||
import { useRouter } from "next/router"
|
||||
@@ -20,7 +20,7 @@ export const CommentInput: React.FC<{
|
||||
}> = ({ pageId, originalId }) => {
|
||||
const { address } = useAccount()
|
||||
const userSites = useGetUserSites(address)
|
||||
const { openConnectModal } = useConnectModal()
|
||||
const { show: openConnectModal } = useConnectModal()
|
||||
const commentPage = useCommentPage()
|
||||
const router = useRouter()
|
||||
const [viewer, setViewer] = useState<Profile | null>(null)
|
||||
|
||||
@@ -1,45 +1,46 @@
|
||||
import { ConnectButton as RainbowConnectButton } from "@rainbow-me/rainbowkit"
|
||||
import {
|
||||
useConnectModal,
|
||||
useAccountState,
|
||||
useDisconnectModal,
|
||||
useAccountBalance,
|
||||
GeneralAccount,
|
||||
} from "@crossbell/connect-kit"
|
||||
import { useGetUserSites } from "~/queries/site"
|
||||
import { useAccount, useDisconnect, useBalance } from "wagmi"
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import type { HeaderLinkType } from "~/components/site/SiteHeader"
|
||||
import { DashboardIcon } from "../icons/DashboardIcon"
|
||||
import { UniLink } from "../ui/UniLink"
|
||||
import { useEffect, useState } from "react"
|
||||
import { useEffect, useState, useMemo } from "react"
|
||||
import {
|
||||
Square2StackIcon,
|
||||
ArrowRightOnRectangleIcon,
|
||||
} from "@heroicons/react/24/outline"
|
||||
import { BigNumber } from "ethers"
|
||||
import { SITE_URL } from "~/lib/env"
|
||||
import { useRefCallback } from "@crossbell/util-hooks"
|
||||
|
||||
export const ConnectButton: React.FC<{
|
||||
left?: boolean
|
||||
variant?: "text" | "primary" | "secondary" | "like" | "collect" | "crossbell"
|
||||
}> = ({ left, variant }) => {
|
||||
const { address } = useAccount()
|
||||
const userSites = useGetUserSites(address)
|
||||
const { disconnect } = useDisconnect()
|
||||
const [ssrReady, account] = useAccountState(({ ssrReady, computed }) => [
|
||||
ssrReady,
|
||||
computed.account,
|
||||
])
|
||||
|
||||
const [copyLabel, setCopyLabel] = useState("")
|
||||
useEffect(() => {
|
||||
if (address) {
|
||||
setCopyLabel(address?.slice(0, 5) + "..." + address?.slice(-4))
|
||||
}
|
||||
}, [address])
|
||||
const { show: openConnectModal } = useConnectModal()
|
||||
const { show: disconnect } = useDisconnectModal()
|
||||
const { balance } = useAccountBalance()
|
||||
const [copyLabelDisplay, copyLabel] = useCopyLabel(account)
|
||||
|
||||
const userSites = useGetUserSites(account?.address)
|
||||
|
||||
const dropdownLinks: HeaderLinkType[] = [
|
||||
{
|
||||
icon: <Square2StackIcon className="w-4 h-4" />,
|
||||
label: copyLabel,
|
||||
onClick() {
|
||||
navigator.clipboard.writeText(address || "")
|
||||
setCopyLabel("Copied!")
|
||||
setTimeout(() => {
|
||||
setCopyLabel(address?.slice(0, 5) + "..." + address?.slice(-4))
|
||||
}, 1000)
|
||||
},
|
||||
label: copyLabelDisplay,
|
||||
onClick: copyLabel,
|
||||
},
|
||||
{
|
||||
icon: <DashboardIcon />,
|
||||
@@ -49,20 +50,14 @@ export const ConnectButton: React.FC<{
|
||||
{
|
||||
icon: <ArrowRightOnRectangleIcon className="w-4 h-4" />,
|
||||
label: "Disconnect",
|
||||
onClick() {
|
||||
disconnect()
|
||||
},
|
||||
onClick: disconnect,
|
||||
},
|
||||
]
|
||||
|
||||
const { data: balance } = useBalance({
|
||||
address: address,
|
||||
})
|
||||
|
||||
const [InsufficientBalance, setInsufficientBalance] = useState<boolean>(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (balance !== undefined) {
|
||||
if (balance) {
|
||||
if (
|
||||
BigNumber.from(balance.value).gt(
|
||||
BigNumber.from("1" + "0".repeat(balance.decimals - 2)),
|
||||
@@ -76,123 +71,129 @@ export const ConnectButton: React.FC<{
|
||||
}, [balance])
|
||||
|
||||
return (
|
||||
<RainbowConnectButton.Custom>
|
||||
{({
|
||||
account,
|
||||
chain,
|
||||
openAccountModal,
|
||||
openChainModal,
|
||||
openConnectModal,
|
||||
mounted,
|
||||
}) => {
|
||||
<div
|
||||
{...(!ssrReady && {
|
||||
"aria-hidden": true,
|
||||
style: {
|
||||
opacity: 0,
|
||||
pointerEvents: "none",
|
||||
userSelect: "none",
|
||||
},
|
||||
})}
|
||||
>
|
||||
{(() => {
|
||||
if (!account) {
|
||||
return (
|
||||
<Button
|
||||
className="text-accent"
|
||||
onClick={openConnectModal}
|
||||
style={{ height: "30px" }}
|
||||
variant={variant || "primary"}
|
||||
>
|
||||
Connect
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div
|
||||
{...(!mounted && {
|
||||
"aria-hidden": true,
|
||||
style: {
|
||||
opacity: 0,
|
||||
pointerEvents: "none",
|
||||
userSelect: "none",
|
||||
},
|
||||
})}
|
||||
>
|
||||
{(() => {
|
||||
if (!mounted || !account || !chain) {
|
||||
return (
|
||||
<Button
|
||||
className="text-accent"
|
||||
onClick={openConnectModal}
|
||||
style={{ height: "30px" }}
|
||||
variant={variant || "primary"}
|
||||
>
|
||||
Connect
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div
|
||||
className="relative group"
|
||||
style={{ gap: 12, height: "30px" }}
|
||||
<div className="relative group" style={{ gap: 12, height: "30px" }}>
|
||||
{userSites.isSuccess ? (
|
||||
<>
|
||||
<button
|
||||
className="flex items-center w-full"
|
||||
type="button"
|
||||
aria-label="connector"
|
||||
>
|
||||
{userSites.isSuccess ? (
|
||||
<>
|
||||
<button
|
||||
className="flex items-center w-full"
|
||||
type="button"
|
||||
aria-label="connector"
|
||||
<Avatar
|
||||
className="align-middle mr-2"
|
||||
images={userSites.data?.[0]?.avatars || []}
|
||||
name={userSites.data?.[0]?.name}
|
||||
size={30}
|
||||
/>
|
||||
<div className="flex-1 flex flex-col min-w-0">
|
||||
<span
|
||||
className={`text-left leading-none font-medium truncate ${
|
||||
InsufficientBalance ? "text-red-600" : "text-gray-600"
|
||||
}`}
|
||||
style={{ marginBottom: "0.15rem" }}
|
||||
>
|
||||
{userSites.data?.[0]?.name ||
|
||||
getAccountDisplayName(account)}
|
||||
</span>
|
||||
{userSites.data?.[0]?.username && (
|
||||
<span
|
||||
className={`text-left leading-none text-xs truncate ${
|
||||
InsufficientBalance ? "text-red-400" : "text-gray-400"
|
||||
}`}
|
||||
>
|
||||
<Avatar
|
||||
className="align-middle mr-2"
|
||||
images={userSites.data?.[0]?.avatars || []}
|
||||
name={userSites.data?.[0]?.name}
|
||||
size={30}
|
||||
/>
|
||||
<div className="flex-1 flex flex-col min-w-0">
|
||||
<span
|
||||
className={`text-left leading-none font-medium truncate ${
|
||||
InsufficientBalance
|
||||
? "text-red-600"
|
||||
: "text-gray-600"
|
||||
}`}
|
||||
style={{ marginBottom: "0.15rem" }}
|
||||
>
|
||||
{userSites.data?.[0]?.name || account.displayName}
|
||||
</span>
|
||||
{userSites.data?.[0]?.username && (
|
||||
<span
|
||||
className={`text-left leading-none text-xs truncate ${
|
||||
InsufficientBalance
|
||||
? "text-red-400"
|
||||
: "text-gray-400"
|
||||
}`}
|
||||
>
|
||||
{"@" + userSites.data?.[0]?.username ||
|
||||
account.displayName}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
className={`absolute hidden ${
|
||||
left ? "left" : "right"
|
||||
}-0 pt-2 group-hover:block top-full z-10 text-gray-600`}
|
||||
{"@" + userSites.data?.[0]?.username ||
|
||||
getAccountDisplayName(account)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
className={`absolute hidden ${
|
||||
left ? "left" : "right"
|
||||
}-0 pt-2 group-hover:block top-full z-10 text-gray-600`}
|
||||
>
|
||||
<div className="bg-white rounded-lg ring-1 ring-zinc-100 min-w-[140px] shadow-md py-2 text-sm">
|
||||
{InsufficientBalance && (
|
||||
<UniLink
|
||||
href="https://faucet.crossbell.io/"
|
||||
className="text-red-600 px-4 h-8 flex items-center w-full whitespace-nowrap hover:bg-zinc-100"
|
||||
>
|
||||
<div className="bg-white rounded-lg ring-1 ring-zinc-100 min-w-[140px] shadow-md py-2 text-sm">
|
||||
{InsufficientBalance && (
|
||||
<UniLink
|
||||
href="https://faucet.crossbell.io/"
|
||||
className="text-red-600 px-4 h-8 flex items-center w-full whitespace-nowrap hover:bg-zinc-100"
|
||||
>
|
||||
<span className="mr-2 fill-red-600 i-bxs:bell"></span>
|
||||
Insufficient $CSB balance ({balance?.formatted})
|
||||
</UniLink>
|
||||
)}
|
||||
{dropdownLinks.map((link, i) => {
|
||||
return (
|
||||
<UniLink
|
||||
key={i}
|
||||
href={link.url}
|
||||
onClick={link.onClick}
|
||||
className="px-4 h-8 flex items-center w-full whitespace-nowrap hover:bg-zinc-100"
|
||||
aria-label={link.label}
|
||||
>
|
||||
<span className="mr-2">{link.icon}</span>
|
||||
{link.label}
|
||||
</UniLink>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
<span className="mr-2 fill-red-600 i-bxs:bell"></span>
|
||||
Insufficient $CSB balance ({balance?.formatted})
|
||||
</UniLink>
|
||||
)}
|
||||
{dropdownLinks.map((link, i) => {
|
||||
return (
|
||||
<UniLink
|
||||
key={i}
|
||||
href={link.url}
|
||||
onClick={link.onClick}
|
||||
className="px-4 h-8 flex items-center w-full whitespace-nowrap hover:bg-zinc-100"
|
||||
aria-label={link.label}
|
||||
>
|
||||
<span className="mr-2">{link.icon}</span>
|
||||
{link.label}
|
||||
</UniLink>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})()}
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
</RainbowConnectButton.Custom>
|
||||
})()}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function useCopyLabel(account: GeneralAccount | null) {
|
||||
const [isShowCopied, setIsShowCopied] = useState(false)
|
||||
|
||||
const copyLabel = useRefCallback(() => {
|
||||
const value =
|
||||
(account?.type === "email" ? account.email : account?.address) || ""
|
||||
|
||||
navigator.clipboard.writeText(value)
|
||||
setIsShowCopied(true)
|
||||
setTimeout(() => setIsShowCopied(false), 1000)
|
||||
})
|
||||
|
||||
return [
|
||||
isShowCopied ? "Copied!" : getAccountDisplayName(account),
|
||||
copyLabel,
|
||||
] as const
|
||||
}
|
||||
|
||||
function getAccountDisplayName(account: GeneralAccount | null) {
|
||||
const value =
|
||||
(account?.type === "email" ? account.email : account?.address) || ""
|
||||
|
||||
return value.slice(0, 5) + "..." + value.slice(-4)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
useUnsubscribeFromSite,
|
||||
useGetUserSites,
|
||||
} from "~/queries/site"
|
||||
import { useConnectModal } from "@rainbow-me/rainbowkit"
|
||||
import { useConnectModal } from "@crossbell/connect-kit"
|
||||
import clsx from "clsx"
|
||||
|
||||
export const FollowingButton: React.FC<{
|
||||
@@ -24,7 +24,7 @@ export const FollowingButton: React.FC<{
|
||||
const { address } = useAccount()
|
||||
const subscribeToSite = useSubscribeToSite()
|
||||
const unsubscribeFromSite = useUnsubscribeFromSite()
|
||||
const { openConnectModal } = useConnectModal()
|
||||
const { show: openConnectModal } = useConnectModal()
|
||||
const [followProgress, setFollowProgress] = useState<boolean>(false)
|
||||
const userSite = useGetUserSites(address)
|
||||
const router = useRouter()
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "~/queries/page"
|
||||
import { useGetUserSites } from "~/queries/site"
|
||||
import { useAccount } from "wagmi"
|
||||
import { useConnectModal } from "@rainbow-me/rainbowkit"
|
||||
import { useConnectModal } from "@crossbell/connect-kit"
|
||||
import { useState, useEffect } from "react"
|
||||
import { Button } from "../ui/Button"
|
||||
import { useRouter } from "next/router"
|
||||
@@ -33,7 +33,7 @@ export const Reactions: React.FC<{
|
||||
const mintPage = useMintPage()
|
||||
|
||||
const { address } = useAccount()
|
||||
const { openConnectModal } = useConnectModal()
|
||||
const { show: openConnectModal } = useConnectModal()
|
||||
const [likeProgress, setLikeProgress] = useState(false)
|
||||
const [mintProgress, setMintProgress] = useState(false)
|
||||
const userSite = useGetUserSites(address)
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { configureChains } from "wagmi"
|
||||
import { jsonRpcProvider } from "wagmi/providers/jsonRpc"
|
||||
import { MetaMaskConnector } from "wagmi/connectors/metaMask"
|
||||
import { WalletConnectConnector } from "wagmi/connectors/walletConnect"
|
||||
import { CoinbaseWalletConnector } from "wagmi/connectors/coinbaseWallet"
|
||||
import { InjectedConnector } from "wagmi/connectors/injected"
|
||||
|
||||
import { CSB_SCAN, IPFS_GATEWAY, APP_NAME } from "~/lib/env"
|
||||
|
||||
export const { chains, provider } = configureChains(
|
||||
[
|
||||
{
|
||||
id: 3737,
|
||||
name: "Crossbell",
|
||||
network: "crossbell",
|
||||
rpcUrls: {
|
||||
default: "https://rpc.crossbell.io",
|
||||
},
|
||||
iconUrl: `${IPFS_GATEWAY}QmS8zEetTb6pwdNpVjv5bz55BXiSMGP9BjTJmNcjcUT91t`,
|
||||
nativeCurrency: {
|
||||
decimals: 18,
|
||||
name: "Crossbell Token",
|
||||
symbol: "CSB",
|
||||
},
|
||||
blockExplorers: {
|
||||
default: {
|
||||
name: "Crossbell Explorer",
|
||||
url: CSB_SCAN,
|
||||
},
|
||||
},
|
||||
testnet: false,
|
||||
} as any,
|
||||
],
|
||||
[jsonRpcProvider({ rpc: (chain) => ({ http: chain.rpcUrls.default }) })],
|
||||
{
|
||||
pollingInterval: 1000,
|
||||
},
|
||||
)
|
||||
|
||||
export const connectors = [
|
||||
new InjectedConnector({
|
||||
chains,
|
||||
options: {
|
||||
shimDisconnect: true,
|
||||
name: (detectedName) =>
|
||||
`Injected (${
|
||||
typeof detectedName === "string"
|
||||
? detectedName
|
||||
: detectedName.join(", ")
|
||||
})`,
|
||||
},
|
||||
}),
|
||||
new MetaMaskConnector({
|
||||
chains,
|
||||
options: {
|
||||
shimDisconnect: true,
|
||||
shimChainChangedDisconnect: false,
|
||||
UNSTABLE_shimOnConnectSelectAccount: true,
|
||||
},
|
||||
}),
|
||||
new CoinbaseWalletConnector({
|
||||
chains,
|
||||
options: {
|
||||
appName: APP_NAME,
|
||||
headlessMode: true,
|
||||
},
|
||||
}),
|
||||
new WalletConnectConnector({
|
||||
chains,
|
||||
options: {
|
||||
qrcode: false,
|
||||
},
|
||||
}),
|
||||
]
|
||||
+50
-74
@@ -1,70 +1,24 @@
|
||||
import { Toaster } from "react-hot-toast"
|
||||
import "~/css/main.css"
|
||||
import "~/generated/uno.css"
|
||||
import { configureChains, createClient, WagmiConfig } from "wagmi"
|
||||
import { jsonRpcProvider } from "wagmi/providers/jsonRpc"
|
||||
|
||||
import { Toaster } from "react-hot-toast"
|
||||
import { createClient, WagmiConfig } from "wagmi"
|
||||
import { Hydrate, QueryClient } from "@tanstack/react-query"
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client"
|
||||
import { createIDBPersister } from "~/lib/persister.client"
|
||||
import {
|
||||
RainbowKitProvider,
|
||||
connectorsForWallets,
|
||||
} from "@rainbow-me/rainbowkit"
|
||||
import {
|
||||
injectedWallet,
|
||||
metaMaskWallet,
|
||||
coinbaseWallet,
|
||||
walletConnectWallet,
|
||||
braveWallet,
|
||||
} from "@rainbow-me/rainbowkit/wallets"
|
||||
import { APP_NAME, CSB_SCAN, IPFS_GATEWAY } from "~/lib/env"
|
||||
ConnectKitProvider,
|
||||
useAccountState,
|
||||
useConnectModal,
|
||||
useUpgradeAccountModal,
|
||||
} from "@crossbell/connect-kit"
|
||||
import { InitContractProvider } from "@crossbell/contract"
|
||||
import { useRefCallback } from "@crossbell/util-hooks"
|
||||
import NextNProgress from "nextjs-progressbar"
|
||||
|
||||
import "@rainbow-me/rainbowkit/styles.css"
|
||||
|
||||
const { chains, provider } = configureChains(
|
||||
[
|
||||
{
|
||||
id: 3737,
|
||||
name: "Crossbell",
|
||||
network: "crossbell",
|
||||
rpcUrls: {
|
||||
default: "https://rpc.crossbell.io",
|
||||
},
|
||||
iconUrl: `${IPFS_GATEWAY}QmS8zEetTb6pwdNpVjv5bz55BXiSMGP9BjTJmNcjcUT91t`,
|
||||
nativeCurrency: {
|
||||
decimals: 18,
|
||||
name: "Crossbell Token",
|
||||
symbol: "CSB",
|
||||
},
|
||||
blockExplorers: {
|
||||
default: {
|
||||
name: "Crossbell Explorer",
|
||||
url: CSB_SCAN,
|
||||
},
|
||||
},
|
||||
testnet: false,
|
||||
} as any,
|
||||
],
|
||||
[jsonRpcProvider({ rpc: (chain) => ({ http: chain.rpcUrls.default }) })],
|
||||
{
|
||||
pollingInterval: 1000,
|
||||
},
|
||||
)
|
||||
|
||||
const connectors = connectorsForWallets([
|
||||
{
|
||||
groupName: "Recommended",
|
||||
wallets: [
|
||||
metaMaskWallet({ chains }),
|
||||
walletConnectWallet({ chains }),
|
||||
braveWallet({ chains, shimDisconnect: true }),
|
||||
coinbaseWallet({ appName: APP_NAME, chains }),
|
||||
injectedWallet({ chains, shimDisconnect: true }),
|
||||
],
|
||||
},
|
||||
])
|
||||
import { toGateway } from "~/lib/ipfs-parser"
|
||||
import { connectors, provider } from "~/lib/wallet-config"
|
||||
import { createIDBPersister } from "~/lib/persister.client"
|
||||
|
||||
const wagmiClient = createClient({
|
||||
autoConnect: true,
|
||||
@@ -96,24 +50,46 @@ try {
|
||||
|
||||
function MyApp({ Component, pageProps }: any) {
|
||||
const getLayout = Component.getLayout ?? ((page: any) => page)
|
||||
const connectModal = useConnectModal()
|
||||
const upgradeAccountModal = useUpgradeAccountModal()
|
||||
const [isEmailConnected, characterId] = useAccountState((s) => [
|
||||
!!s.email,
|
||||
s.computed.account?.characterId,
|
||||
])
|
||||
const getCurrentCharacterId = useRefCallback(() => characterId ?? null)
|
||||
|
||||
return (
|
||||
<WagmiConfig client={wagmiClient}>
|
||||
<RainbowKitProvider chains={chains}>
|
||||
<PersistQueryClientProvider
|
||||
client={queryClient}
|
||||
persistOptions={{ persister }}
|
||||
>
|
||||
<Hydrate state={pageProps.dehydratedState}>
|
||||
<ReactQueryDevtools />
|
||||
<NextNProgress
|
||||
options={{ easing: "linear", speed: 500, trickleSpeed: 100 }}
|
||||
/>
|
||||
{getLayout(<Component {...pageProps} />)}
|
||||
<Toaster />
|
||||
</Hydrate>
|
||||
</PersistQueryClientProvider>
|
||||
</RainbowKitProvider>
|
||||
<PersistQueryClientProvider
|
||||
client={queryClient}
|
||||
persistOptions={{ persister }}
|
||||
>
|
||||
<ConnectKitProvider ipfsLinkToHttpLink={toGateway}>
|
||||
<InitContractProvider
|
||||
openFaucetHintModel={() => {
|
||||
console.log("openFaucetHintModel")
|
||||
// FIXME: - openFaucetHintModel
|
||||
}}
|
||||
openMintNewCharacterModel={() => {
|
||||
console.log("openMintNewCharacterModel")
|
||||
// FIXME: - openMintNewCharacterModel
|
||||
}}
|
||||
openConnectModal={
|
||||
isEmailConnected ? upgradeAccountModal.show : connectModal.show
|
||||
}
|
||||
getCurrentCharacterId={getCurrentCharacterId}
|
||||
>
|
||||
<Hydrate state={pageProps.dehydratedState}>
|
||||
<ReactQueryDevtools />
|
||||
<NextNProgress
|
||||
options={{ easing: "linear", speed: 500, trickleSpeed: 100 }}
|
||||
/>
|
||||
{getLayout(<Component {...pageProps} />)}
|
||||
<Toaster />
|
||||
</Hydrate>
|
||||
</InitContractProvider>
|
||||
</ConnectKitProvider>
|
||||
</PersistQueryClientProvider>
|
||||
</WagmiConfig>
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import { LoveIcon } from "~/components/icons/LoveIcon"
|
||||
import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { LaughIcon } from "~/components/icons/LaughIcon"
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { useConnectModal } from "@rainbow-me/rainbowkit"
|
||||
import { useConnectModal } from "@crossbell/connect-kit"
|
||||
import { useRouter } from "next/router"
|
||||
import { GITHUB_LINK, APP_NAME, CSB_SCAN } from "~/lib/env"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
@@ -39,7 +39,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
export default function Home({ region }: { region: string | null }) {
|
||||
const [addressIn, setAddressIn] = useState<string>("")
|
||||
const { address } = useAccount()
|
||||
const { openConnectModal } = useConnectModal()
|
||||
const { show: openConnectModal } = useConnectModal()
|
||||
const router = useRouter()
|
||||
const showcaseSites = useGetSites(showcase)
|
||||
|
||||
|
||||
+2
-1
@@ -4,9 +4,10 @@ import {
|
||||
useQueryClient,
|
||||
useInfiniteQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { useContract } from "@crossbell/contract"
|
||||
|
||||
import * as pageModel from "~/models/page.model"
|
||||
import { useUnidata } from "./unidata"
|
||||
import { useContract } from "./crossbell"
|
||||
|
||||
export const useGetPagesBySiteLite = (
|
||||
input: Parameters<typeof pageModel.getPagesBySite>[0],
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"
|
||||
import { useContract } from "@crossbell/contract"
|
||||
|
||||
import * as siteModel from "~/models/site.model"
|
||||
import { useUnidata } from "./unidata"
|
||||
import { useContract } from "./crossbell"
|
||||
|
||||
export const useGetUserSites = (address?: string) => {
|
||||
const unidata = useUnidata()
|
||||
|
||||
Reference in New Issue
Block a user