This commit is contained in:
Nicola Benaglia 2025-06-21 15:31:38 +02:00
parent cfb438b0bc
commit 7ae9bd1dae
2 changed files with 91 additions and 34 deletions

View File

@ -1,5 +1,6 @@
import { import {
Alert, Alert,
alpha,
AppBar, AppBar,
Box, Box,
Button, Button,
@ -546,16 +547,21 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
}; };
const StatCard = ({ label, value }: { label: string; value: string }) => ( const StatCard = ({ label, value }: { label: string; value: string }) => (
<Grid size={{ xs: 4, sm: 6 }}> <Paper
<Paper elevation={5}> elevation={5}
<Box textAlign="center"> sx={{
<Typography variant="subtitle1" fontWeight="bold"> borderRadius: '10px',
{label} margin: '10px',
</Typography> padding: '10px',
<Typography>{value}</Typography> }}
</Box> >
</Paper> <Box textAlign="center">
</Grid> <Typography variant="subtitle1" fontWeight="bold">
{label}
</Typography>
<Typography>{value}</Typography>
</Box>
</Paper>
); );
const handleChange = (event: SyntheticEvent, newValue: number) => { const handleChange = (event: SyntheticEvent, newValue: number) => {
@ -652,8 +658,22 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
position: 'relative', position: 'relative',
}} }}
> >
<Container maxWidth="md" sx={{ py: 4 }}> <Container
<Paper elevation={0} sx={{ p: 3, mb: 4, borderRadius: '10px' }}> maxWidth="md"
sx={{
py: 4,
}}
>
<Paper
elevation={0}
sx={{
backgroundColor: (theme) =>
alpha(theme.palette.background.paper, 0.5),
p: 3,
mb: 4,
borderRadius: '10px',
}}
>
<Typography <Typography
variant="h3" variant="h3"
gutterBottom gutterBottom
@ -662,9 +682,14 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
Blockchain Statistics Blockchain Statistics
</Typography> </Typography>
<Grid container spacing={2}> <Grid
size={{ xs: 4, sm: 6 }}
container
spacing={2}
justifyContent="center"
>
<StatCard <StatCard
label="Avg. Qortal Blocktime (seconds)" label="Average Qortal Blocktime"
value={averageBlockTime( value={averageBlockTime(
adminInfo, adminInfo,
nodeHeightBlock nodeHeightBlock
@ -672,7 +697,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
/> />
<StatCard <StatCard
label="Avg. Blocks Per Day" label="Average Blocks Per Day"
value={averageBlockDay( value={averageBlockDay(
adminInfo, adminInfo,
nodeHeightBlock nodeHeightBlock
@ -680,7 +705,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
/> />
<StatCard <StatCard
label="Avg. Created QORT Per Day" label="Average Created QORT Per Day"
value={dayReward( value={dayReward(
adminInfo, adminInfo,
nodeHeightBlock, nodeHeightBlock,
@ -690,7 +715,16 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
</Grid> </Grid>
</Paper> </Paper>
<Paper elevation={0} sx={{ p: 3, mb: 4, borderRadius: '10px' }}> <Paper
elevation={0}
sx={{
backgroundColor: (theme) =>
alpha(theme.palette.background.paper, 0.5),
p: 3,
mb: 4,
borderRadius: '10px',
}}
>
<Typography <Typography
variant="h3" variant="h3"
gutterBottom gutterBottom
@ -699,7 +733,12 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
Minting Account Details Minting Account Details
</Typography> </Typography>
<Grid container spacing={2}> <Grid
size={{ xs: 4, sm: 6 }}
container
spacing={2}
justifyContent="center"
>
<StatCard <StatCard
label="Current Status" label="Current Status"
value={mintingStatus(nodeStatus)} value={mintingStatus(nodeStatus)}
@ -710,15 +749,17 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
/> />
<StatCard <StatCard
label="Blocks To Next Level" label="Blocks To Next Level"
value={levelUpBlocks(accountInfo, nodeStatus) || ''} value={
levelUpBlocks(accountInfo, nodeStatus).toFixed(0) || ''
}
/> />
</Grid> </Grid>
<Box mt={2} textAlign="center"> <Box mt={4} textAlign="center">
<Paper elevation={5}> <Paper elevation={5}>
<Typography sx={{ textAlign: 'center' }}> <Typography sx={{ textAlign: 'center' }}>
<Trans <Trans
i18nKey="message.generic.minting_next_level" i18nKey="message.generic.minting.next_level"
ns="core" ns="core"
components={{ components={{
strong: <strong />, strong: <strong />,
@ -734,7 +775,15 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
</Box> </Box>
</Paper> </Paper>
<Paper elevation={0} sx={{ p: 3, borderRadius: '10px' }}> <Paper
elevation={0}
sx={{
backgroundColor: (theme) =>
alpha(theme.palette.background.paper, 0.5),
p: 3,
borderRadius: '10px',
}}
>
<Typography <Typography
variant="h3" variant="h3"
gutterBottom gutterBottom
@ -743,7 +792,12 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
Minting Rewards Info Minting Rewards Info
</Typography> </Typography>
<Grid container spacing={2}> <Grid
size={{ xs: 4, sm: 6 }}
container
spacing={2}
justifyContent="center"
>
<StatCard <StatCard
label="Current Tier" label="Current Tier"
value={currentTier(accountInfo?.level) || ''} value={currentTier(accountInfo?.level) || ''}

View File

@ -183,7 +183,7 @@ export const countReward = (
nodeStatus, nodeStatus,
tier4Online: number tier4Online: number
): number => { ): number => {
if (accountInfo != null && (addressLevel && addressLevel.length > 0) ) { if (accountInfo != null && addressLevel && addressLevel.length > 0) {
const level = accountInfo.level; const level = accountInfo.level;
if (level === 0) { if (level === 0) {
return 0; return 0;
@ -273,7 +273,7 @@ export const countRewardDay = (
nodeStatus, nodeStatus,
tier4Online: number tier4Online: number
): number => { ): number => {
if (accountInfo != null && (addressLevel && addressLevel.length > 0) ) { if (accountInfo != null && addressLevel && addressLevel.length > 0) {
const level = accountInfo.level; const level = accountInfo.level;
const timeCalc = averageBlockDay(adminInfo, nodeHeightBlock); const timeCalc = averageBlockDay(adminInfo, nodeHeightBlock);
if (level === 0) { if (level === 0) {
@ -369,7 +369,7 @@ export const mintingStatus = (nodeStatus): string => {
nodeStatus.isSynchronizing === true nodeStatus.isSynchronizing === true
) { ) {
// this.cssMinting = 'blue'; // this.cssMinting = 'blue';
return i18n.t('core:message.status.minting', { return i18n.t('core:minting.status.minting', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
}); });
} else if ( } else if (
@ -377,7 +377,7 @@ export const mintingStatus = (nodeStatus): string => {
nodeStatus.isSynchronizing === false nodeStatus.isSynchronizing === false
) { ) {
// this.cssMinting = 'blue'; // this.cssMinting = 'blue';
return i18n.t('core:message.status.minting', { return i18n.t('core:minting.status.minting', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
}); });
} else if ( } else if (
@ -385,7 +385,7 @@ export const mintingStatus = (nodeStatus): string => {
nodeStatus.isSynchronizing === true nodeStatus.isSynchronizing === true
) { ) {
// this.cssMinting = 'red'; // this.cssMinting = 'red';
return i18n.t('core:message.status.synchronizing', { return i18n.t('core:minting.status.synchronizing', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
}) + }) +
nodeStatus.syncPercent !== nodeStatus.syncPercent !==
@ -397,11 +397,11 @@ export const mintingStatus = (nodeStatus): string => {
nodeStatus.isSynchronizing === false nodeStatus.isSynchronizing === false
) { ) {
// this.cssMinting = 'red'; // this.cssMinting = 'red';
return i18n.t('core:message.status.not_minting', { return i18n.t('core:minting.status.not_minting', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
}); });
} else { } else {
return i18n.t('core:message.status.no_status', { return i18n.t('core:minting.status.no_status', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
}); });
} }
@ -429,7 +429,8 @@ export const levelUpBlocks = (accountInfo, nodeStatus): number => {
const nextBatch = 1000 - (nodeStatus.height % 1000); const nextBatch = 1000 - (nodeStatus.height % 1000);
const countBlocks = const countBlocks =
accountTargetBlocks(accountInfo?.level)! - accountTargetBlocks(accountInfo?.level)! -
(accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment) + 1000; (accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment) +
1000;
const countBlocksActual = countBlocks + nextBatch - (countBlocks % 1000); const countBlocksActual = countBlocks + nextBatch - (countBlocks % 1000);
return countBlocksActual; return countBlocksActual;
}; };
@ -450,10 +451,12 @@ export const levelUpDays = (
const nextBatch = 1000 - (nodeStatus.height % 1000); const nextBatch = 1000 - (nodeStatus.height % 1000);
const countBlocks = const countBlocks =
accountTargetBlocks(accountInfo?.level)! - accountTargetBlocks(accountInfo?.level)! -
(accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment) + 1000; (accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment) +
1000;
const countBlocksActual = countBlocks + nextBatch - (countBlocks % 1000); const countBlocksActual = countBlocks + nextBatch - (countBlocks % 1000);
const countDays = countBlocksActual / averageBlockDay(adminInfo, nodeHeightBlock); const countDays =
countBlocksActual / averageBlockDay(adminInfo, nodeHeightBlock);
return countDays; return countDays;
}; };