Skip to content

Commit

Permalink
Merge pull request #40 from InvArch:yaki-more-ui-fixes
Browse files Browse the repository at this point in the history
Yaki-more-ui-fixes
  • Loading branch information
shibatales authored Jan 10, 2024
2 parents 192f787 + d2a1c7b commit 8cfcc8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/MetricDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const MetricDashboard = (props: MetricDashboardProps) => {

return (
<div
className="min-h-40 relative overflow-x-auto rounded-xl shadow flex lg:flex-wrap flex-grow flex-row gap-4 justify-between backdrop-blur-sm bg-black bg-opacity-40 tinker-scrollbar scrollbar scrollbar-thumb-amber-300 scrollbar-thin overflow-x-auto p-4 mb-4">
className="min-h-40 max-w-[1068px] relative overflow-x-auto rounded-xl shadow flex lg:flex-wrap flex-grow flex-row gap-4 justify-between backdrop-blur-sm bg-black bg-opacity-40 tinker-scrollbar scrollbar scrollbar-thumb-amber-300 scrollbar-thin overflow-x-auto p-4 mb-4">

{totalUnclaimed !== undefined && <DashboardCard cardTitle="Unclaimed Rewards" iconSrc={AggregateStakedIcon}>
{totalUnclaimed ? `${ formatBalanceToTwoDecimals(totalUnclaimed) } TNKR` : "0 TNKR"}
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ const ProjectCard = (props: ProjectCardProps) => {

useEffect(() => {
calcMinSupportMet();
}, [calcMinSupportMet]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
if (totalStaked !== undefined) {
Expand Down
23 changes: 11 additions & 12 deletions src/routes/xtransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,17 @@ const Transfer = () => {
// Remove all non-numeric characters except for the decimal point
const sanitizedInput = e.replace(/[^\d.]/g, '');

// Remove leading zeroes after the tens digit
const inputWithoutLeadingZeroes = sanitizedInput.replace(/^0+([0-9]+)/, '$1');

// Format the available balance with 12 decimals
const formattedBalance = new BigNumber(availableBalance.toString()).dividedBy(new BigNumber(10).pow(12));

if (sanitizedInput === '') {
setAmount('0');
} else if (Number(sanitizedInput) >= 0 && Number(sanitizedInput) <= formattedBalance.toNumber()) {
setAmount(sanitizedInput);
} else if (Number(sanitizedInput) > formattedBalance.toNumber()) {
if (inputWithoutLeadingZeroes === '') {
setAmount('');
} else if (Number(inputWithoutLeadingZeroes) >= 0 && Number(inputWithoutLeadingZeroes) <= formattedBalance.toNumber()) {
setAmount(inputWithoutLeadingZeroes);
} else if (Number(inputWithoutLeadingZeroes) > formattedBalance.toNumber()) {
setAmount(formattedBalance.toString());
}
};
Expand Down Expand Up @@ -281,7 +284,7 @@ const Transfer = () => {
// Multiply the amount by 10^12 and convert to a string
const amountToSend = amountBigNumber.multipliedBy(new BigNumber(10).pow(12)).toString();

api.tx.xTokens
await api.tx.xTokens
.transfer(
0,
amountToSend,
Expand Down Expand Up @@ -367,11 +370,11 @@ const Transfer = () => {
const apiBasilisk = await ApiPromise.create({
provider: wsProviderBasilisk,
});

console.log('amountBigNumber', amountBigNumber.toString());
// Multiply the amount by 10^12 and convert to a string
const amountToSend = amountBigNumber.multipliedBy(new BigNumber(10).pow(12)).toString();

apiBasilisk.tx.xTokens
await apiBasilisk.tx.xTokens
.transfer(
6,
amountToSend,
Expand Down Expand Up @@ -469,10 +472,6 @@ const Transfer = () => {
};
}, [api, apiBasilisk, selectedAccount, setupSubscriptions]);

useEffect(() => {
setAmount("0");
}, [pair.from, pair.to]);

return (
<div className="mx-auto w-full flex max-w-7xl flex-col justify-between p-4 sm:px-6 lg:px-8 mt-14 md:mt-0 gap-3">
<div className="z-10 w-full">
Expand Down

1 comment on commit 8cfcc8a

@vercel
Copy link

@vercel vercel bot commented on 8cfcc8a Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.