forked from MergeFi/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestList.tsx
More file actions
51 lines (45 loc) · 1.63 KB
/
Copy pathRequestList.tsx
File metadata and controls
51 lines (45 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react'
import { FileText } from 'lucide-react'
import { Card, CardHeader, CardTitle } from '@/components/ui/Card'
import { Skeleton } from '@/components/common/Skeleton'
import { NetworkError } from '@/components/common/NetworkError'
import { RequestItem } from './RequestItem'
import type { PaymentRequest } from '@/types'
interface RequestListProps {
requests: PaymentRequest[] | undefined
isLoading: boolean
isError: boolean
onRetry: () => void
}
export function RequestList({ requests, isLoading, isError, onRetry }: RequestListProps) {
return (
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<FileText size={18} className="text-stellar-400" />
Your Payment Requests
</CardTitle>
</CardHeader>
{isLoading && <Skeleton rows={3} className="h-14 w-full" />}
{!isLoading && isError && (
<NetworkError onRetry={onRetry} message="Failed to load payment requests" />
)}
{!isLoading && !isError && (!requests || requests.length === 0) && (
<div className="text-center py-10">
<FileText size={28} className="text-slate-600 mx-auto mb-3" />
<p className="text-sm font-medium text-slate-300">No payment requests yet</p>
<p className="text-xs text-slate-500 mt-1">
Create a request above to get a shareable link and QR code.
</p>
</div>
)}
{!isLoading && !isError && requests && requests.length > 0 && (
<div>
{requests.map((r) => (
<RequestItem key={r.id} request={r} />
))}
</div>
)}
</Card>
)
}