This commit is contained in:
Nicola Benaglia 2025-06-17 18:56:14 +02:00
parent f2d7146b9a
commit 233e6179d5
2 changed files with 39 additions and 3 deletions

View File

@ -246,7 +246,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
const getRewardShares = useCallback(async (address) => { const getRewardShares = useCallback(async (address) => {
try { try {
const url = `${getBaseApiReact()}/addresses/rewardshares?involving=${address}`; const url = `${getBaseApiReact()}/addresses/rewardshares?involving=${address}`; // TODO check API (still useful?)
const response = await fetch(url); const response = await fetch(url);
if (!response.ok) { if (!response.ok) {
throw new Error('network error'); throw new Error('network error');
@ -674,7 +674,10 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
<Grid container spacing={2}> <Grid container spacing={2}>
<StatCard label="Current Status" value="(Minting)" /> <StatCard label="Current Status" value="(Minting)" />
<StatCard label="Current Level" value="Level 4" /> <StatCard
label="Current Level"
value={accountInfo?.level}
/>
<StatCard <StatCard
label="Blocks To Next Level" label="Blocks To Next Level"
value={levelUpBlocks(accountInfo, nodeStatus) || ''} value={levelUpBlocks(accountInfo, nodeStatus) || ''}

View File

@ -82,7 +82,7 @@ export const blockReward = (nodeStatus): number => {
export const currentTier = (addressInfo): string | undefined => { export const currentTier = (addressInfo): string | undefined => {
if (addressInfo.level === 0) { if (addressInfo.level === 0) {
return '`Tier 0 (Level 0)'; return 'Tier 0 (Level 0)';
} else if (addressInfo.level === 1 || addressInfo.level === 2) { } else if (addressInfo.level === 1 || addressInfo.level === 2) {
return 'Tier 1 (Level 1 + 2)'; return 'Tier 1 (Level 1 + 2)';
} else if (addressInfo.level === 3 || addressInfo.level === 4) { } else if (addressInfo.level === 3 || addressInfo.level === 4) {
@ -339,6 +339,39 @@ export const tierPercent = (addressInfo, tier4Online): number | undefined => {
// } // }
// } // }
export const mintingStatus = () => {
if (
this.nodeInfo.isMintingPossible === true &&
this.nodeInfo.isSynchronizing === true
) {
this.cssMinting = 'blue';
return html`${translate('appinfo.minting')}`;
} else if (
this.nodeInfo.isMintingPossible === true &&
this.nodeInfo.isSynchronizing === false
) {
this.cssMinting = 'blue';
return html`${translate('appinfo.minting')}`;
} else if (
this.nodeInfo.isMintingPossible === false &&
this.nodeInfo.isSynchronizing === true
) {
this.cssMinting = 'red';
return html`(${translate('appinfo.synchronizing')}...
${this.nodeStatus.syncPercent !== undefined
? this.nodeStatus.syncPercent + '%'
: ''})`;
} else if (
this.nodeInfo.isMintingPossible === false &&
this.nodeInfo.isSynchronizing === false
) {
this.cssMinting = 'red';
return html`${translate('mintingpage.mchange9')}`;
} else {
return 'No Status';
}
};
export const averageBlockTime = (adminInfo, nodeHeightBlock) => { export const averageBlockTime = (adminInfo, nodeHeightBlock) => {
const avgBlock = adminInfo.currentTimestamp - nodeHeightBlock.timestamp; const avgBlock = adminInfo.currentTimestamp - nodeHeightBlock.timestamp;
const averageTime = avgBlock / 1000 / 1440; const averageTime = avgBlock / 1000 / 1440;