|
|
@@ -4,7 +4,7 @@
|
|
|
import cprIcon from '$lib/assets/icons/sidebar/cpr.svg?raw';
|
|
|
import commoditiesIcon from '$lib/assets/icons/sidebar/commodities.svg?raw';
|
|
|
import tokensIcon from '$lib/assets/icons/sidebar/tokens.svg?raw';
|
|
|
- import bankIcon from '$lib/assets/icons/sidebar/bank.svg?raw';
|
|
|
+ import walletIcon from '$lib/assets/icons/sidebar/wallet.svg?raw';
|
|
|
import operationsIcon from '$lib/assets/icons/sidebar/operations.svg?raw';
|
|
|
import marketplaceIcon from '$lib/assets/icons/sidebar/marketplace.svg?raw';
|
|
|
import reportsIcon from '$lib/assets/icons/sidebar/reports.svg?raw';
|
|
|
@@ -12,12 +12,13 @@
|
|
|
import settingsIcon from '$lib/assets/icons/sidebar/settings.svg?raw';
|
|
|
import logo from '$lib/assets/logo2.png';
|
|
|
import { onMount } from 'svelte';
|
|
|
+ import { easyCoinBalance } from '$lib/utils/stores.js';
|
|
|
|
|
|
const navItems = [
|
|
|
{ id: 'dashboard', href: '/dashboard', label: 'Início', icon: dashboardIcon },
|
|
|
{ id: 'cpr', href: '/cpr', label: 'CPR', icon: cprIcon },
|
|
|
{ id: 'commodities', href: '/commodities', label: 'Commodities', icon: commoditiesIcon },
|
|
|
- { id: 'bank', href: '/bank', label: 'Bank', icon: bankIcon },
|
|
|
+ { id: 'wallet', href: '/wallet', label: 'wallet', icon: walletIcon },
|
|
|
{ id: 'trading', href: '/trading', label: 'Trading', icon: operationsIcon },
|
|
|
{ id: 'marketplace', href: '/marketplace', label: 'Marketplace', icon: marketplaceIcon },
|
|
|
{ id: 'reports', href: '/reports', label: 'Relatórios', icon: reportsIcon },
|
|
|
@@ -49,6 +50,9 @@
|
|
|
window.addEventListener('resize', onResize);
|
|
|
return () => window.removeEventListener('resize', onResize);
|
|
|
});
|
|
|
+ function formatCoin(n) {
|
|
|
+ return new Intl.NumberFormat('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(Number(n || 0));
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<!-- Botão de toggle (só mobile) -->
|
|
|
@@ -70,26 +74,38 @@
|
|
|
{/if}
|
|
|
</button>
|
|
|
|
|
|
-<aside class="w-64 bg-white dark:bg-gray-900 border-r border-gray-200 dark:border-gray-700 fixed h-full overflow-auto transform transition-transform duration-200 ease-in-out z-40 {isOpen ? 'translate-x-0' : '-translate-x-full'} md:translate-x-0">
|
|
|
+<aside class="w-64 bg-white dark:bg-gray-900 border-r border-gray-200 dark:border-gray-700 fixed h-full transform transition-transform duration-200 ease-in-out z-40 {isOpen ? 'translate-x-0' : '-translate-x-full'} md:translate-x-0 flex flex-col">
|
|
|
<div class="p-5 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 flex items-center">
|
|
|
<img src={logo} alt="TooEasy Commodities" class="w-24">
|
|
|
<h1 class="text-lg font-semibold text-gray-800 dark:text-gray-100 ml-2">TooEasy Commodities</h1>
|
|
|
<!-- Fechar removido: o botão fixo acima faz o toggle no mobile -->
|
|
|
</div>
|
|
|
- <ul class="mt-4">
|
|
|
- {#each navItems as item}
|
|
|
- <li>
|
|
|
- <a
|
|
|
- href={item.href}
|
|
|
- on:click={closeSidebar}
|
|
|
- class="flex items-center w-full px-4 py-2 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white font-medium border-l-4 {$page.url.pathname.startsWith(item.href) ? 'border-blue-500 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white' : 'border-transparent'}"
|
|
|
- >
|
|
|
- <span class="mr-3 [&>svg]:w-5 [&>svg]:h-5 {$page.url.pathname.startsWith(item.href) ? 'text-blue-500' : 'text-gray-500 dark:text-gray-400'}">{@html item.icon}</span>
|
|
|
- {item.label}
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- {/each}
|
|
|
- </ul>
|
|
|
+ <div class="flex-1 overflow-auto">
|
|
|
+ <ul class="mt-4">
|
|
|
+ {#each navItems as item}
|
|
|
+ <li>
|
|
|
+ <a
|
|
|
+ href={item.href}
|
|
|
+ on:click={closeSidebar}
|
|
|
+ class="flex items-center w-full px-4 py-2 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white font-medium border-l-4 {$page.url.pathname.startsWith(item.href) ? 'border-blue-500 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white' : 'border-transparent'}"
|
|
|
+ >
|
|
|
+ <span class="mr-3 [&>svg]:w-5 [&>svg]:h-5 {$page.url.pathname.startsWith(item.href) ? 'text-blue-500' : 'text-gray-500 dark:text-gray-400'}">{@html item.icon}</span>
|
|
|
+ {item.label}
|
|
|
+ </a>
|
|
|
+ </li>
|
|
|
+ {/each}
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="bg-white dark:bg-gray-900 border rounded-md border-gray-200 dark:border-gray-700 m-2">
|
|
|
+ <div class="flex items-center justify-between text-sm p-3">
|
|
|
+ <div class="flex items-center gap-1.5 text-gray-700 dark:text-gray-200">
|
|
|
+ <span class="[&>svg]:w-4 [&>svg]:h-4 text-gray-500 dark:text-gray-400">{@html walletIcon}</span>
|
|
|
+ <span>EasyCoins</span>
|
|
|
+ </div>
|
|
|
+ <div class="font-medium text-gray-900 dark:text-gray-100">{formatCoin($easyCoinBalance)}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</aside>
|
|
|
|
|
|
{#if isOpen}
|