Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Box, Button, Grid, Typography, useTheme } from "@mui/material";
import { AlertBox, Input, Link } from "@/components";
import { ConnectedAccount } from "substrate-react";
import { useStore } from "@/stores/root";

type KsmAndEthAssociationInfoBoxProps = {
connectedAccount?: ConnectedAccount;
isEligibleForBothAddresses?: boolean
}

export const KsmAndEthAssociationInfoBox: React.FC<KsmAndEthAssociationInfoBoxProps> = ({ connectedAccount, isEligibleForBothAddresses = false }) => {
const theme = useTheme();
const { ui: { openPolkadotModal } } = useStore();
return (
isEligibleForBothAddresses ?
<Box>
<Grid item xs={12} md={12}>
<Input
icon="/networks/polkadot_js_wallet.svg"
noBorder={true}
value={connectedAccount?.address}
disabled={true}
fullWidth
LabelProps={{
mainLabelProps: {
label: "SS58 Address",
TooltipProps: {
title: "Account used to contribute to crowd loan",
children: <></>,
},
},
}}
InputProps={{
inputProps: {
sx: {
textAlign: "center",
color: theme.palette.text.primary,
},
},
}}
/>

<AlertBox status="error" mt={theme.spacing(4)} link={<Link href="#" onClick={openPolkadotModal}>Change address</Link>}>
<Typography>
Connected wallet addresses have both been used to contribute to Picasso crowdloan, please switch to a different
Picasso account to claim rewards.
</Typography>
</AlertBox>

<Grid container spacing={2} mt={theme.spacing(4)}>
<Grid item xs={12} md={6} justifyContent="flex-start">
<Button disabled={true} color="primary" fullWidth variant="contained">
Approve Transaction
</Button>
</Grid>

<Grid item xs={12} md={6} justifyContent="flex-end">
<Button disabled={true} color="primary" fullWidth variant="contained">
Approve SS58 Address
</Button>
</Grid>
</Grid>
</Grid>
</Box> : null
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const NoEligibleWalletFeaturedBox: React.FC<{
}> = ({ title, textBelow }) => {
const theme = useTheme();
return (
<Grid item xs={12} mt={theme.spacing(9)}>
<Grid item xs={12} mt={theme.spacing(2)}>
<FeaturedBox
textAbove={title}
TextAboveProps={{
Expand Down
16 changes: 12 additions & 4 deletions frontend/apps/picasso/pages/crowdloan-rewards/claim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
useCrowdloanRewardsHasStarted,
} from "@/stores/defi/polkadot/crowdloanRewards/hooks";
import { DEFAULT_EVM_ID, APP_NAME } from "@/defi/polkadot/constants";
import { KsmAndEthAssociationInfoBox } from "@/components/Organisms/CrowdloanRewards/KsmAndEthAssociationInfoBox";

const ERROR_MESSAGES = {
KSM_WALLET_NOT_CONNECTED: {
Expand Down Expand Up @@ -121,6 +122,8 @@ export const ClaimLoanPage = () => {
selectedAccount?.address
);

const isEligibleForBothAddresses = isEthAccountEligible && isPicassoAccountEligible;

const { contributedAmount, totalRewards } =
useCrowdloanRewardsContributionAndRewards(
nextStep,
Expand Down Expand Up @@ -297,23 +300,23 @@ export const ClaimLoanPage = () => {
justifyContent="center"
pb={9}
>
<Grid item {...standardPageSize} mt={theme.spacing(9)}>
<Grid item {...standardPageSize} mt={theme.spacing(14)}>
<PageTitle
title={isStable ? "Stablecoin Contribution." : "KSM Contribution"}
textAlign="center"
subtitle="You will be able to check on your positions here."
/>
</Grid>
{hasNothingToClaim && (
<Grid item {...standardPageSize} mt={theme.spacing(9)}>
<Grid item {...standardPageSize}>
<NoEligibleWalletFeaturedBox
title={ineligibleText.title}
textBelow={ineligibleText.textBelow}
/>
</Grid>
)}
{!hasNothingToClaim && (
<Grid item {...standardPageSize} mt={theme.spacing(9)}>
{!hasNothingToClaim && !isEligibleForBothAddresses && (
<Grid item {...standardPageSize} mt={theme.spacing(2)}>
{isStable ? (
<StablecoinClaimForm
isClaiming={isPendingAssociate || isPendingClaim}
Expand Down Expand Up @@ -364,6 +367,11 @@ export const ClaimLoanPage = () => {
)}
</Grid>
)}

{isEligibleForBothAddresses && <Grid item {...standardPageSize} mt={theme.spacing(2)} >
<KsmAndEthAssociationInfoBox connectedAccount={selectedAccount} isEligibleForBothAddresses />
</Grid>}

<Grid item {...standardPageSize}>
<SS8WalletHelper />
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion frontend/apps/picasso/pages/crowdloan-rewards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const CrowdloanRewards: NextPage = () => {
key="Overview"
underline="none"
color="primary"
href="/frontend/fe/apps/picasso/pages"
href="/"
>
Overview
</Link>,
Expand Down