Skip to content

Commit

Permalink
Merge pull request #110 from multiversx/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
radumojic authored Jul 1, 2024
2 parents 1d55bde + cacc09c commit b2b02fe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/components/TransactionIcon/TransactionIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ interface TransactionIconType {
transaction: UITransactionType;
showSuccess?: boolean;
showGuardian?: boolean;
showSovereignBridge?: boolean;
withBadge?: boolean;
}

export const TransactionIcon = ({
transaction,
showSuccess = false,
showGuardian = true,
showSovereignBridge = true,
withBadge = false
}: TransactionIconType) => {
const { getTransaction } = useAdapter();
Expand Down Expand Up @@ -150,7 +152,9 @@ export const TransactionIcon = ({
<>
<StatusIcon />
{showGuardian && <TransactionGuardianIcon transaction={transaction} />}
<TransactionSovereignBridgeIcon transaction={transaction} />
{showSovereignBridge && (
<TransactionSovereignBridgeIcon transaction={transaction} />
)}
</>
);
};
33 changes: 28 additions & 5 deletions src/hooks/fetch/useFetchEpochProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ import {
statsSelector
} from 'redux/selectors';

const getStepInterval = (refreshInterval: number) => {
switch (refreshInterval) {
case 6000:
return new BigNumber(1000);
case 3000:
return new BigNumber(500);
case 2000:
return new BigNumber(500);
case 1000:
return new BigNumber(200);

default:
return new BigNumber(
new BigNumber(refreshInterval).isGreaterThan(1000)
? new BigNumber(refreshInterval).minus(1000)
: refreshInterval
).dividedBy(5);
}
};

export const useFetchEpochProgress = () => {
const fetchStats = useFetchStats();

Expand All @@ -24,11 +44,8 @@ export const useFetchEpochProgress = () => {
const refreshInterval = refreshRate ? refreshRate : REFRESH_RATE;
const refreshIntervalSec = new BigNumber(refreshInterval).dividedBy(1000);

const stepInterval = new BigNumber(
new BigNumber(refreshInterval).isGreaterThan(1000)
? new BigNumber(refreshInterval).minus(1000)
: refreshInterval
).dividedBy(5);
const stepInterval = getStepInterval(refreshInterval);

const stepProgressSec = stepInterval.dividedBy(1000);

const [oldTestnetId, setOldTestnetId] = useState(activeNetworkId);
Expand All @@ -41,6 +58,9 @@ export const useFetchEpochProgress = () => {
const [epochRoundsLeft, setEpochRoundsLeft] = useState<number>(0);

const updateStats = () => {
if (!refreshRate) {
return;
}
setIsNewState(oldTestnetId !== activeNetworkId);
if (isNewState) {
startRoundTime();
Expand Down Expand Up @@ -79,6 +99,9 @@ export const useFetchEpochProgress = () => {
};

const startRoundTime = () => {
if (!refreshRate) {
return;
}
const intervalRoundTime = setInterval(() => {
if (!pageHidden) {
setRoundTimeProgress((roundTimeProgress) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { NoTransactions } from 'components/TransactionsTable/components/NoTransa
import { TransactionValue } from 'components/TransactionsTable/components/TransactionValue';
import {
addressIsBech32,
urlBuilder,
getDisplayReceiver,
getTransactionStatusIconAndColor
} from 'helpers';
Expand Down Expand Up @@ -138,9 +137,10 @@ export const LatestTransactions = () => {
>
<TransactionIcon
transaction={transaction}
showGuardian={false}
showSovereignBridge={false}
showSuccess
withBadge
showGuardian={false}
/>

<div className='d-flex flex-column overflow-hidden min-w-0'>
Expand Down Expand Up @@ -171,7 +171,7 @@ export const LatestTransactions = () => {
<span className='px-2 text-muted ms-auto'></span>
<ShardLink
shard={transaction.receiverShard}
receiverShard
transactionReceiverShard
className='flex-shrink-0'
/>
</div>
Expand All @@ -192,7 +192,7 @@ export const LatestTransactions = () => {
</span>
<ShardLink
shard={transaction.senderShard}
senderShard
transactionSenderShard
className='flex-shrink-0'
/>
</>
Expand Down

0 comments on commit b2b02fe

Please sign in to comment.