-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: consolidate pay disabled logic (#4170)
- Loading branch information
Showing
9 changed files
with
164 additions
and
135 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/components/v2v3/V2V3Project/ProjectDashboard/components/BlockedProjectBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 24 additions & 10 deletions
34
...ponents/v2v3/V2V3Project/ProjectDashboard/components/Cart/components/SummaryPayButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,33 @@ | ||
import { Trans } from '@lingui/macro' | ||
import { Button } from 'antd' | ||
import { Button, Tooltip } from 'antd' | ||
import { usePayProjectDisabled } from 'hooks/v2v3/usePayProjectDisabled' | ||
import { useCartSummary } from '../hooks/useCartSummary' | ||
|
||
export const SummaryPayButton = ({ className }: { className?: string }) => { | ||
const { payProject, walletConnected } = useCartSummary() | ||
const { | ||
payDisabled, | ||
message, | ||
loading: payDisabledLoading, | ||
} = usePayProjectDisabled() | ||
|
||
return ( | ||
<Button className={className} type="primary" onClick={payProject}> | ||
<span> | ||
{walletConnected ? ( | ||
<Trans>Pay project</Trans> | ||
) : ( | ||
<Trans>Connect wallet</Trans> | ||
)} | ||
</span> | ||
</Button> | ||
<Tooltip open={payDisabled ? undefined : false} title={message}> | ||
<Button | ||
disabled={payDisabled} | ||
loading={payDisabledLoading} | ||
className={className} | ||
type="primary" | ||
onClick={payProject} | ||
> | ||
<span> | ||
{walletConnected ? ( | ||
<Trans>Pay project</Trans> | ||
) : ( | ||
<Trans>Connect wallet to pay</Trans> | ||
)} | ||
</span> | ||
</Button> | ||
</Tooltip> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
80a92b4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
juice-interface – ./
juice-interface-peel.vercel.app
juice-interface-mainnet.vercel.app
juice-interface-git-main-peel.vercel.app
www.juicebox.money
juicebox.money
80a92b4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
juice-interface-goerli – ./
juice-interface-goerli.vercel.app
juice-interface-goerli-peel.vercel.app
juice-interface-goerli-git-main-peel.vercel.app
goerli.juicebox.money