From 9413b3d6f7d1c7b0c04eaae1c85e844e946788fc Mon Sep 17 00:00:00 2001 From: Zainab Wahab Date: Sat, 26 Sep 2026 19:02:32 +0100 Subject: [PATCH] feat: add atomic swap proposal and acceptance UI --- src/components/common/AtomicSwapHistory.tsx | 194 ++++++++ .../common/AtomicSwapProposalForm.tsx | 462 ++++++++++++++++++ .../common/AtomicSwapProposalReview.tsx | 287 +++++++++++ src/hooks/useAtomicSwap.ts | 82 ++++ src/lib/queryKeys.ts | 7 + src/pages/AtomicSwapCreatePage.tsx | 198 ++++++++ src/pages/AtomicSwapProposalPage.tsx | 14 + src/pages/LandingPage.tsx | 13 +- src/pages/ProfilePage.tsx | 32 +- src/routes.tsx | 10 + src/services/atomicSwap.service.ts | 319 ++++++++++++ src/types/atomicSwap.ts | 75 +++ 12 files changed, 1690 insertions(+), 3 deletions(-) create mode 100644 src/components/common/AtomicSwapHistory.tsx create mode 100644 src/components/common/AtomicSwapProposalForm.tsx create mode 100644 src/components/common/AtomicSwapProposalReview.tsx create mode 100644 src/hooks/useAtomicSwap.ts create mode 100644 src/pages/AtomicSwapCreatePage.tsx create mode 100644 src/pages/AtomicSwapProposalPage.tsx create mode 100644 src/services/atomicSwap.service.ts create mode 100644 src/types/atomicSwap.ts diff --git a/src/components/common/AtomicSwapHistory.tsx b/src/components/common/AtomicSwapHistory.tsx new file mode 100644 index 00000000..0887f44b --- /dev/null +++ b/src/components/common/AtomicSwapHistory.tsx @@ -0,0 +1,194 @@ +import React, { useMemo } from 'react'; +import { ArrowLeftRight, ClockIcon } from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import EmptyState from '@/components/common/EmptyState'; +import { cn } from '@/lib/utils'; +import { formatRelativeTime } from '@/utils/time.utils'; +import { formatNumber } from '@/utils/numberFormat.utils'; +import type { SwapHistoryEntry } from '@/types/atomicSwap'; +import { useAtomicSwapHistory } from '@/hooks/useAtomicSwap'; + +// ─── helpers ────────────────────────────────────────────────────────────────── + +function SwapTypePill() { + return ( + + + ); +} + +// ─── skeleton loader ─────────────────────────────────────────────────────────── + +function SkeletonRow() { + return ( +