Skip to content

Commit 7c22c2f

Browse files
authored
Merge pull request #90 from bitsnark/fix/ui-4
Fix/UI 4
2 parents 885ad8e + 9579d70 commit 7c22c2f

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

src/components/history-table/transactions-table.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { TransactionTrackerDialog } from '../transaction-tracker';
2525
import { useState } from 'react';
2626
import { useTransactions } from '@/hooks/useTransactions';
2727
import { TransactionNormalized } from './transaction-history-adapter';
28+
import { useSupportedChains } from '@/hooks/useSupportedChains';
2829

2930
/**
3031
* Transactions history table component
@@ -44,10 +45,13 @@ export default function TransactionsTable() {
4445
txHash: string;
4546
} | null>(null);
4647
const [openTrackerDialog, setOpenTrackerDialog] = useState(false);
48+
const { isSupported } = useSupportedChains();
4749

4850
const isWalletConnected = address !== undefined;
4951

5052
const renderContent = () => {
53+
if (!isSupported) return null;
54+
5155
// Render mobile view
5256
if (isMobile) {
5357
return (
@@ -60,7 +64,11 @@ export default function TransactionsTable() {
6064
<MobileLoadingSkeleton />
6165
</div>
6266
) : transactions?.length > 0 ? (
63-
<Accordion type="single" collapsible className="flex flex-col gap-3">
67+
<Accordion
68+
type="single"
69+
collapsible
70+
className="flex flex-col gap-3"
71+
>
6472
{transactions.map((tx: TransactionNormalized, index) => (
6573
<MobileTransactionItem
6674
key={tx.contractRegistrationTxHash}

src/components/ui/status-icon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function StatusIcon({ status, className = '' }: StatusIconProps) {
5050
break;
5151
case ReservationStatus.Expired:
5252
return (
53-
<div className={`bg-[#FF5353] rounded-full p-[0.125rem] ${className}`}>
53+
<div className={`bg-grey rounded-full p-[0.125rem] ${className}`}>
5454
<img src={expiredIcon} alt="Expired" className="w-3.5 h-3.5" />
5555
</div>
5656
);

src/test/components/history-table/transactions-table.test.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { vi, describe, it, expect, beforeEach } from 'vitest';
66
import { Mock } from 'vitest';
77
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
88
import { useWindowSize } from '@/components/history-table/utils';
9+
import { useSupportedChains } from '@/hooks/useSupportedChains';
910

1011
// Mock ContractManager
1112
vi.mock('@/services/ContractManager', () => ({
@@ -32,6 +33,13 @@ vi.mock('@/hooks/useTransactions', () => ({
3233
useTransactions: vi.fn(),
3334
}));
3435

36+
// Mock useSupportedChains
37+
vi.mock('@/hooks/useSupportedChains', () => ({
38+
useSupportedChains: vi.fn(() => ({
39+
isSupported: true,
40+
})),
41+
}));
42+
3543
// Mock window size hook and utils
3644
vi.mock('@/components/history-table/utils', () => ({
3745
useWindowSize: vi.fn(),
@@ -78,6 +86,19 @@ describe('TransactionsTable', () => {
7886
beforeEach(() => {
7987
vi.clearAllMocks();
8088
(useWindowSize as Mock).mockReturnValue({ width: 1024 }); // Default to desktop
89+
(useSupportedChains as Mock).mockReturnValue({ isSupported: true }); // Default to supported chain
90+
});
91+
92+
it('returns null when chain is not supported', async () => {
93+
(useSupportedChains as Mock).mockReturnValue({ isSupported: false });
94+
(useAccount as Mock).mockReturnValue({ address: '0x123' } as UseAccountReturn);
95+
(useTransactions as Mock).mockReturnValue({
96+
data: [],
97+
isLoading: false
98+
} as UseTransactionsReturn);
99+
100+
const { container } = render(<TransactionsTable />, { wrapper });
101+
expect(container.firstChild).toBeNull();
81102
});
82103

83104
it('shows wallet not connected state when no wallet is connected', async () => {

0 commit comments

Comments
 (0)