feat: add CoinIcon component for displaying cryptocurrency icons
feat: implement TradeModal for buying and selling coins with validation and transaction handling feat: create server-side trade API for executing buy/sell transactions and updating user balances feat: add transactions API to fetch user transaction history feat: implement portfolio page to display user's holdings and recent transactions
This commit is contained in:
parent
0784e0f3d3
commit
a278d0c6a5
13 changed files with 1342 additions and 210 deletions
33
website/src/lib/components/self/CoinIcon.svelte
Normal file
33
website/src/lib/components/self/CoinIcon.svelte
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<script lang="ts">
|
||||
import { getPublicUrl } from '$lib/utils';
|
||||
|
||||
let {
|
||||
icon,
|
||||
symbol,
|
||||
name = symbol,
|
||||
size = 6,
|
||||
class: className = ''
|
||||
} = $props<{
|
||||
icon?: string | null;
|
||||
symbol: string;
|
||||
name?: string;
|
||||
size?: number;
|
||||
class?: string;
|
||||
}>();
|
||||
|
||||
let sizeClass = $derived(`h-${size} w-${size}`);
|
||||
</script>
|
||||
|
||||
{#if icon}
|
||||
<img
|
||||
src={getPublicUrl(icon)}
|
||||
alt={name}
|
||||
class="{sizeClass} rounded-full object-cover {className}"
|
||||
/>
|
||||
{:else}
|
||||
<div
|
||||
class="{sizeClass} bg-primary flex items-center justify-center overflow-hidden rounded-full {className}"
|
||||
>
|
||||
<span class="text-xs font-bold text-white">{symbol.slice(0, 2)}</span>
|
||||
</div>
|
||||
{/if}
|
||||
Reference in a new issue