Merge branch 'feature/ui-fixes' into develop

This commit is contained in:
Willian Mitsuda 2021-08-08 03:10:18 -03:00
commit f94a0eef5e
2 changed files with 21 additions and 19 deletions

View File

@ -2,29 +2,29 @@ import React from "react";
type PercentageGaugeProps = {
perc: number;
bgFull: string;
bgPerc: string;
textPerc: string;
bgColor: string;
bgColorPerc: string;
textColor: string;
};
const PercentageGauge: React.FC<PercentageGaugeProps> = ({
perc,
bgFull,
bgPerc,
textPerc,
bgColor,
bgColorPerc,
textColor,
}) => (
<div className="w-60 h-6 border-l-2 border-gray-400 relative">
<div className="flex absolute w-full h-full">
<div className={`my-auto h-5 rounded-r-lg w-full ${bgFull}`}></div>
<div className={`my-auto h-5 rounded-r-lg w-full ${bgColor}`}></div>
</div>
<div className="flex absolute w-full h-full">
<div
className={`my-auto h-5 rounded-r-lg ${bgPerc}`}
className={`my-auto h-5 rounded-r-lg ${bgColorPerc}`}
style={{ width: `${perc}%` }}
></div>
</div>
<div
className={`flex absolute w-full h-full mix-blend-multiply text-sans ${textPerc}`}
className={`flex absolute w-full h-full mix-blend-multiply text-sans ${textColor}`}
>
<span className="m-auto">{perc}%</span>
</div>

View File

@ -10,20 +10,22 @@ type RewardSplitProps = {
};
const RewardSplit: React.FC<RewardSplitProps> = ({ txData }) => {
const paidFees = txData.gasPrice.mul(txData.gasUsed);
const burntFees = txData.blockBaseFeePerGas!.mul(txData.gasUsed);
const minerReward = txData.gasPrice.mul(txData.gasUsed).sub(burntFees);
const minerReward = paidFees.sub(burntFees);
const burntPerc =
burntFees.mul(10000).div(txData.gasPrice.mul(txData.gasUsed)).toNumber() /
100;
Math.round(burntFees.mul(10000).div(paidFees).toNumber()) / 100;
const minerPerc = Math.round((100 - burntPerc) * 100) / 100;
return (
<div className="inline-block">
<div className="grid grid-cols-2 gap-x-2 gap-y-1 items-center text-sm">
<PercentageGauge
perc={burntPerc}
bgFull="bg-orange-100"
bgPerc="bg-orange-500"
textPerc="text-orange-800"
bgColor="bg-orange-100"
bgColorPerc="bg-orange-500"
textColor="text-orange-800"
/>
<div className="flex items-baseline space-x-1">
<span className="flex space-x-1 text-orange-500">
@ -39,10 +41,10 @@ const RewardSplit: React.FC<RewardSplitProps> = ({ txData }) => {
</span>
</div>
<PercentageGauge
perc={100 - burntPerc}
bgFull="bg-yellow-100"
bgPerc="bg-yellow-300"
textPerc="text-yellow-700"
perc={minerPerc}
bgColor="bg-yellow-100"
bgColorPerc="bg-yellow-300"
textColor="text-yellow-700"
/>
<div className="flex items-baseline space-x-1">
<span className="flex space-x-1">