Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mint/burn form data display #78

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 4 additions & 28 deletions components/factory/forms/BurnForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,40 +227,16 @@ export default function BurnForm({
</div>
<div>
<p className="text-sm font-light text-gray-500 dark:text-gray-400 mb-2">
TARGET&apos;S BALANCE
CIRCULATING SUPPLY
</p>
<div className="bg-base-300 p-4 rounded-md">
<p className="font-semibold text-md text-black truncate dark:text-white">
{formatAmount(recipientBalance?.amount)}
{Number(shiftDigits(totalSupply, -exponent)).toLocaleString(undefined, {
maximumFractionDigits: exponent,
})}{' '}
</p>
</div>
</div>
{denom?.denom_units[1]?.exponent && (
<div>
<p className="text-sm font-light text-gray-500 dark:text-gray-400 mb-2">
EXPONENT
</p>
<div className="bg-base-300 p-4 rounded-md">
<p className="font-semibold text-md text-black dark:text-white">
{denom?.denom_units[1]?.exponent}
</p>
</div>
</div>
)}
{totalSupply !== '0' && (
<div>
<p className="text-sm font-light text-gray-500 dark:text-gray-400 truncate mb-2">
CIRCULATING SUPPLY
</p>
<div className="bg-base-300 p-4 rounded-md">
<p className="font-semibold text-md truncate text-black dark:text-white">
{Number(shiftDigits(totalSupply, -exponent)).toLocaleString(undefined, {
maximumFractionDigits: exponent,
})}{' '}
</p>
</div>
</div>
)}
</div>
{!denom.base.includes('umfx') && (
<Formik
Expand Down
39 changes: 6 additions & 33 deletions components/factory/forms/MintForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { TailwindModal } from '@/components/react/modal';

export default function MintForm({
isAdmin,
admin,
denom,
address,
refetch,
Expand All @@ -23,7 +22,6 @@ export default function MintForm({
onMultiMintClick,
}: Readonly<{
isAdmin: boolean;
admin: string;
denom: ExtendedMetadataSDKType;
address: string;
refetch: () => void;
Expand Down Expand Up @@ -104,44 +102,19 @@ export default function MintForm({
</p>
</div>
</div>

<div>
<p className="text-sm font-light text-gray-500 dark:text-gray-400 mb-2">
YOUR BALANCE
<p className="text-sm font-light text-gray-500 truncate dark:text-gray-400 mb-2">
CIRCULATING SUPPLY
</p>
<div className="bg-base-300 p-4 rounded-md">
<p className="font-semibold text-md text-black truncate dark:text-white">
{Number(shiftDigits(balance, -exponent)).toLocaleString(undefined, {
<p className="font-semibold text-md truncate text-black dark:text-white">
{Number(shiftDigits(totalSupply, -exponent)).toLocaleString(undefined, {
maximumFractionDigits: exponent,
})}
})}{' '}
</p>
</div>
</div>
{denom?.denom_units[1]?.exponent && (
<div>
<p className="text-sm font-light text-gray-500 dark:text-gray-400 mb-2">
EXPONENT
</p>
<div className="bg-base-300 p-4 rounded-md">
<p className="font-semibold text-md text-black dark:text-white">
{denom?.denom_units[1]?.exponent}
</p>
</div>
</div>
)}
{totalSupply !== '0' && (
<div>
<p className="text-sm font-light text-gray-500 truncate dark:text-gray-400 mb-2">
CIRCULATING SUPPLY
</p>
<div className="bg-base-300 p-4 rounded-md">
<p className="font-semibold text-md truncate text-black dark:text-white">
{Number(shiftDigits(totalSupply, -exponent)).toLocaleString(undefined, {
maximumFractionDigits: exponent,
})}{' '}
</p>
</div>
</div>
)}
</div>
{!denom.base.includes('umfx') && (
<Formik
Expand Down
2 changes: 0 additions & 2 deletions components/factory/forms/__tests__/BurnForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ describe('BurnForm Component', () => {
test('renders form with correct details', () => {
renderWithProps();
expect(screen.getByText('NAME')).toBeInTheDocument();
expect(screen.getByText("TARGET'S BALANCE")).toBeInTheDocument();
expect(screen.getByText('EXPONENT')).toBeInTheDocument();
expect(screen.getByText('CIRCULATING SUPPLY')).toBeInTheDocument();
});

Expand Down
2 changes: 0 additions & 2 deletions components/factory/forms/__tests__/MintForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ describe('MintForm Component', () => {
test('renders form with correct details', () => {
renderWithProps();
expect(screen.getByText('NAME')).toBeInTheDocument();
expect(screen.getByText('YOUR BALANCE')).toBeInTheDocument();
expect(screen.getByText('EXPONENT')).toBeInTheDocument();
expect(screen.getByText('CIRCULATING SUPPLY')).toBeInTheDocument();
});

Expand Down
1 change: 0 additions & 1 deletion components/factory/modals/MintModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export default function MintModal({
) : (
<MintForm
isAdmin={isAdmin ?? false}
admin={admin}
balance={safeBalance}
totalSupply={safeTotalSupply}
refetch={refetch}
Expand Down