Skip to content

Commit

Permalink
(registry) feat: review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Atatakai authored and Atatakai committed Aug 20, 2024
1 parent 186b21e commit 3736094
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Address } from 'viem';
import { getPendingIncentives, useClaimableIncentives } from 'libs/common-contract-functions/src';
import { UNICODE_SYMBOLS } from 'libs/util-constants/src/lib/symbols';
import { TOKENOMICS } from 'libs/util-contracts/src';
import { areAddressesEqual, notifyError, notifySuccess } from 'libs/util-functions/src';
import { notifyError, notifySuccess } from 'libs/util-functions/src';

import { getEthersProviderForEthereum, getTokenomicsEthersContract } from 'common-util/Contracts';
import { claimOwnerIncentivesRequest } from 'common-util/functions/requests';
Expand All @@ -18,6 +18,7 @@ const { Text } = Typography;

type RewardsSectionProps = {
ownerAddress: Address;
isOwner: boolean;
id: string;
type: string;
dataTestId: string;
Expand Down Expand Up @@ -64,7 +65,7 @@ const getColumns = (
},
];

export const RewardsSection: FC<RewardsSectionProps> = ({ ownerAddress, id, type, dataTestId }) => {
export const RewardsSection: FC<RewardsSectionProps> = ({ ownerAddress, isOwner, id, type, dataTestId }) => {
const { account } = useHelpers();

const [isClaimLoading, setIsClaimLoading] = useState(false);
Expand Down Expand Up @@ -142,11 +143,11 @@ export const RewardsSection: FC<RewardsSectionProps> = ({ ownerAddress, id, type
]);

const canClaim = useMemo(() => {
if (!areAddressesEqual(account.toString(), ownerAddress)) return false;
if (!isOwner) return false;
if (claimableRewardWei === undefined || claimableTopUpWei === undefined) return false;

return claimableRewardWei > 0 || claimableTopUpWei > 0;
}, [account, ownerAddress, claimableRewardWei, claimableTopUpWei]);
}, [isOwner, claimableRewardWei, claimableTopUpWei]);

const handleClaim = useCallback(async () => {
if (!account) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,15 @@ export const DetailsSubInfo = ({
type={type}
ownerAddress={ownerAddress}
dataTestId={dataTestId}
isOwner={isOwner}
/>
) : (
<Info data-testid={dataTestId}>{value}</Info>
))}
</EachSection>
);
}),
[detailsValues, ownerAddress, id, type],
[detailsValues, ownerAddress, isOwner, id, type],
);

// get token address for service
Expand Down

0 comments on commit 3736094

Please sign in to comment.