From c5bdcfca8caf8c5a5c97364a7c7e56a561fa17f1 Mon Sep 17 00:00:00 2001 From: ghzhost Date: Thu, 3 Sep 2026 01:42:21 +0000 Subject: [PATCH] fix(history): remove orphaned TransactionHistory component tree and hook (#20) - Remove dead components (index, TransactionItem, Pagination, EmptyState) and tests. - Remove orphaned . - The canonical transaction history feature is actively implemented by backed by and in . --- .../TransactionHistory/EmptyState.tsx | 10 ---------- .../TransactionHistory/Pagination.test.tsx | 13 ------------- .../TransactionHistory/Pagination.tsx | 11 ----------- .../TransactionHistory/TransactionItem.tsx | 17 ----------------- src/components/TransactionHistory/index.tsx | 12 ------------ src/hooks/useTransactionHistory.ts | 17 ----------------- 6 files changed, 80 deletions(-) delete mode 100644 src/components/TransactionHistory/EmptyState.tsx delete mode 100644 src/components/TransactionHistory/Pagination.test.tsx delete mode 100644 src/components/TransactionHistory/Pagination.tsx delete mode 100644 src/components/TransactionHistory/TransactionItem.tsx delete mode 100644 src/components/TransactionHistory/index.tsx delete mode 100644 src/hooks/useTransactionHistory.ts diff --git a/src/components/TransactionHistory/EmptyState.tsx b/src/components/TransactionHistory/EmptyState.tsx deleted file mode 100644 index 81b0a3b..0000000 --- a/src/components/TransactionHistory/EmptyState.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from "react" -export function EmptyState() { - return ( -
- 📭 -

No transactions yet

-

Your payment history will appear here

-
- ) -} diff --git a/src/components/TransactionHistory/Pagination.test.tsx b/src/components/TransactionHistory/Pagination.test.tsx deleted file mode 100644 index fe76ac3..0000000 --- a/src/components/TransactionHistory/Pagination.test.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { render, screen } from "@testing-library/react" -import { describe, it, expect, vi } from "vitest" -import { Pagination } from "./Pagination" -describe("Pagination", () => { - it("disables prev on page 1", () => { - render() - expect(screen.getByText("← Prev")).toBeDisabled() - }) - it("disables next when no more pages", () => { - render() - expect(screen.getByText("Next →")).toBeDisabled() - }) -}) diff --git a/src/components/TransactionHistory/Pagination.tsx b/src/components/TransactionHistory/Pagination.tsx deleted file mode 100644 index da90ce2..0000000 --- a/src/components/TransactionHistory/Pagination.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from "react" -interface Props { page: number; hasMore: boolean; onNext: () => void; onPrev: () => void } -export function Pagination({ page, hasMore, onNext, onPrev }: Props) { - return ( -
- - Page {page} - -
- ) -} diff --git a/src/components/TransactionHistory/TransactionItem.tsx b/src/components/TransactionHistory/TransactionItem.tsx deleted file mode 100644 index cfa0b46..0000000 --- a/src/components/TransactionHistory/TransactionItem.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react' -interface Props { tx: Record; myAddress: string } -export function TransactionItem({ tx, myAddress }: Props) { - const isSent = tx.from === myAddress - return ( -
-
- {isSent ? '↑' : '↓'} -
-

{isSent ? 'To ' : 'From '}{String(isSent ? tx.to : tx.from).slice(0,8)}…

-

{String(tx.created_at)}

-
-
-

{isSent ? '-' : '+'}{String(tx.amount)} XLM

-
- ) -} diff --git a/src/components/TransactionHistory/index.tsx b/src/components/TransactionHistory/index.tsx deleted file mode 100644 index e8e1c01..0000000 --- a/src/components/TransactionHistory/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import { useTransactionHistory } from '../../hooks/useTransactionHistory' -import { TransactionItem } from './TransactionItem' -interface Props { address: string | null } -export function TransactionHistory({ address }: Props) { - const { transactions, loading, error } = useTransactionHistory(address) - if (!address) return

Connect wallet to view history

- if (loading) return

Loading…

- if (error) return

Error: {error}

- if (!transactions.length) return

No transactions yet

- return
{transactions.map((tx, i) => } myAddress={address} />)}
-} diff --git a/src/hooks/useTransactionHistory.ts b/src/hooks/useTransactionHistory.ts deleted file mode 100644 index f68208f..0000000 --- a/src/hooks/useTransactionHistory.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useState, useEffect, useCallback } from 'react' -export function useTransactionHistory(address: string | null) { - const [transactions, setTransactions] = useState([]) - const [loading, setLoading] = useState(false) - const [error, setError] = useState(null) - const fetchTxs = useCallback(async () => { - if (!address) return - setLoading(true) - try { - const r = await fetch('https://horizon.stellar.org/accounts/' + address + '/payments?order=desc&limit=20') - const d = await r.json() - setTransactions(d._embedded?.records ?? []) - } catch (e) { setError((e as Error).message) } finally { setLoading(false) } - }, [address]) - useEffect(() => { fetchTxs() }, [fetchTxs]) - return { transactions, loading, error, refresh: fetchTxs } -}