diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 077cc90..4119316 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,8 @@ jobs: - name: Check out code uses: actions/checkout@v3 - name: Install dependencies - run: npm ci + run: yarn install --frozen-lockfile - name: Build - run: npm run build + run: yarn build - name: Lint - run: npm run lint + run: yarn lint diff --git a/components/ClaimButton.tsx b/components/ClaimButton.tsx new file mode 100644 index 0000000..750bfbe --- /dev/null +++ b/components/ClaimButton.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import DefaultButton, { DefaultButtonProps } from './common/DefaultButton'; + +export interface ClaimButtonProps extends DefaultButtonProps { + allowance: number; + walletAlreadyClaimed: number; +} + +const ClaimButton = ({ allowance, walletAlreadyClaimed, disabled, ...rest }: ClaimButtonProps) => { + const getClaimButtonText = () => { + if (walletAlreadyClaimed === 0 && allowance === 0) { + return 'CLAIM PLOTS'; + } else if (walletAlreadyClaimed > 0) { + return `${walletAlreadyClaimed} PLOTS CLAIMED`; + } else if (allowance > 0) { + return `CLAIM ${allowance} PLOTS`; + } + return ''; + }; + + return ( + + {getClaimButtonText()} + + ); +}; +export default ClaimButton; diff --git a/components/ClaimModal/ClaimModal.tsx b/components/ClaimModal/ClaimModal.tsx index c1ab5b9..926f089 100644 --- a/components/ClaimModal/ClaimModal.tsx +++ b/components/ClaimModal/ClaimModal.tsx @@ -4,7 +4,7 @@ import { FC, useState } from 'react'; import Modal from 'react-modal'; import { useModal } from '../../hooks/useModal'; -import { AGREEMENT_IPFS_URL } from '../../contants'; +import { AGREEMENT_IPFS_URL } from '../../constants/other'; type ClaimModalProps = { eligibleNftsCount: number; diff --git a/components/ParcelProperty/ParcelProperty.tsx b/components/ParcelProperty/ParcelProperty.tsx index 354921a..10cf202 100644 --- a/components/ParcelProperty/ParcelProperty.tsx +++ b/components/ParcelProperty/ParcelProperty.tsx @@ -3,7 +3,7 @@ import { FC } from 'react'; export type ParcelPropertyProps = { name: string; value: string; - tooltip: string; + tooltip?: string; iconPath: string; }; export const ParcelProperty: FC = ({ name, value, tooltip, iconPath }) => ( diff --git a/components/common/DefaultButton.tsx b/components/common/DefaultButton.tsx new file mode 100644 index 0000000..4efe67d --- /dev/null +++ b/components/common/DefaultButton.tsx @@ -0,0 +1,8 @@ +import React from 'react'; + +export interface DefaultButtonProps extends React.ButtonHTMLAttributes {} + +const DefaultButton = ({ disabled, ...rest }: DefaultButtonProps) => ( +