update minting page

This commit is contained in:
PhilReact 2025-01-15 02:22:03 +02:00
parent 300ce33866
commit 983db5a087

View File

@ -600,7 +600,7 @@ export const Minting = ({
</Typography>
</Card>
<Spacer height="10px" />
{accountInfo?.level >= 1 && !accountIsMinting && (
{isPartOfMintingGroup && !accountIsMinting && (
<Box
sx={{
display: "flex",
@ -678,17 +678,6 @@ export const Minting = ({
<Typography>
Minting account: {handleNames(acct?.mintingAccount)}
</Typography>
<Typography>
Recipient account: {handleNames(acct?.recipientAccount)}
</Typography>
{acct?.mintingAccount !== accountInfo?.address &&
acct?.recipientAccount === accountInfo?.address &&
(accountInfo?.level || 0) > 0 && (
<Typography>
You have reached level 1+. Remove this minting key and then
click "Start Minting".
</Typography>
)}
<Button
size="small"
sx={{
@ -832,342 +821,7 @@ export const Minting = ({
</Box>
</Card>
)}
{isPartOfMintingGroup && (
<>
{accountInfo?.level >= 5 && (
<Box
sx={{
display: "flex",
gap: "5px",
flexDirection: "column",
}}
>
{rewardShares?.filter((item) => item?.recipient !== myAddress)
?.length > 0 && (
<>
<Typography>Active sponsorships</Typography>
<Card
sx={{
backgroundColor: "var(--bg-2)",
padding: "10px",
display: "flex",
gap: "5px",
flexDirection: "column",
}}
>
{rewardShares
?.filter((item) => item?.recipient !== myAddress)
.map((rs) => (
<Box
key={rs?.recipient}
sx={{
display: "flex",
gap: "10px",
flexDirection: "column",
}}
>
<Typography>
Recipient: {handleNames(rs?.recipient)}
</Typography>
<Typography>
Level:{" "}
{handleAccountInfos(rs?.recipient, "level")}
</Typography>
{handleAccountInfos(rs?.recipient, "level") !==
undefined && (
<>
{handleAccountInfos(rs?.recipient, "level") ===
0 && (
<Typography>
Blocks remaining until level 1:{" "}
{calculateBlocksRemainingToLevel1(
rs?.recipient
)}
</Typography>
)}
{(handleAccountInfos(rs?.recipient, "level") ||
0) > 0 && (
<Typography>
This account is above level 0. You may
remove this rewardshare
</Typography>
)}
</>
)}
<Button
size="small"
sx={{
backgroundColor: "var(--danger)",
color: "black",
fontWeight: "bold",
opacity: 0.7,
maxWidth: "90%",
width: "200px",
"&:hover": {
backgroundColor: "var(--danger)",
color: "black",
opacity: 1,
},
}}
onClick={() => {
handleRemoveRewardShare(rs);
}}
variant="contained"
>
Remove reward share
</Button>
<Button
size="small"
sx={{
backgroundColor: "var(--green)",
color: "black",
fontWeight: "bold",
opacity: 0.7,
maxWidth: "90%",
width: "200px",
"&:hover": {
backgroundColor: "var(--green)",
color: "black",
opacity: 1,
},
}}
onClick={() => {
showAndCopySponsorshipKey(rs);
}}
variant="contained"
>
Copy sponsorship key
</Button>
<Divider />
<Spacer height="10px" />
</Box>
))}
</Card>
</>
)}
<Spacer height="10px" />
<Typography>Sponsor a new Minter</Typography>
<Card
sx={{
backgroundColor: "var(--bg-2)",
padding: "10px",
display: "flex",
gap: "5px",
flexDirection: "column",
}}
>
{rewardShares?.filter((item) => item?.recipient !== myAddress)
?.length > 0 ? (
<>
<Typography>
You are currently sponsoring one account. To sponsor
another account please remove the existing reward share.
</Typography>
</>
) : (
<>
<Typography>
Enter in the new Minter's address or name into the
input. Next, click on "Create reward share". If
successful, you will see a rewardshare key generated.
Copy the key and send it to your new Minter.
</Typography>
<InputBase
value={rewardSharePublicKey}
onChange={(e) =>
setRewardSharePublicKey(e.target.value)
}
sx={{
border: "0.5px solid var(--50-white, #FFFFFF80)",
padding: "0px 15px",
borderRadius: "5px",
height: "36px",
width: "350px",
maxWidth: "95%",
}}
placeholder="New minter's address or name"
inputProps={{
"aria-label": "New minter's address or name",
fontSize: "14px",
fontWeight: 400,
}}
/>
<Button
size="small"
sx={{
backgroundColor: "var(--green)",
color: "black",
fontWeight: "bold",
opacity: 0.7,
maxWidth: "90%",
width: "200px",
"&:hover": {
backgroundColor: "var(--green)",
color: "black",
opacity: 1,
},
}}
onClick={() => {
createRewardShareForPotentialMinter(
rewardSharePublicKey
);
}}
disabled={!rewardSharePublicKey}
variant="contained"
>
Create reward share
</Button>
{rewardsharekey && (
<>
<Spacer height="10px" />
<Typography>
Click to copy the reward share key and share it with
your new minter
</Typography>
<Spacer height="10px" />
<CopyToClipboard text={rewardsharekey}>
<AddressBox
sx={{
width: "325px",
maxWidth: "95%",
height: "auto",
lineHeight: 1.2,
fontSize: "16px",
}}
>
{rewardsharekey} <img src={Copy} />
</AddressBox>
</CopyToClipboard>
</>
)}
</>
)}
</Card>
</Box>
)}
{accountInfo?.level === 0 && !accountIsMinting && (
<>
<Typography>Become a minter!</Typography>
<Card
sx={{
backgroundColor: "var(--bg-2)",
padding: "10px",
}}
>
<Box
sx={{
display: "flex",
gap: "5px",
flexDirection: "column",
}}
>
<Typography>
Ask a level 5+ minter to send you a minting key
</Typography>
<Typography>
Add the minting key in the input below and click "Add
minting key"
</Typography>
<Spacer height="10px" />
<InputBase
value={mintingKey}
onChange={(e) => setMintingKey(e.target.value)}
sx={{
border: "0.5px solid var(--50-white, #FFFFFF80)",
padding: "0px 15px",
borderRadius: "5px",
height: "36px",
width: "250px",
}}
placeholder="Add minting key"
inputProps={{
"aria-label": "Add minting key",
fontSize: "14px",
fontWeight: 400,
}}
/>
<Button
size="small"
onClick={() => {
addMintingAccount(mintingKey);
}}
sx={{
backgroundColor: "var(--green)",
color: "black",
fontWeight: "bold",
opacity: 0.7,
maxWidth: "90%",
width: "200px",
"&:hover": {
backgroundColor: "var(--green)",
color: "black",
opacity: 1,
},
}}
disabled={!mintingKey}
variant="contained"
>
Add minting key
</Button>
</Box>
</Card>
</>
)}
{accountInfo?.level === 0 && accountIsMinting && (
<Box
sx={{
display: "flex",
gap: "5px",
flexDirection: "column",
}}
>
<Typography>
You are currently on your way to level 1
</Typography>
</Box>
)}
</>
)}
{isShow && (
<Dialog
open={isShow}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">
{"Copy sponsorship key"}
</DialogTitle>
<DialogContent>
<Typography>
Click to copy the reward share key and share it with your new
minter
</Typography>
<Spacer height="10px" />
<CopyToClipboard text={message?.message}>
<AddressBox
sx={{
width: "325px",
maxWidth: "95%",
height: "auto",
lineHeight: 1.2,
fontSize: "16px",
}}
>
{message?.message} <img src={Copy} />
</AddressBox>
</CopyToClipboard>
</DialogContent>
<DialogActions>
<Button variant="contained" onClick={onOk} autoFocus>
Close
</Button>
</DialogActions>
</Dialog>
)}
</DialogContent>
<DialogActions>
<Button