fix: claim feed button

This commit is contained in:
DIYgod 2024-07-02 21:18:41 +08:00
parent b5f0678960
commit 4d41ab4d83
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View File

@ -5,11 +5,13 @@ import { createElement, useCallback } from "react"
import { FeedClaimModalContent } from "./feed-claim-modal"
export const useFeedClaimModal = ({ feedId }: {
feedId: string
feedId?: string
}) => {
const { present } = useModalStack()
return useCallback(() => {
if (!feedId) return
const feed = getFeedById(feedId)
if (!feed) return

View File

@ -13,6 +13,7 @@ import { from, toNumber } from "dnum"
import type { FC } from "react"
import { useState } from "react"
import { useFeedClaimModal } from "../claim"
import { useSettingModal } from "../settings/modal/hooks-hack"
const DEFAULT_RECOMMENDED_TIP = 1
@ -44,6 +45,10 @@ export const TipModalContent: FC<{
const settingModalPresent = useSettingModal()
const claimFeed = useFeedClaimModal({
feedId,
})
if (transactionsQuery.isPending || myWallet.isPending) {
return (
<div className="center h-32 w-[650px]">
@ -110,7 +115,7 @@ export const TipModalContent: FC<{
<p className="leading-none">
<span className="text-xs text-theme-foreground/80">No one has claimed this feed yet. The received Power will be securely held in the blockchain contract until it is claimed.</span>
</p>
<StyledButton variant="text" className="w-fit p-0">Claim this feed</StyledButton>
<StyledButton variant="text" className="w-fit p-0" onClick={() => claimFeed()}>Claim this feed</StyledButton>
</>
)}
<Divider className="my-2" />