Skip to content

Commit

Permalink
add token state back to token account sections
Browse files Browse the repository at this point in the history
  • Loading branch information
ngundotra committed Oct 10, 2024
1 parent 7a5b9c8 commit 647f0f7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/components/account/TokenAccountSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
TransferHookAccount,
} from '@validators/accounts/token-extension';
import { BigNumber } from 'bignumber.js';
import { capitalCase } from 'change-case';
import { useEffect, useMemo, useState } from 'react';
import { ExternalLink, RefreshCw } from 'react-feather';
import { create } from 'superstruct';
Expand All @@ -59,6 +60,11 @@ const getEthAddress = (link?: string) => {
return address;
};

const StatusBadge = ({ status }: { status: string }) => {
const badgeClass = status === 'initialized' ? 'bg-success-soft' : 'bg-warning-soft';
return <span className={`badge ${badgeClass}`}>{capitalCase(status)}</span>;
};

export function TokenAccountSection({
account,
tokenAccount,
Expand Down Expand Up @@ -465,12 +471,12 @@ function TokenAccountCard({ account, info }: { account: Account; info: TokenAcco
<td>Token balance {typeof symbol === 'string' && `(${symbol})`}</td>
<td className="text-lg-end">{balance}</td>
</tr>
{info.state === 'uninitialized' && (
<tr>
<td>Status</td>
<td className="text-lg-end">Uninitialized</td>
</tr>
)}
<tr>
<td>Status</td>
<td className="text-lg-end">
<StatusBadge status={info.state} />
</td>
</tr>
{info.rentExemptReserve && (
<tr>
<td>Rent-exempt reserve (SOL)</td>
Expand Down

0 comments on commit 647f0f7

Please sign in to comment.