Skip to content

Commit 0eb43a5

Browse files
authored
feat: claim (#2702)
1 parent 342d1fc commit 0eb43a5

File tree

9 files changed

+122
-51
lines changed

9 files changed

+122
-51
lines changed

src/components/incentives/IncentivesButton.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ export const MeritIncentivesButton = (params: {
146146

147147
return (
148148
<ContentWithTooltip
149-
tooltipContent={<MeritIncentivesTooltipContent meritIncentives={meritIncentives} />}
149+
tooltipContent={
150+
<MeritIncentivesTooltipContent
151+
meritIncentives={meritIncentives}
152+
onClose={() => setOpen(false)}
153+
/>
154+
}
150155
withoutHover
151156
setOpen={setOpen}
152157
open={open}

src/components/incentives/MeritIncentivesTooltipContent.tsx

Lines changed: 82 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import {
66
MeritAction,
77
MeritIncentivesBreakdown,
88
} from 'src/hooks/useMeritIncentives';
9+
import { useModalContext } from 'src/hooks/useModal';
910

1011
import { FormattedNumber } from '../primitives/FormattedNumber';
11-
import { Link } from '../primitives/Link';
12+
import { Link, ROUTES } from '../primitives/Link';
1213
import { Row } from '../primitives/Row';
1314
import { TokenIcon } from '../primitives/TokenIcon';
1415
import { getSymbolMap } from './IncentivesTooltipContent';
@@ -99,16 +100,24 @@ const getCampaignConfig = (action: MeritAction): CampaignConfig => {
99100

100101
export const MeritIncentivesTooltipContent = ({
101102
meritIncentives,
103+
onClose,
102104
}: {
103105
meritIncentives: ExtendedReserveIncentiveResponse & {
104106
breakdown?: MeritIncentivesBreakdown;
105107
variants?: { selfAPY: number | null };
106108
activeActions: MeritAction[];
107109
actionMessages: Record<string, { customMessage?: string; customForumLink?: string }>;
108110
};
111+
onClose?: () => void;
109112
}) => {
110113
const theme = useTheme();
114+
const { openClaimRewards } = useModalContext();
111115
const typographyVariant = 'secondary12';
116+
117+
const handleClaimClick = () => {
118+
openClaimRewards();
119+
if (onClose) onClose();
120+
};
112121
const meritIncentivesFormatted = getSymbolMap(meritIncentives);
113122
const isCombinedMeritIncentives: boolean = meritIncentives.activeActions.length > 1;
114123
const campaignConfig = getCampaignConfig(meritIncentives.action);
@@ -212,35 +221,81 @@ export const MeritIncentivesTooltipContent = ({
212221
</Typography>
213222
) : null}
214223

215-
<Typography variant="caption" color="text.primary" fontSize={13} fontWeight={'600'}>
224+
<Typography
225+
variant="caption"
226+
color="text.primary"
227+
fontSize={13}
228+
fontWeight={'600'}
229+
sx={{ display: 'inline' }}
230+
>
216231
{campaignConfig.type === CampaignType.SELF_VERIFICATION && selfConfig ? (
217-
<Trans>Merit Program and Self rewards are claimed through the</Trans>
232+
<>
233+
<Trans>Merit Program and Self rewards can be claimed </Trans>
234+
<Typography
235+
component="span"
236+
onClick={handleClaimClick}
237+
sx={{
238+
textDecoration: 'underline',
239+
cursor: 'pointer',
240+
fontSize: '13px !important',
241+
fontWeight: 'bold',
242+
mx: 0.5,
243+
}}
244+
variant="caption"
245+
color="primary"
246+
>
247+
<Trans>here</Trans>
248+
</Typography>
249+
<Trans> or from the </Trans>
250+
<Link
251+
href={`${ROUTES.dashboard}`}
252+
sx={{
253+
textDecoration: 'underline',
254+
fontWeight: 'bold',
255+
cursor: 'pointer',
256+
fontSize: '13px !important',
257+
mx: 0.5,
258+
}}
259+
variant="caption"
260+
>
261+
<Trans>dashboard</Trans>
262+
</Link>
263+
.
264+
</>
218265
) : (
219-
<Trans>Merit Program rewards are claimed through the</Trans>
266+
<>
267+
<Trans>Merit Program rewards can be claimed </Trans>
268+
<Typography
269+
component="span"
270+
onClick={handleClaimClick}
271+
sx={{
272+
textDecoration: 'underline',
273+
cursor: 'pointer',
274+
fontSize: '13px !important',
275+
fontWeight: 'bold',
276+
mx: 0.5,
277+
}}
278+
variant="caption"
279+
color="primary"
280+
>
281+
<Trans>here</Trans>
282+
</Typography>
283+
<Trans> or from the </Trans>
284+
<Link
285+
href={`${ROUTES.dashboard}`}
286+
sx={{
287+
textDecoration: 'underline',
288+
fontWeight: 'bold !important',
289+
cursor: 'pointer',
290+
fontSize: '13px !important',
291+
mx: 0.5,
292+
}}
293+
variant="caption"
294+
>
295+
<Trans>dashboard</Trans>
296+
</Link>
297+
</>
220298
)}
221-
222-
<Link
223-
href={`https://apps.aavechan.com/merit/${meritIncentives.action}`}
224-
sx={{ textDecoration: 'underline', ml: 1 }}
225-
variant="caption"
226-
>
227-
<span
228-
style={{
229-
fontSize: '13px',
230-
fontWeight: '600',
231-
}}
232-
>
233-
{'Aave Chan Initiative interface'}
234-
</span>
235-
</Link>
236-
<span
237-
style={{
238-
fontSize: '13px',
239-
fontWeight: '600',
240-
}}
241-
>
242-
{'.'}
243-
</span>
244299
</Typography>
245300
<Box sx={{ width: '100%' }}>
246301
<Box>

src/components/transactions/ClaimRewards/ClaimRewardsModalContent.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export const ClaimRewardsModalContent = ({ user, reserves }: ClaimRewardsModalCo
245245
const handleBlocked = () => {
246246
switch (blockingError) {
247247
case ErrorType.NOT_ENOUGH_BALANCE:
248-
return <Trans>Your reward balance is 0</Trans>;
248+
return <Trans>You have no rewards to claim at this time.</Trans>;
249249
default:
250250
return null;
251251
}
@@ -377,11 +377,7 @@ export const ClaimRewardsModalContent = ({ user, reserves }: ClaimRewardsModalCo
377377
</Typography>
378378
)}
379379

380-
{blockingError !== undefined && (
381-
<Typography variant="helperText" color="error.main">
382-
{handleBlocked()}
383-
</Typography>
384-
)}
380+
{blockingError !== undefined && <Typography>{handleBlocked()}</Typography>}
385381

386382
{(rewards.length > 1 ||
387383
(rewards.length >= 1 &&

src/locales/el/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.po

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ msgstr "Rate change"
151151
msgid "Sorry, we couldn't find the page you were looking for."
152152
msgstr "Sorry, we couldn't find the page you were looking for."
153153

154-
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
155-
msgid "Merit Program and Self rewards are claimed through the"
156-
msgstr "Merit Program and Self rewards are claimed through the"
157-
158154
#: src/components/transactions/Switch/SwitchAssetInput.tsx
159155
msgid "Select token"
160156
msgstr "Select token"
@@ -380,6 +376,11 @@ msgstr "Terms"
380376
msgid "Maximum available to borrow"
381377
msgstr "Maximum available to borrow"
382378

379+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
380+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
381+
msgid "or from the"
382+
msgstr "or from the"
383+
383384
#: src/components/transactions/DelegationTxsWrapper.tsx
384385
msgid "Sign to continue"
385386
msgstr "Sign to continue"
@@ -1592,6 +1593,11 @@ msgstr "Maximum amount available to borrow against this asset is limited because
15921593
msgid "Email"
15931594
msgstr "Email"
15941595

1596+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
1597+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
1598+
msgid "here"
1599+
msgstr "here"
1600+
15951601
#: src/modules/staking/StakingPanel.tsx
15961602
#: src/modules/umbrella/UnstakeModal.tsx
15971603
msgid "Unstake"
@@ -2141,6 +2147,10 @@ msgstr "Staked Underlying"
21412147
msgid "Umbrella"
21422148
msgstr "Umbrella"
21432149

2150+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
2151+
msgid "Merit Program and Self rewards can be claimed"
2152+
msgstr "Merit Program and Self rewards can be claimed"
2153+
21442154
#: src/components/transactions/Switch/SwitchTxSuccessView.tsx
21452155
msgid "The order could't be filled."
21462156
msgstr "The order could't be filled."
@@ -2739,6 +2749,11 @@ msgstr "Claim"
27392749
msgid "Liquidated collateral"
27402750
msgstr "Liquidated collateral"
27412751

2752+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
2753+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
2754+
msgid "dashboard"
2755+
msgstr "dashboard"
2756+
27422757
#: src/components/transactions/Borrow/BorrowActions.tsx
27432758
msgid "Borrowing {symbol}"
27442759
msgstr "Borrowing {symbol}"
@@ -3253,10 +3268,6 @@ msgstr "The loan to value of the migrated positions would cause liquidation. Inc
32533268
msgid "This asset has reached its borrow cap. Nothing is available to be borrowed from this market."
32543269
msgstr "This asset has reached its borrow cap. Nothing is available to be borrowed from this market."
32553270

3256-
#: src/components/transactions/ClaimRewards/ClaimRewardsModalContent.tsx
3257-
msgid "Your reward balance is 0"
3258-
msgstr "Your reward balance is 0"
3259-
32603271
#: src/modules/governance/DelegatedInfoPanel.tsx
32613272
msgid "Set up delegation"
32623273
msgstr "Set up delegation"
@@ -3593,6 +3604,10 @@ msgstr "Borrow amount to reach {0}% utilization"
35933604
msgid "Please, connect your wallet"
35943605
msgstr "Please, connect your wallet"
35953606

3607+
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
3608+
msgid "Merit Program rewards can be claimed"
3609+
msgstr "Merit Program rewards can be claimed"
3610+
35963611
#: src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsList.tsx
35973612
#: src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsList.tsx
35983613
msgid "Your supplies"
@@ -3654,6 +3669,10 @@ msgstr "Custom slippage"
36543669
msgid "This asset is eligible for Kernel points incentive program. Aave Labs does not guarantee the program and accepts no liability."
36553670
msgstr "This asset is eligible for Kernel points incentive program. Aave Labs does not guarantee the program and accepts no liability."
36563671

3672+
#: src/components/transactions/ClaimRewards/ClaimRewardsModalContent.tsx
3673+
msgid "You have no rewards to claim at this time."
3674+
msgstr "You have no rewards to claim at this time."
3675+
36573676
#: src/components/transactions/DebtSwitch/DebtSwitchModalContent.tsx
36583677
msgid "Insufficient collateral to cover new borrow position. Wallet must have borrowing power remaining to perform debt switch."
36593678
msgstr "Insufficient collateral to cover new borrow position. Wallet must have borrowing power remaining to perform debt switch."
@@ -3998,7 +4017,3 @@ msgstr "Asset is frozen in {marketName} v3 market, hence this position cannot be
39984017
#: src/modules/migration/MigrationBottomPanel.tsx
39994018
msgid "Be mindful of the network congestion and gas prices."
40004019
msgstr "Be mindful of the network congestion and gas prices."
4001-
4002-
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
4003-
msgid "Merit Program rewards are claimed through the"
4004-
msgstr "Merit Program rewards are claimed through the"

src/locales/es/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/fr/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/dashboard/DashboardTopPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export const DashboardTopPanel = () => {
251251
</TopInfoPanelItem>
252252
)}
253253

254-
{currentAccount && claimableRewardsUsd > 0 && (
254+
{currentAccount && (
255255
<TopInfoPanelItem title={<Trans>Available rewards</Trans>} loading={loading} hideIcon>
256256
<Box
257257
sx={{

0 commit comments

Comments
 (0)