Skip to content

Commit 3736094

Browse files
AtatakaiAtatakai
Atatakai
authored and
Atatakai
committed
(registry) feat: review fixes
1 parent 186b21e commit 3736094

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

apps/autonolas-registry/common-util/Details/DetailsSubInfo/RewardsSection.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Address } from 'viem';
66
import { getPendingIncentives, useClaimableIncentives } from 'libs/common-contract-functions/src';
77
import { UNICODE_SYMBOLS } from 'libs/util-constants/src/lib/symbols';
88
import { TOKENOMICS } from 'libs/util-contracts/src';
9-
import { areAddressesEqual, notifyError, notifySuccess } from 'libs/util-functions/src';
9+
import { notifyError, notifySuccess } from 'libs/util-functions/src';
1010

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

1919
type RewardsSectionProps = {
2020
ownerAddress: Address;
21+
isOwner: boolean;
2122
id: string;
2223
type: string;
2324
dataTestId: string;
@@ -64,7 +65,7 @@ const getColumns = (
6465
},
6566
];
6667

67-
export const RewardsSection: FC<RewardsSectionProps> = ({ ownerAddress, id, type, dataTestId }) => {
68+
export const RewardsSection: FC<RewardsSectionProps> = ({ ownerAddress, isOwner, id, type, dataTestId }) => {
6869
const { account } = useHelpers();
6970

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

144145
const canClaim = useMemo(() => {
145-
if (!areAddressesEqual(account.toString(), ownerAddress)) return false;
146+
if (!isOwner) return false;
146147
if (claimableRewardWei === undefined || claimableTopUpWei === undefined) return false;
147148

148149
return claimableRewardWei > 0 || claimableTopUpWei > 0;
149-
}, [account, ownerAddress, claimableRewardWei, claimableTopUpWei]);
150+
}, [isOwner, claimableRewardWei, claimableTopUpWei]);
150151

151152
const handleClaim = useCallback(async () => {
152153
if (!account) return;

apps/autonolas-registry/common-util/Details/DetailsSubInfo/index.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,15 @@ export const DetailsSubInfo = ({
224224
type={type}
225225
ownerAddress={ownerAddress}
226226
dataTestId={dataTestId}
227+
isOwner={isOwner}
227228
/>
228229
) : (
229230
<Info data-testid={dataTestId}>{value}</Info>
230231
))}
231232
</EachSection>
232233
);
233234
}),
234-
[detailsValues, ownerAddress, id, type],
235+
[detailsValues, ownerAddress, isOwner, id, type],
235236
);
236237

237238
// get token address for service

0 commit comments

Comments
 (0)