From 233e6179d5a480571accac5810b9335ffae96ff3 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Tue, 17 Jun 2025 18:56:14 +0200 Subject: [PATCH] WIP --- src/components/Minting/Minting.tsx | 7 +++-- src/components/Minting/MintingStats.tsx | 35 ++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/components/Minting/Minting.tsx b/src/components/Minting/Minting.tsx index 6eaeb3e..bc336b8 100644 --- a/src/components/Minting/Minting.tsx +++ b/src/components/Minting/Minting.tsx @@ -246,7 +246,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => { const getRewardShares = useCallback(async (address) => { 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); if (!response.ok) { throw new Error('network error'); @@ -674,7 +674,10 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => { - + { export const currentTier = (addressInfo): string | undefined => { if (addressInfo.level === 0) { - return '`Tier 0 (Level 0)'; + return 'Tier 0 (Level 0)'; } else if (addressInfo.level === 1 || addressInfo.level === 2) { return 'Tier 1 (Level 1 + 2)'; } 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) => { const avgBlock = adminInfo.currentTimestamp - nodeHeightBlock.timestamp; const averageTime = avgBlock / 1000 / 1440;