website refactor
This commit is contained in:
@@ -9,21 +9,21 @@ import { ArrowDownLeft, ArrowUpRight, History, Wallet } from 'lucide-react';
|
||||
|
||||
interface Transaction {
|
||||
id: string;
|
||||
type: 'credit' | 'debit';
|
||||
amount: number;
|
||||
type: 'deposit' | 'withdrawal' | 'sponsorship' | 'prize';
|
||||
formattedAmount: string;
|
||||
description: string;
|
||||
date: string;
|
||||
formattedDate: string;
|
||||
}
|
||||
|
||||
interface WalletSummaryPanelProps {
|
||||
balance: number;
|
||||
formattedBalance: string;
|
||||
currency: string;
|
||||
transactions: Transaction[];
|
||||
onDeposit: () => void;
|
||||
onWithdraw: () => void;
|
||||
}
|
||||
|
||||
export function WalletSummaryPanel({ balance, currency, transactions, onDeposit, onWithdraw }: WalletSummaryPanelProps) {
|
||||
export function WalletSummaryPanel({ formattedBalance, currency, transactions, onDeposit, onWithdraw }: WalletSummaryPanelProps) {
|
||||
return (
|
||||
<Stack gap={6}>
|
||||
<Surface variant="dark" border rounded="lg" padding={8} position="relative" overflow="hidden">
|
||||
@@ -48,7 +48,7 @@ export function WalletSummaryPanel({ balance, currency, transactions, onDeposit,
|
||||
</Stack>
|
||||
<Stack direction="row" align="baseline" gap={2}>
|
||||
<Text size="4xl" weight="bold" color="text-white">
|
||||
{balance.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
{formattedBalance}
|
||||
</Text>
|
||||
<Text size="xl" weight="medium" color="text-gray-500">{currency}</Text>
|
||||
</Stack>
|
||||
@@ -87,37 +87,40 @@ export function WalletSummaryPanel({ balance, currency, transactions, onDeposit,
|
||||
<Text color="text-gray-500">No recent transactions.</Text>
|
||||
</Stack>
|
||||
) : (
|
||||
transactions.map((tx) => (
|
||||
<Stack key={tx.id} p={4} borderBottom borderColor="border-charcoal-outline" hoverBg="bg-white/5" transition>
|
||||
<Stack direction="row" justify="between" align="center">
|
||||
<Stack direction="row" align="center" gap={4}>
|
||||
<Stack
|
||||
center
|
||||
w={10}
|
||||
h={10}
|
||||
rounded="full"
|
||||
bg={tx.type === 'credit' ? 'bg-performance-green/10' : 'bg-error-red/10'}
|
||||
transactions.map((tx) => {
|
||||
const isCredit = tx.type === 'deposit' || tx.type === 'sponsorship';
|
||||
return (
|
||||
<Stack key={tx.id} p={4} borderBottom borderColor="border-charcoal-outline" hoverBg="bg-white/5" transition>
|
||||
<Stack direction="row" justify="between" align="center">
|
||||
<Stack direction="row" align="center" gap={4}>
|
||||
<Stack
|
||||
center
|
||||
w={10}
|
||||
h={10}
|
||||
rounded="full"
|
||||
bg={isCredit ? 'bg-performance-green/10' : 'bg-error-red/10'}
|
||||
>
|
||||
<Icon
|
||||
icon={isCredit ? ArrowDownLeft : ArrowUpRight}
|
||||
size={4}
|
||||
color={isCredit ? 'text-performance-green' : 'text-error-red'}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack gap={0.5}>
|
||||
<Text weight="medium" color="text-white">{tx.description}</Text>
|
||||
<Text size="xs" color="text-gray-500">{tx.formattedDate}</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
<Text
|
||||
weight="bold"
|
||||
color={isCredit ? 'text-performance-green' : 'text-white'}
|
||||
>
|
||||
<Icon
|
||||
icon={tx.type === 'credit' ? ArrowDownLeft : ArrowUpRight}
|
||||
size={4}
|
||||
color={tx.type === 'credit' ? 'text-performance-green' : 'text-error-red'}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack gap={0.5}>
|
||||
<Text weight="medium" color="text-white">{tx.description}</Text>
|
||||
<Text size="xs" color="text-gray-500">{new Date(tx.date).toLocaleDateString()}</Text>
|
||||
</Stack>
|
||||
{tx.formattedAmount}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Text
|
||||
weight="bold"
|
||||
color={tx.type === 'credit' ? 'text-performance-green' : 'text-white'}
|
||||
>
|
||||
{tx.type === 'credit' ? '+' : '-'}{tx.amount.toFixed(2)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
))
|
||||
);
|
||||
})
|
||||
)}
|
||||
</Stack>
|
||||
</Surface>
|
||||
|
||||
Reference in New Issue
Block a user