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

Add token state back to token account sections #387

Merged
merged 1 commit into from
Oct 10, 2024
Merged
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
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
Loading