mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 08:47:23 +00:00
updated transactions look
This commit is contained in:
1 parent
6162217ce9
commit
56bdebff5d
1 file changed
+20
-38
@@ -1,5 +1,3 @@
|
|||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
|
||||||
import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, ChevronDown, ChevronUp, Coins } from 'lucide-react';
|
import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, ChevronDown, ChevronUp, Coins } from 'lucide-react';
|
||||||
import type { HistoryEntry } from 'coco-cashu-core';
|
import type { HistoryEntry } from 'coco-cashu-core';
|
||||||
|
|
||||||
@@ -52,52 +50,35 @@ export function TransactionHistory({ entries, isLoading, isExpanded, setIsExpand
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (entries.length === 0 && !isLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="mt-6 border-0 shadow-none">
|
<div className="mt-6">
|
||||||
<CardHeader>
|
{/* Collapsible Section Header */}
|
||||||
<CardTitle className="flex items-center justify-between">
|
<button
|
||||||
<div className="flex items-center">
|
|
||||||
<History className="h-5 w-5 mr-2" />
|
|
||||||
Transaction History
|
|
||||||
</div>
|
|
||||||
{entries.length > 3 && (
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setIsExpanded(!isExpanded)}
|
onClick={() => setIsExpanded(!isExpanded)}
|
||||||
className="gap-1"
|
className="w-full py-2 px-4 flex justify-center border-t border-muted hover:bg-muted/30 transition-colors"
|
||||||
>
|
>
|
||||||
{isExpanded ? (
|
{isExpanded ? (
|
||||||
<>
|
<ChevronUp className="h-5 w-5 text-muted-foreground" />
|
||||||
<ChevronUp className="h-4 w-4" />
|
|
||||||
Hide
|
|
||||||
</>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<ChevronDown className="h-5 w-5 text-muted-foreground" />
|
||||||
<ChevronDown className="h-4 w-4" />
|
|
||||||
Show
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</Button>
|
</button>
|
||||||
)}
|
|
||||||
</CardTitle>
|
{/* Transactions List - Only shown when expanded */}
|
||||||
<CardDescription>
|
{isExpanded && (
|
||||||
View your recent transactions
|
<div className="mt-4 space-y-2">
|
||||||
</CardDescription>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent>
|
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="flex items-center justify-center py-8">
|
<div className="flex items-center justify-center py-8">
|
||||||
<Loader2 className="h-6 w-6 animate-spin mr-2" />
|
<Loader2 className="h-6 w-6 animate-spin mr-2" />
|
||||||
<span>Loading history...</span>
|
<span>Loading history...</span>
|
||||||
</div>
|
</div>
|
||||||
) : entries.length === 0 ? (
|
|
||||||
<div className="text-center py-8 text-muted-foreground">
|
|
||||||
No transaction history yet
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-2">
|
<>
|
||||||
{(isExpanded ? entries : entries.slice(0, 3)).map((entry) => (
|
{entries.map((entry) => (
|
||||||
<div
|
<div
|
||||||
key={entry.id}
|
key={entry.id}
|
||||||
className="rounded-lg p-4 hover:bg-muted/50 transition-colors"
|
className="rounded-lg p-4 hover:bg-muted/50 transition-colors"
|
||||||
@@ -140,9 +121,10 @@ export function TransactionHistory({ entries, isLoading, isExpanded, setIsExpand
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</div>
|
||||||
</Card>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user