Spaces:
Running
Running
<!DOCTYPE html> <html lang="en"> <head> <title>TradePulse: Online Brokerage</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta charset="utf-8" /> <meta name="description" content="Trade stocks, ETFs, and crypto with TradePulse's online brokerage platform" /> <script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.min.js"></script> <style> input:focus { outline: 2px solid #1d4ed8; } .error { border-color: #ef4444; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .fade-in { animation: fadeIn 0.5s ease-in; } .autocomplete-suggestions { position: absolute; background: white; border: 1px solid #d1d5db; max-height: 150px; overflow-y: auto; width: 100%; z-index: 10; } .autocomplete-suggestions div { padding: 8px; cursor: pointer; } .autocomplete-suggestions div:hover { background: #f3f4f6; } </style> </head> <body class="flex flex-col min-h-screen bg-gray-100 font-sans transition-colors duration-300" id="theme-body"> <!-- Header --> <header class="bg-blue-800 text-white py-4 shadow-md"> <div class="container mx-auto px-6 flex justify-between items-center"> <h1 class="text-xl font-bold">TradePulse</h1> <nav class="flex items-center space-x-4"> <a href="#home" class="hover:underline">Home</a> <a href="#dashboard" class="hover:underline">Dashboard</a> <a href="#trade" class="hover:underline">Trade</a> <button id="theme-toggle" class="bg-blue-600 px-4 py-2 rounded-md hover:bg-blue-700">Dark Mode</button> <button class="bg-blue-600 px-4 py-2 rounded-md hover:bg-blue-700">Login</button> </nav> </div> </header> <!-- Hero Section --> <section id="home" class="bg-blue-50 py-12 text-center"> <div class="container mx-auto px-6"> <span class="text-xs rounded-full mb-2 inline-block px-2 py-1 border border-blue-500/15 bg-blue-500/15 text-blue-500">🔥 Start Investing Today</span> <h2 class="text-3xl lg:text-5xl font-bold text-gray-800"> <span class="text-xl lg:text-3xl text-gray-400 block font-medium">Your Wealth, Your Way,</span> Trade with TradePulse. </h2> <p class="mt-4 text-gray-600 max-w-2xl mx-auto">Buy and sell stocks, ETFs, and cryptocurrencies with zero commissions and real-time insights.</p> <button onclick="alert('Please verify your identity to start trading.')" class="mt-6 bg-blue-600 text-white px-6 py-3 rounded-md hover:bg-blue-700">Get Started</button> </div> <img src="https://enzostvs-deepsite.hf.space/arrow.svg" alt="Decorative arrow" class="absolute bottom-8 left-0 w-[100px] transform rotate-[30deg]" /> </section> <!-- Dashboard Section --> <section id="dashboard" class="py-12 bg-white"> <div class="container mx-auto px-6"> <h3 class="text-2xl font-bold text-gray-800 text-center">Your Dashboard</h3> <div class="mt-6 grid grid-cols-1 lg:grid-cols-3 gap-6"> <!-- Portfolio Overview --> <div class="bg-gray-50 p-6 rounded-lg shadow-md"> <h4 class="text-lg font-semibold text-gray-700">Portfolio Value</h4> <p class="text-3xl font-bold text-blue-600 mt-2">$12,345.67</p> <p class="text-sm text-gray-500">+2.3% ($280.45) today</p> <canvas id="portfolio-chart" class="mt-4" aria-label="Portfolio allocation chart"></canvas> </div> <!-- Watchlist --> <div class="bg-gray-50 p-6 rounded-lg shadow-md"> <h4 class="text-lg font-semibold text-gray-700">Watchlist</h4> <ul class="mt-4 space-y-2"> <li class="flex justify-between text-sm"> <span>Apple (AAPL)</span> <span class="text-blue-600">+1.2% ($235.40)</span> </li> <li class="flex justify-between text-sm"> <span>Tesla (TSLA)</span> <span class="text-red-600">-0.8% ($420.15)</span> </li> <li class="flex justify-between text-sm"> <span>Bitcoin (BTC)</span> <span class="text-blue-600">+3.5% ($65,200.00)</span> </li> </ul> </div> <!-- Market News --> <div class="bg-gray-50 p-6 rounded-lg shadow-md"> <h4 class="text-lg font-semibold text-gray-700">Market News</h4> <ul class="mt-4 space-y-2 text-sm text-gray-600"> <li>Tech stocks rally as AI demand surges.</li> <li>Fed signals steady interest rates for 2025.</li> <li>Bitcoin hits new high amid ETF approvals.</li> </ul> </div> </div> <p class="mt-4 text-center text-sm text-gray-500">Available Cash: <span class="font-medium">$5,000.00</span></p> </div> </section> <!-- Trade Section --> <section id="trade" class="py-12 bg-gray-100"> <div class="container mx-auto px-6"> <h3 class="text-2xl font-bold text-gray-800 text-center">Trade Assets</h3> <form id="trade-form" class="mt-6 max-w-md mx-auto bg-white p-6 rounded-lg shadow-md relative" novalidate> <div class="mb-4"> <label for="asset-search" class="block text-sm font-medium text-gray-700">Search Asset <span title="Enter stock or crypto ticker" class="text-blue-500 cursor-help">ℹ️</span></label> <input id="asset-search" type="text" placeholder="e.g., AAPL, Bitcoin" class="w-full p-2 border border-gray-300 rounded-md" aria-describedby="asset-error" autocomplete="off" /> <div id="autocomplete-suggestions" class="autocomplete-suggestions hidden"></div> <p id="asset-error" class="text-sm text-red-500 hidden"></p> </div> <div class="mb-4"> <label for="quantity" class="block text-sm font-medium text-gray-700">Quantity</label> <input id="quantity" type="number" step="1" min="1" placeholder="e.g., 10" class="w-full p-2 border border-gray-300 rounded-md" aria-describedby="quantity-error" required /> <p id="quantity-error" class="text-sm text-red-500 hidden"></p> </div> <div class="mb-4"> <label for="order-type" class="block text-sm font-medium text-gray-700">Order Type</label> <select id="order-type" class="w-full p-2 border border-gray-300 rounded-md"> <option value="buy">Buy</option> <option value="sell">Sell</option> </select> </div> <button type="submit" class="w-full bg-blue-600 text-white p-2 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500" > Place Order </button> </form> <p id="trade-result" class="mt-4 text-center text-lg text-gray-700 fade-in" role="alert"></p> </div> </section> <!-- Footer --> <footer class="bg-blue-800 text-white py-4 mt-auto"> <div class="container mx-auto px-6 text-center"> <p class="text-sm">TradePulse is a demo brokerage platform for educational purposes. Investing involves risks, including loss of principal. Consult a financial advisor.</p> <p class="text-sm mt-2">© 2025 TradePulse. All rights reserved.</p> </div> </footer> <!-- JavaScript --> <scriptPILOTscript> // DOM Elements const tradeForm = document.getElementById('trade-form'); const inputs = { asset: document.getElementById('asset-search'), quantity: document.getElementById('quantity'), }; const errors = { asset: document.getElementById('asset-error'), quantity: document.getElementById('quantity-error'), }; const orderType = document.getElementById('order-type'); const tradeResult = document.getElementById('trade-result'); const suggestions = document.getElementById('autocomplete-suggestions'); const themeToggle body = document.getElementById('theme-body'); const themeToggle = document.getElementById('theme-toggle'); let chartInstance = null; // Mock asset data const assets = [ { ticker: 'aapl', name: 'Apple', price: 235.4 }, { ticker: 'tsla', name: 'Tesla', price: 420.15 }, { ticker: 'btc', name: 'Bitcoin', price: 65200.0 }, { ticker: 'spy', name: 'SPDR S&P 500 ETF', price: 550.2 }, ]; // Input validation function validateInput(id, value) { if (id === 'asset') { const asset = value.toLowerCase().trim(); return !asset || !assets.some(a => a.ticker === asset) ? 'Please enter a valid asset (e.g., AAPL, TSLA, BTC, SPY).' : ''; } if (!value || value <= 0) { return 'Please enter a positive number.'; } return ''; } // Update error display function updateError(id, message) { errors[id].textContent = message; errors[id].classList.toggle('hidden', !message); inputs[id].classList.toggle('error', !!message); } // Simulate trade function simulateTrade(asset, quantity, type) { try { const assetData = assets.find(a => a.ticker === asset.toLowerCase()); if (!assetData) throw new Error('Unknown asset.'); const total = (assetData.price * quantity).toFixed(2); return `Order placed: ${type.toUpperCase()} ${quantity} ${assetData.name} (${asset.toUpperCase()}) for $${total}`; } catch (error) { console.error('Trade error:', error); return null; } } // Autocomplete suggestions function showSuggestions(value) { suggestions.innerHTML = ''; if (!value) { suggestions.classList.add('hidden'); return; } const matches = assets.filter(a => a.ticker.includes(value.toLowerCase()) || a.name.toLowerCase().includes(value.toLowerCase())); if (matches.length === 0) { suggestions.classList.add('hidden'); return; } matches.forEach(asset => { const div = document.createElement('div'); div.textContent = `${asset.name} (${asset.ticker.toUpperCase()})`; div.onclick = () => { inputs.asset.value = asset.ticker; suggestions.classList.add('hidden'); updateError('asset', validateInput('asset', asset.ticker)); }; suggestions.appendChild(div); }); suggestions.classList.remove('hidden'); } // Render portfolio chart function renderPortfolioChart() { if (chartInstance) chartInstance.destroy(); new Chart(document.getElementById('portfolio-chart'), { type: 'pie', data: { labels: ['Stocks', 'ETFs', 'Crypto'], datasets: [{ data: [8500, 3200, 645.67], backgroundColor: ['#1d4ed8', '#3b82f6', '#93c5fd'], }], }, options: { responsive: true, plugins: { legend: { position: 'bottom' } }, }, }); } // Theme toggle let isDark = localStorage.getItem('theme') === 'dark'; function updateTheme() { body.classList.toggle('dark', isDark); body.classList.toggle('bg-gray-100', !isDark); body.classList.toggle('bg-gray-900', isDark); themeToggle.textContent = isDark ? 'Light Mode' : 'Dark Mode'; localStorage.setItem('theme', isDark ? 'dark' : 'light'); } updateTheme(); themeToggle.addEventListener('click', () => { isDark = !isDark; updateTheme(); }); // Form submission tradeForm.addEventListener('submit', (event) => { event.preventDefault(); const asset = inputs.asset.value; const quantity = parseFloat(inputs.quantity.value); const type = orderType.value; const assetError = validateInput('asset', asset); const quantityError = validateInput('quantity', quantity); updateError('asset', assetError); updateError('quantity', quantityError); if (!assetError && !quantityError) { const result = simulateTrade(asset, quantity, type); if (result) { tradeResult.textContent = result; tradeResult.classList.add('text-gray-700', 'fade-in'); suggestions.classList.add('hidden'); } else { tradeResult.textContent = 'Error placing order. Please try again.'; tradeResult.classList.add('text-red-500'); } } else { tradeResult.textContent = ''; } }); // Real-time validation and autocomplete const debounce = (fn, delay) => { let timeout; return (...args) => { clearTimeout(timeout); timeout = setTimeout(() => fn(...args), delay); }; }; inputs.asset.addEventListener('input', debounce(() => { const value = inputs.asset.value; updateError('asset', validateInput('asset', value)); showSuggestions(value); }, 300)); inputs.quantity.addEventListener('input', debounce(() => { const value = parseFloat(inputs.quantity.value); updateError('quantity', validateInput('quantity', value)); }, 300)); // Initialize chart renderPortfolioChart(); </script> </body> </html> - Initial Deployment
Browse files- README.md +7 -5
- index.html +950 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: first-project
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,950 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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" />
|
| 6 |
+
<meta charset="utf-8" />
|
| 7 |
+
<meta name="description" content="Trade stocks, ETFs, and crypto with TradePulse's online brokerage platform" />
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.min.js"></script>
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
|
| 11 |
+
<style>
|
| 12 |
+
input:focus {
|
| 13 |
+
outline: 2px solid #1d4ed8;
|
| 14 |
+
}
|
| 15 |
+
.error {
|
| 16 |
+
border-color: #ef4444;
|
| 17 |
+
}
|
| 18 |
+
@keyframes fadeIn {
|
| 19 |
+
from { opacity: 0; }
|
| 20 |
+
to { opacity: 1; }
|
| 21 |
+
}
|
| 22 |
+
.fade-in {
|
| 23 |
+
animation: fadeIn 0.5s ease-in;
|
| 24 |
+
}
|
| 25 |
+
.autocomplete-suggestions {
|
| 26 |
+
position: absolute;
|
| 27 |
+
background: white;
|
| 28 |
+
border: 1px solid #d1d5db;
|
| 29 |
+
max-height: 150px;
|
| 30 |
+
overflow-y: auto;
|
| 31 |
+
width: 100%;
|
| 32 |
+
z-index: 10;
|
| 33 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
| 34 |
+
}
|
| 35 |
+
.autocomplete-suggestions div {
|
| 36 |
+
padding: 8px;
|
| 37 |
+
cursor: pointer;
|
| 38 |
+
}
|
| 39 |
+
.autocomplete-suggestions div:hover {
|
| 40 |
+
background: #f3f4f6;
|
| 41 |
+
}
|
| 42 |
+
.dark .autocomplete-suggestions {
|
| 43 |
+
background: #1f2937;
|
| 44 |
+
border-color: #374151;
|
| 45 |
+
}
|
| 46 |
+
.dark .autocomplete-suggestions div:hover {
|
| 47 |
+
background: #374151;
|
| 48 |
+
}
|
| 49 |
+
.glow {
|
| 50 |
+
box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
|
| 51 |
+
}
|
| 52 |
+
.price-up {
|
| 53 |
+
color: #10b981;
|
| 54 |
+
}
|
| 55 |
+
.price-down {
|
| 56 |
+
color: #ef4444;
|
| 57 |
+
}
|
| 58 |
+
.price-neutral {
|
| 59 |
+
color: #6b7280;
|
| 60 |
+
}
|
| 61 |
+
.ticker-card:hover {
|
| 62 |
+
transform: translateY(-2px);
|
| 63 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 64 |
+
}
|
| 65 |
+
.ticker-card {
|
| 66 |
+
transition: all 0.2s ease;
|
| 67 |
+
}
|
| 68 |
+
.blink {
|
| 69 |
+
animation: blink 1s step-end infinite;
|
| 70 |
+
}
|
| 71 |
+
@keyframes blink {
|
| 72 |
+
50% { opacity: 0.5; }
|
| 73 |
+
}
|
| 74 |
+
</style>
|
| 75 |
+
</head>
|
| 76 |
+
<body class="flex flex-col min-h-screen bg-gray-100 font-sans transition-colors duration-300 dark:bg-gray-900" id="theme-body">
|
| 77 |
+
<!-- Header -->
|
| 78 |
+
<header class="bg-blue-800 text-white py-4 shadow-md dark:bg-gray-800">
|
| 79 |
+
<div class="container mx-auto px-4 sm:px-6 flex justify-between items-center">
|
| 80 |
+
<div class="flex items-center space-x-2">
|
| 81 |
+
<i class="fas fa-chart-line text-xl"></i>
|
| 82 |
+
<h1 class="text-xl font-bold">TradePulse</h1>
|
| 83 |
+
</div>
|
| 84 |
+
<nav class="hidden md:flex items-center space-x-4">
|
| 85 |
+
<a href="#home" class="hover:underline flex items-center space-x-1">
|
| 86 |
+
<i class="fas fa-home"></i>
|
| 87 |
+
<span>Home</span>
|
| 88 |
+
</a>
|
| 89 |
+
<a href="#dashboard" class="hover:underline flex items-center space-x-1">
|
| 90 |
+
<i class="fas fa-tachometer-alt"></i>
|
| 91 |
+
<span>Dashboard</span>
|
| 92 |
+
</a>
|
| 93 |
+
<a href="#trade" class="hover:underline flex items-center space-x-1">
|
| 94 |
+
<i class="fas fa-exchange-alt"></i>
|
| 95 |
+
<span>Trade</span>
|
| 96 |
+
</a>
|
| 97 |
+
<button id="theme-toggle" class="bg-blue-600 px-4 py-2 rounded-md hover:bg-blue-700 flex items-center space-x-2 dark:bg-gray-700 dark:hover:bg-gray-600">
|
| 98 |
+
<i class="fas fa-moon"></i>
|
| 99 |
+
<span>Dark Mode</span>
|
| 100 |
+
</button>
|
| 101 |
+
<button class="bg-blue-600 px-4 py-2 rounded-md hover:bg-blue-700 flex items-center space-x-2 dark:bg-gray-700 dark:hover:bg-gray-600">
|
| 102 |
+
<i class="fas fa-sign-in-alt"></i>
|
| 103 |
+
<span>Login</span>
|
| 104 |
+
</button>
|
| 105 |
+
</nav>
|
| 106 |
+
<button id="mobile-menu-button" class="md:hidden text-xl">
|
| 107 |
+
<i class="fas fa-bars"></i>
|
| 108 |
+
</button>
|
| 109 |
+
</div>
|
| 110 |
+
<!-- Mobile menu -->
|
| 111 |
+
<div id="mobile-menu" class="hidden md:hidden bg-blue-900 dark:bg-gray-700">
|
| 112 |
+
<div class="container mx-auto px-4 py-2 flex flex-col space-y-2">
|
| 113 |
+
<a href="#home" class="hover:underline flex items-center space-x-2 py-1">
|
| 114 |
+
<i class="fas fa-home w-5"></i>
|
| 115 |
+
<span>Home</span>
|
| 116 |
+
</a>
|
| 117 |
+
<a href="#dashboard" class="hover:underline flex items-center space-x-2 py-1">
|
| 118 |
+
<i class="fas fa-tachometer-alt w-5"></i>
|
| 119 |
+
<span>Dashboard</span>
|
| 120 |
+
</a>
|
| 121 |
+
<a href="#trade" class="hover:underline flex items-center space-x-2 py-1">
|
| 122 |
+
<i class="fas fa-exchange-alt w-5"></i>
|
| 123 |
+
<span>Trade</span>
|
| 124 |
+
</a>
|
| 125 |
+
<button id="theme-toggle-mobile" class="w-full text-left hover:underline flex items-center space-x-2 py-1">
|
| 126 |
+
<i class="fas fa-moon w-5"></i>
|
| 127 |
+
<span>Dark Mode</span>
|
| 128 |
+
</button>
|
| 129 |
+
<button class="w-full text-left hover:underline flex items-center space-x-2 py-1">
|
| 130 |
+
<i class="fas fa-sign-in-alt w-5"></i>
|
| 131 |
+
<span>Login</span>
|
| 132 |
+
</button>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
</header>
|
| 136 |
+
|
| 137 |
+
<!-- Hero Section -->
|
| 138 |
+
<section id="home" class="bg-gradient-to-r from-blue-50 to-blue-100 py-12 text-center dark:from-gray-800 dark:to-gray-700 relative overflow-hidden">
|
| 139 |
+
<div class="absolute inset-0 opacity-10 dark:opacity-5">
|
| 140 |
+
<div class="absolute top-0 left-0 w-full h-full bg-[url('https://enzostvs-deepsite.hf.space/grid.svg')]"></div>
|
| 141 |
+
</div>
|
| 142 |
+
<div class="container mx-auto px-6 relative z-10">
|
| 143 |
+
<span class="text-xs rounded-full mb-2 inline-block px-3 py-1 border border-blue-500/15 bg-blue-500/15 text-blue-500 dark:bg-blue-400/15 dark:text-blue-300">
|
| 144 |
+
<i class="fas fa-bolt mr-1"></i> Start Investing Today
|
| 145 |
+
</span>
|
| 146 |
+
<h2 class="text-3xl lg:text-5xl font-bold text-gray-800 dark:text-white">
|
| 147 |
+
<span class="text-xl lg:text-3xl text-gray-400 block font-medium dark:text-gray-300">Your Wealth, Your Way,</span>
|
| 148 |
+
Trade with <span class="text-blue-600 dark:text-blue-400">TradePulse</span>.
|
| 149 |
+
</h2>
|
| 150 |
+
<p class="mt-4 text-gray-600 max-w-2xl mx-auto dark:text-gray-300">
|
| 151 |
+
Buy and sell stocks, ETFs, and cryptocurrencies with zero commissions and real-time insights.
|
| 152 |
+
</p>
|
| 153 |
+
<button onclick="alert('Please verify your identity to start trading.')" class="mt-6 bg-blue-600 text-white px-6 py-3 rounded-md hover:bg-blue-700 glow transition-all duration-300 flex items-center mx-auto space-x-2">
|
| 154 |
+
<i class="fas fa-play"></i>
|
| 155 |
+
<span>Get Started</span>
|
| 156 |
+
</button>
|
| 157 |
+
</div>
|
| 158 |
+
<img
|
| 159 |
+
src="https://enzostvs-deepsite.hf.space/arrow.svg"
|
| 160 |
+
alt="Decorative arrow"
|
| 161 |
+
class="absolute bottom-8 left-0 w-[100px] transform rotate-[30deg] hidden md:block"
|
| 162 |
+
/>
|
| 163 |
+
</section>
|
| 164 |
+
|
| 165 |
+
<!-- Market Tickers -->
|
| 166 |
+
<div class="bg-white dark:bg-gray-800 py-3 border-b border-gray-200 dark:border-gray-700 overflow-hidden">
|
| 167 |
+
<div class="container mx-auto px-4">
|
| 168 |
+
<div class="marquee">
|
| 169 |
+
<div class="marquee-content flex space-x-8">
|
| 170 |
+
<!-- Tickers will be added here by JavaScript -->
|
| 171 |
+
</div>
|
| 172 |
+
</div>
|
| 173 |
+
</div>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<!-- Dashboard Section -->
|
| 177 |
+
<section id="dashboard" class="py-12 bg-white dark:bg-gray-900">
|
| 178 |
+
<div class="container mx-auto px-6">
|
| 179 |
+
<h3 class="text-2xl font-bold text-gray-800 dark:text-white text-center">
|
| 180 |
+
<i class="fas fa-tachometer-alt mr-2"></i>Your Dashboard
|
| 181 |
+
</h3>
|
| 182 |
+
<div class="mt-6 grid grid-cols-1 lg:grid-cols-3 gap-6">
|
| 183 |
+
<!-- Portfolio Overview -->
|
| 184 |
+
<div class="bg-gray-50 dark:bg-gray-800 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
|
| 185 |
+
<div class="flex justify-between items-center">
|
| 186 |
+
<h4 class="text-lg font-semibold text-gray-700 dark:text-gray-300">
|
| 187 |
+
<i class="fas fa-wallet mr-2"></i>Portfolio Value
|
| 188 |
+
</h4>
|
| 189 |
+
<span class="text-xs bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-300 px-2 py-1 rounded-full">
|
| 190 |
+
<i class="fas fa-arrow-up mr-1"></i>2.3%
|
| 191 |
+
</span>
|
| 192 |
+
</div>
|
| 193 |
+
<p class="text-3xl font-bold text-blue-600 dark:text-blue-400 mt-2">$12,345.67</p>
|
| 194 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">+$280.45 today</p>
|
| 195 |
+
<div class="mt-4 h-64">
|
| 196 |
+
<canvas id="portfolio-chart" class="w-full h-full" aria-label="Portfolio allocation chart"></canvas>
|
| 197 |
+
</div>
|
| 198 |
+
<div class="mt-4 flex justify-between text-sm">
|
| 199 |
+
<span class="text-gray-500 dark:text-gray-400">Available Cash</span>
|
| 200 |
+
<span class="font-medium text-gray-700 dark:text-gray-300">$5,000.00</span>
|
| 201 |
+
</div>
|
| 202 |
+
</div>
|
| 203 |
+
|
| 204 |
+
<!-- Watchlist -->
|
| 205 |
+
<div class="bg-gray-50 dark:bg-gray-800 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
|
| 206 |
+
<div class="flex justify-between items-center">
|
| 207 |
+
<h4 class="text-lg font-semibold text-gray-700 dark:text-gray-300">
|
| 208 |
+
<i class="fas fa-star mr-2"></i>Watchlist
|
| 209 |
+
</h4>
|
| 210 |
+
<button class="text-blue-600 dark:text-blue-400 text-sm">
|
| 211 |
+
<i class="fas fa-plus mr-1"></i>Add
|
| 212 |
+
</button>
|
| 213 |
+
</div>
|
| 214 |
+
<ul class="mt-4 space-y-3">
|
| 215 |
+
<li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
|
| 216 |
+
<div>
|
| 217 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">Apple</div>
|
| 218 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">AAPL</div>
|
| 219 |
+
</div>
|
| 220 |
+
<div class="text-right">
|
| 221 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">$235.40</div>
|
| 222 |
+
<div class="text-xs price-up">
|
| 223 |
+
<i class="fas fa-arrow-up mr-1"></i>1.2%
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
</li>
|
| 227 |
+
<li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
|
| 228 |
+
<div>
|
| 229 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">Tesla</div>
|
| 230 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">TSLA</div>
|
| 231 |
+
</div>
|
| 232 |
+
<div class="text-right">
|
| 233 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">$420.15</div>
|
| 234 |
+
<div class="text-xs price-down">
|
| 235 |
+
<i class="fas fa-arrow-down mr-1"></i>0.8%
|
| 236 |
+
</div>
|
| 237 |
+
</div>
|
| 238 |
+
</li>
|
| 239 |
+
<li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
|
| 240 |
+
<div>
|
| 241 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">Bitcoin</div>
|
| 242 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">BTC</div>
|
| 243 |
+
</div>
|
| 244 |
+
<div class="text-right">
|
| 245 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">$65,200.00</div>
|
| 246 |
+
<div class="text-xs price-up">
|
| 247 |
+
<i class="fas fa-arrow-up mr-1"></i>3.5%
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
</li>
|
| 251 |
+
<li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
|
| 252 |
+
<div>
|
| 253 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">SPDR S&P 500</div>
|
| 254 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">SPY</div>
|
| 255 |
+
</div>
|
| 256 |
+
<div class="text-right">
|
| 257 |
+
<div class="font-medium text-gray-800 dark:text-gray-200">$550.20</div>
|
| 258 |
+
<div class="text-xs price-neutral">
|
| 259 |
+
<i class="fas fa-minus mr-1"></i>0.0%
|
| 260 |
+
</div>
|
| 261 |
+
</div>
|
| 262 |
+
</li>
|
| 263 |
+
</ul>
|
| 264 |
+
</div>
|
| 265 |
+
|
| 266 |
+
<!-- Market News -->
|
| 267 |
+
<div class="bg-gray-50 dark:bg-gray-800 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
|
| 268 |
+
<h4 class="text-lg font-semibold text-gray-700 dark:text-gray-300">
|
| 269 |
+
<i class="fas fa-newspaper mr-2"></i>Market News
|
| 270 |
+
</h4>
|
| 271 |
+
<ul class="mt-4 space-y-4">
|
| 272 |
+
<li class="border-b border-gray-200 dark:border-gray-700 pb-3">
|
| 273 |
+
<h5 class="font-medium text-gray-800 dark:text-gray-200">Tech stocks rally as AI demand surges</h5>
|
| 274 |
+
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Major tech companies report strong earnings driven by AI product demand...</p>
|
| 275 |
+
<span class="text-xs text-gray-500 dark:text-gray-500 mt-1 block">2 hours ago</span>
|
| 276 |
+
</li>
|
| 277 |
+
<li class="border-b border-gray-200 dark:border-gray-700 pb-3">
|
| 278 |
+
<h5 class="font-medium text-gray-800 dark:text-gray-200">Fed signals steady interest rates for 2025</h5>
|
| 279 |
+
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Federal Reserve indicates no rate cuts until inflation reaches 2% target...</p>
|
| 280 |
+
<span class="text-xs text-gray-500 dark:text-gray-500 mt-1 block">5 hours ago</span>
|
| 281 |
+
</li>
|
| 282 |
+
<li>
|
| 283 |
+
<h5 class="font-medium text-gray-800 dark:text-gray-200">Bitcoin hits new high amid ETF approvals</h5>
|
| 284 |
+
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Cryptocurrency markets surge as SEC approves additional Bitcoin ETFs...</p>
|
| 285 |
+
<span class="text-xs text-gray-500 dark:text-gray-500 mt-1 block">1 day ago</span>
|
| 286 |
+
</li>
|
| 287 |
+
</ul>
|
| 288 |
+
</div>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
</section>
|
| 292 |
+
|
| 293 |
+
<!-- Trade Section -->
|
| 294 |
+
<section id="trade" class="py-12 bg-gray-100 dark:bg-gray-800">
|
| 295 |
+
<div class="container mx-auto px-6">
|
| 296 |
+
<h3 class="text-2xl font-bold text-gray-800 dark:text-white text-center">
|
| 297 |
+
<i class="fas fa-exchange-alt mr-2"></i>Trade Assets
|
| 298 |
+
</h3>
|
| 299 |
+
<div class="mt-8 max-w-4xl mx-auto grid grid-cols-1 lg:grid-cols-2 gap-8">
|
| 300 |
+
<!-- Trade Form -->
|
| 301 |
+
<div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
|
| 302 |
+
<h4 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">
|
| 303 |
+
<i class="fas fa-trade-alt mr-2"></i>Place Order
|
| 304 |
+
</h4>
|
| 305 |
+
<form id="trade-form" class="space-y-4" novalidate>
|
| 306 |
+
<div>
|
| 307 |
+
<label for="asset-search" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
| 308 |
+
Search Asset
|
| 309 |
+
<span title="Enter stock or crypto ticker" class="text-blue-500 dark:text-blue-400 cursor-help ml-1">
|
| 310 |
+
<i class="fas fa-info-circle"></i>
|
| 311 |
+
</span>
|
| 312 |
+
</label>
|
| 313 |
+
<div class="relative mt-1">
|
| 314 |
+
<input
|
| 315 |
+
id="asset-search"
|
| 316 |
+
type="text"
|
| 317 |
+
placeholder="e.g., AAPL, Bitcoin"
|
| 318 |
+
class="w-full p-3 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white"
|
| 319 |
+
aria-describedby="asset-error"
|
| 320 |
+
autocomplete="off"
|
| 321 |
+
/>
|
| 322 |
+
<div id="autocomplete-suggestions" class="autocomplete-suggestions hidden"></div>
|
| 323 |
+
</div>
|
| 324 |
+
<p id="asset-error" class="mt-1 text-sm text-red-500 dark:text-red-400 hidden"></p>
|
| 325 |
+
</div>
|
| 326 |
+
|
| 327 |
+
<div class="grid grid-cols-2 gap-4">
|
| 328 |
+
<div>
|
| 329 |
+
<label for="quantity" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Quantity</label>
|
| 330 |
+
<input
|
| 331 |
+
id="quantity"
|
| 332 |
+
type="number"
|
| 333 |
+
step="1"
|
| 334 |
+
min="1"
|
| 335 |
+
placeholder="e.g., 10"
|
| 336 |
+
class="w-full p-3 mt-1 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white"
|
| 337 |
+
aria-describedby="quantity-error"
|
| 338 |
+
required
|
| 339 |
+
/>
|
| 340 |
+
<p id="quantity-error" class="mt-1 text-sm text-red-500 dark:text-red-400 hidden"></p>
|
| 341 |
+
</div>
|
| 342 |
+
|
| 343 |
+
<div>
|
| 344 |
+
<label for="order-type" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Order Type</label>
|
| 345 |
+
<select id="order-type" class="w-full p-3 mt-1 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white">
|
| 346 |
+
<option value="buy">Buy</option>
|
| 347 |
+
<option value="sell">Sell</option>
|
| 348 |
+
</select>
|
| 349 |
+
</div>
|
| 350 |
+
</div>
|
| 351 |
+
|
| 352 |
+
<div class="grid grid-cols-2 gap-4">
|
| 353 |
+
<div>
|
| 354 |
+
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">Price Type</label>
|
| 355 |
+
<div class="mt-1 flex rounded-md shadow-sm">
|
| 356 |
+
<button type="button" class="order-price-type bg-blue-600 text-white px-4 py-2 rounded-l-md dark:bg-blue-700" data-type="market">
|
| 357 |
+
Market
|
| 358 |
+
</button>
|
| 359 |
+
<button type="button" class="order-price-type bg-gray-200 px-4 py-2 rounded-r-md dark:bg-gray-600 dark:text-gray-300" data-type="limit">
|
| 360 |
+
Limit
|
| 361 |
+
</button>
|
| 362 |
+
</div>
|
| 363 |
+
</div>
|
| 364 |
+
|
| 365 |
+
<div id="limit-price-container" class="hidden">
|
| 366 |
+
<label for="limit-price" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Limit Price</label>
|
| 367 |
+
<input
|
| 368 |
+
id="limit-price"
|
| 369 |
+
type="number"
|
| 370 |
+
step="0.01"
|
| 371 |
+
min="0"
|
| 372 |
+
placeholder="e.g., 235.50"
|
| 373 |
+
class="w-full p-3 mt-1 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white"
|
| 374 |
+
/>
|
| 375 |
+
</div>
|
| 376 |
+
</div>
|
| 377 |
+
|
| 378 |
+
<div class="pt-2">
|
| 379 |
+
<button
|
| 380 |
+
type="submit"
|
| 381 |
+
class="w-full bg-blue-600 text-white p-3 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:bg-blue-700 dark:hover:bg-blue-800 dark:focus:ring-blue-600 dark:focus:ring-offset-gray-800 transition-colors"
|
| 382 |
+
>
|
| 383 |
+
<i class="fas fa-paper-plane mr-2"></i>Place Order
|
| 384 |
+
</button>
|
| 385 |
+
</div>
|
| 386 |
+
</form>
|
| 387 |
+
<p id="trade-result" class="mt-4 text-center text-lg text-gray-700 dark:text-gray-300 fade-in" role="alert"></p>
|
| 388 |
+
</div>
|
| 389 |
+
|
| 390 |
+
<!-- Order Preview -->
|
| 391 |
+
<div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
|
| 392 |
+
<h4 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">
|
| 393 |
+
<i class="fas fa-eye mr-2"></i>Order Preview
|
| 394 |
+
</h4>
|
| 395 |
+
<div id="order-preview" class="bg-gray-50 dark:bg-gray-600 rounded-lg p-4">
|
| 396 |
+
<div class="text-center text-gray-500 dark:text-gray-400 py-8">
|
| 397 |
+
<i class="fas fa-search-dollar text-3xl mb-2"></i>
|
| 398 |
+
<p>Search for an asset to see order details</p>
|
| 399 |
+
</div>
|
| 400 |
+
<div id="preview-details" class="hidden space-y-4">
|
| 401 |
+
<div class="flex justify-between">
|
| 402 |
+
<span class="text-gray-600 dark:text-gray-300">Asset:</span>
|
| 403 |
+
<span id="preview-asset" class="font-medium text-gray-800 dark:text-white"></span>
|
| 404 |
+
</div>
|
| 405 |
+
<div class="flex justify-between">
|
| 406 |
+
<span class="text-gray-600 dark:text-gray-300">Action:</span>
|
| 407 |
+
<span id="preview-action" class="font-medium"></span>
|
| 408 |
+
</div>
|
| 409 |
+
<div class="flex justify-between">
|
| 410 |
+
<span class="text-gray-600 dark:text-gray-300">Price Type:</span>
|
| 411 |
+
<span id="preview-price-type" class="font-medium"></span>
|
| 412 |
+
</div>
|
| 413 |
+
<div id="preview-limit-price-container" class="flex justify-between hidden">
|
| 414 |
+
<span class="text-gray-600 dark:text-gray-300">Limit Price:</span>
|
| 415 |
+
<span id="preview-limit-price" class="font-medium"></span>
|
| 416 |
+
</div>
|
| 417 |
+
<div class="flex justify-between">
|
| 418 |
+
<span class="text-gray-600 dark:text-gray-300">Quantity:</span>
|
| 419 |
+
<span id="preview-quantity" class="font-medium text-gray-800 dark:text-white"></span>
|
| 420 |
+
</div>
|
| 421 |
+
<div class="border-t border-gray-200 dark:border-gray-600 pt-2 mt-2">
|
| 422 |
+
<div class="flex justify-between">
|
| 423 |
+
<span class="text-gray-600 dark:text-gray-300">Estimated Cost:</span>
|
| 424 |
+
<span id="preview-cost" class="font-bold text-lg text-gray-800 dark:text-white"></span>
|
| 425 |
+
</div>
|
| 426 |
+
</div>
|
| 427 |
+
</div>
|
| 428 |
+
</div>
|
| 429 |
+
</div>
|
| 430 |
+
</div>
|
| 431 |
+
</div>
|
| 432 |
+
</section>
|
| 433 |
+
|
| 434 |
+
<!-- Features Section -->
|
| 435 |
+
<section class="py-12 bg-blue-50 dark:bg-gray-800">
|
| 436 |
+
<div class="container mx-auto px-6">
|
| 437 |
+
<h3 class="text-2xl font-bold text-gray-800 dark:text-white text-center mb-8">
|
| 438 |
+
<i class="fas fa-star mr-2"></i>Why Choose TradePulse?
|
| 439 |
+
</h3>
|
| 440 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 441 |
+
<div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow text-center">
|
| 442 |
+
<div class="text-blue-600 dark:text-blue-400 text-4xl mb-4">
|
| 443 |
+
<i class="fas fa-dollar-sign"></i>
|
| 444 |
+
</div>
|
| 445 |
+
<h4 class="text-xl font-semibold text-gray-800 dark:text-white mb-2">Zero Commissions</h4>
|
| 446 |
+
<p class="text-gray-600 dark:text-gray-300">
|
| 447 |
+
Trade stocks, ETFs, and options with no commission fees. Keep more of your profits.
|
| 448 |
+
</p>
|
| 449 |
+
</div>
|
| 450 |
+
<div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow text-center">
|
| 451 |
+
<div class="text-blue-600 dark:text-blue-400 text-4xl mb-4">
|
| 452 |
+
<i class="fas fa-bolt"></i>
|
| 453 |
+
</div>
|
| 454 |
+
<h4 class="text-xl font-semibold text-gray-800 dark:text-white mb-2">Real-Time Data</h4>
|
| 455 |
+
<p class="text-gray-600 dark:text-gray-300">
|
| 456 |
+
Get real-time market data and lightning-fast execution on all your trades.
|
| 457 |
+
</p>
|
| 458 |
+
</div>
|
| 459 |
+
<div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow text-center">
|
| 460 |
+
<div class="text-blue-600 dark:text-blue-400 text-4xl mb-4">
|
| 461 |
+
<i class="fas fa-lock"></i>
|
| 462 |
+
</div>
|
| 463 |
+
<h4 class="text-xl font-semibold text-gray-800 dark:text-white mb-2">Secure Platform</h4>
|
| 464 |
+
<p class="text-gray-600 dark:text-gray-300">
|
| 465 |
+
Bank-level security and encryption to protect your account and personal information.
|
| 466 |
+
</p>
|
| 467 |
+
</div>
|
| 468 |
+
</div>
|
| 469 |
+
</div>
|
| 470 |
+
</section>
|
| 471 |
+
|
| 472 |
+
<!-- Footer -->
|
| 473 |
+
<footer class="bg-blue-800 dark:bg-gray-800 text-white py-8 mt-auto">
|
| 474 |
+
<div class="container mx-auto px-6">
|
| 475 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 476 |
+
<div>
|
| 477 |
+
<h5 class="text-lg font-semibold mb-4 flex items-center">
|
| 478 |
+
<i class="fas fa-chart-line mr-2"></i> TradePulse
|
| 479 |
+
</h5>
|
| 480 |
+
<p class="text-sm text-blue-200 dark:text-gray-300">
|
| 481 |
+
Empowering investors with powerful tools and zero-commission trading.
|
| 482 |
+
</p>
|
| 483 |
+
</div>
|
| 484 |
+
<div>
|
| 485 |
+
<h5 class="text-lg font-semibold mb-4">Trading</h5>
|
| 486 |
+
<ul class="space-y-2 text-sm text-blue-200 dark:text-gray-300">
|
| 487 |
+
<li><a href="#" class="hover:underline">Stocks</a></li>
|
| 488 |
+
<li><a href="#" class="hover:underline">ETFs</a></li>
|
| 489 |
+
<li><a href="#" class="hover:underline">Options</a></li>
|
| 490 |
+
<li><a href="#" class="hover:underline">Crypto</a></li>
|
| 491 |
+
</ul>
|
| 492 |
+
</div>
|
| 493 |
+
<div>
|
| 494 |
+
<h5 class="text-lg font-semibold mb-4">Resources</h5>
|
| 495 |
+
<ul class="space-y-2 text-sm text-blue-200 dark:text-gray-300">
|
| 496 |
+
<li><a href="#" class="hover:underline">Learning Center</a></li>
|
| 497 |
+
<li><a href="#" class="hover:underline">Market Research</a></li>
|
| 498 |
+
<li><a href="#" class="hover:underline">Investment Tools</a></li>
|
| 499 |
+
<li><a href="#" class="hover:underline">API</a></li>
|
| 500 |
+
</ul>
|
| 501 |
+
</div>
|
| 502 |
+
<div>
|
| 503 |
+
<h5 class="text-lg font-semibold mb-4">Company</h5>
|
| 504 |
+
<ul class="space-y-2 text-sm text-blue-200 dark:text-gray-300">
|
| 505 |
+
<li><a href="#" class="hover:underline">About Us</a></li>
|
| 506 |
+
<li><a href="#" class="hover:underline">Careers</a></li>
|
| 507 |
+
<li><a href="#" class="hover:underline">Contact</a></li>
|
| 508 |
+
<li><a href="#" class="hover:underline">Legal</a></li>
|
| 509 |
+
</ul>
|
| 510 |
+
</div>
|
| 511 |
+
</div>
|
| 512 |
+
<div class="border-t border-blue-700 dark:border-gray-700 mt-8 pt-6 text-center">
|
| 513 |
+
<p class="text-sm text-blue-200 dark:text-gray-300">
|
| 514 |
+
TradePulse is a demo brokerage platform for educational purposes. Investing involves risks, including loss of principal. Consult a financial advisor.
|
| 515 |
+
</p>
|
| 516 |
+
<p class="text-sm mt-2 text-blue-200 dark:text-gray-300">
|
| 517 |
+
© 2025 TradePulse. All rights reserved.
|
| 518 |
+
</p>
|
| 519 |
+
</div>
|
| 520 |
+
</div>
|
| 521 |
+
</footer>
|
| 522 |
+
|
| 523 |
+
<!-- JavaScript -->
|
| 524 |
+
<script>
|
| 525 |
+
// DOM Elements
|
| 526 |
+
const tradeForm = document.getElementById('trade-form');
|
| 527 |
+
const inputs = {
|
| 528 |
+
asset: document.getElementById('asset-search'),
|
| 529 |
+
quantity: document.getElementById('quantity'),
|
| 530 |
+
limitPrice: document.getElementById('limit-price')
|
| 531 |
+
};
|
| 532 |
+
const errors = {
|
| 533 |
+
asset: document.getElementById('asset-error'),
|
| 534 |
+
quantity: document.getElementById('quantity-error')
|
| 535 |
+
};
|
| 536 |
+
const orderType = document.getElementById('order-type');
|
| 537 |
+
const tradeResult = document.getElementById('trade-result');
|
| 538 |
+
const suggestions = document.getElementById('autocomplete-suggestions');
|
| 539 |
+
const themeBody = document.getElementById('theme-body');
|
| 540 |
+
const themeToggle = document.getElementById('theme-toggle');
|
| 541 |
+
const themeToggleMobile = document.getElementById('theme-toggle-mobile');
|
| 542 |
+
const mobileMenuButton = document.getElementById('mobile-menu-button');
|
| 543 |
+
const mobileMenu = document.getElementById('mobile-menu');
|
| 544 |
+
const priceTypeButtons = document.querySelectorAll('.order-price-type');
|
| 545 |
+
const limitPriceContainer = document.getElementById('limit-price-container');
|
| 546 |
+
const previewDetails = document.getElementById('preview-details');
|
| 547 |
+
const previewAsset = document.getElementById('preview-asset');
|
| 548 |
+
const previewAction = document.getElementById('preview-action');
|
| 549 |
+
const previewPriceType = document.getElementById('preview-price-type');
|
| 550 |
+
const previewLimitPrice = document.getElementById('preview-limit-price');
|
| 551 |
+
const previewLimitPriceContainer = document.getElementById('preview-limit-price-container');
|
| 552 |
+
const previewQuantity = document.getElementById('preview-quantity');
|
| 553 |
+
const previewCost = document.getElementById('preview-cost');
|
| 554 |
+
const marqueeContent = document.querySelector('.marquee-content');
|
| 555 |
+
let chartInstance = null;
|
| 556 |
+
let currentPriceType = 'market';
|
| 557 |
+
let isDark = localStorage.getItem('theme') === 'dark';
|
| 558 |
+
|
| 559 |
+
// Mock asset data
|
| 560 |
+
const assets = [
|
| 561 |
+
{ ticker: 'aapl', name: 'Apple', price: 235.4, change: 1.2 },
|
| 562 |
+
{ ticker: 'tsla', name: 'Tesla', price: 420.15, change: -0.8 },
|
| 563 |
+
{ ticker: 'btc', name: 'Bitcoin', price: 65200.0, change: 3.5 },
|
| 564 |
+
{ ticker: 'spy', name: 'SPDR S&P 500 ETF', price: 550.2, change: 0.0 },
|
| 565 |
+
{ ticker: 'msft', name: 'Microsoft', price: 420.5, change: 0.7 },
|
| 566 |
+
{ ticker: 'amzn', name: 'Amazon', price: 185.75, change: -1.2 },
|
| 567 |
+
{ ticker: 'googl', name: 'Alphabet', price: 175.3, change: 0.5 },
|
| 568 |
+
{ ticker: 'eth', name: 'Ethereum', price: 3500.0, change: 2.1 }
|
| 569 |
+
];
|
| 570 |
+
|
| 571 |
+
// Market tickers data
|
| 572 |
+
const marketTickers = [
|
| 573 |
+
{ symbol: '^GSPC', name: 'S&P 500', price: 5502.34, change: 0.23 },
|
| 574 |
+
{ symbol: '^DJI', name: 'Dow 30', price: 39231.23, change: -0.12 },
|
| 575 |
+
{ symbol: '^IXIC', name: 'Nasdaq', price: 16382.34, change: 0.45 },
|
| 576 |
+
{ symbol: '^RUT', name: 'Russell 2000', price: 2034.56, change: -0.34 },
|
| 577 |
+
{ symbol: 'CL=F', name: 'Crude Oil', price: 78.45, change: 1.23 },
|
| 578 |
+
{ symbol: 'GC=F', name: 'Gold', price: 2345.67, change: 0.56 },
|
| 579 |
+
{ symbol: 'EURUSD=X', name: 'EUR/USD', price: 1.0823, change: -0.12 },
|
| 580 |
+
{ symbol: 'BTC-USD', name: 'Bitcoin', price: 65200.0, change: 3.45 }
|
| 581 |
+
];
|
| 582 |
+
|
| 583 |
+
// Initialize marquee with market tickers
|
| 584 |
+
function initMarquee() {
|
| 585 |
+
marketTickers.forEach(ticker => {
|
| 586 |
+
const changeClass = ticker.change > 0 ? 'price-up' : ticker.change < 0 ? 'price-down' : 'price-neutral';
|
| 587 |
+
const changeIcon = ticker.change > 0 ? 'fa-arrow-up' : ticker.change < 0 ? 'fa-arrow-down' : 'fa-minus';
|
| 588 |
+
|
| 589 |
+
const tickerElement = document.createElement('div');
|
| 590 |
+
tickerElement.className = 'flex items-center whitespace-nowrap';
|
| 591 |
+
tickerElement.innerHTML = `
|
| 592 |
+
<span class="font-medium mr-1">${ticker.symbol}</span>
|
| 593 |
+
<span class="mr-2">${ticker.price.toFixed(2)}</span>
|
| 594 |
+
<span class="${changeClass}">
|
| 595 |
+
<i class="fas ${changeIcon} mr-1"></i>${Math.abs(ticker.change)}%
|
| 596 |
+
</span>
|
| 597 |
+
`;
|
| 598 |
+
marqueeContent.appendChild(tickerElement);
|
| 599 |
+
});
|
| 600 |
+
|
| 601 |
+
// Clone content for seamless looping
|
| 602 |
+
const clone = marqueeContent.cloneNode(true);
|
| 603 |
+
marqueeContent.parentNode.appendChild(clone);
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
// Input validation
|
| 607 |
+
function validateInput(id, value) {
|
| 608 |
+
if (id === 'asset') {
|
| 609 |
+
const asset = value.toLowerCase().trim();
|
| 610 |
+
return !asset || !assets.some(a => a.ticker === asset) ? 'Please enter a valid asset (e.g., AAPL, TSLA, BTC, SPY).' : '';
|
| 611 |
+
}
|
| 612 |
+
if (!value || value <= 0) {
|
| 613 |
+
return 'Please enter a positive number.';
|
| 614 |
+
}
|
| 615 |
+
return '';
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
// Update error display
|
| 619 |
+
function updateError(id, message) {
|
| 620 |
+
errors[id].textContent = message;
|
| 621 |
+
errors[id].classList.toggle('hidden', !message);
|
| 622 |
+
inputs[id].classList.toggle('error', !!message);
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
// Simulate trade
|
| 626 |
+
function simulateTrade(asset, quantity, type, priceType, limitPrice) {
|
| 627 |
+
try {
|
| 628 |
+
const assetData = assets.find(a => a.ticker === asset.toLowerCase());
|
| 629 |
+
if (!assetData) throw new Error('Unknown asset.');
|
| 630 |
+
|
| 631 |
+
let price = assetData.price;
|
| 632 |
+
let priceNote = '';
|
| 633 |
+
|
| 634 |
+
if (priceType === 'limit') {
|
| 635 |
+
if (limitPrice) {
|
| 636 |
+
priceNote = ` at limit price $${limitPrice}`;
|
| 637 |
+
price = parseFloat(limitPrice);
|
| 638 |
+
} else {
|
| 639 |
+
throw new Error('Limit price required for limit orders.');
|
| 640 |
+
}
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
const total = (price * quantity).toFixed(2);
|
| 644 |
+
return `Order placed: ${type.toUpperCase()} ${quantity} ${assetData.name} (${asset.toUpperCase()})${priceNote} for $${total}`;
|
| 645 |
+
} catch (error) {
|
| 646 |
+
console.error('Trade error:', error);
|
| 647 |
+
return null;
|
| 648 |
+
}
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
// Update order preview
|
| 652 |
+
function updateOrderPreview() {
|
| 653 |
+
const asset = inputs.asset.value.trim();
|
| 654 |
+
const quantity = parseFloat(inputs.quantity.value);
|
| 655 |
+
const type = orderType.value;
|
| 656 |
+
const assetData = assets.find(a => a.ticker === asset.toLowerCase());
|
| 657 |
+
|
| 658 |
+
if (!asset || !assetData || isNaN(quantity) || quantity <= 0) {
|
| 659 |
+
previewDetails.classList.add('hidden');
|
| 660 |
+
return;
|
| 661 |
+
}
|
| 662 |
+
|
| 663 |
+
previewDetails.classList.remove('hidden');
|
| 664 |
+
previewAsset.textContent = `${assetData.name} (${asset.toUpperCase()})`;
|
| 665 |
+
previewAction.textContent = type === 'buy' ? 'Buy' : 'Sell';
|
| 666 |
+
previewAction.className = type === 'buy' ? 'font-medium price-up' : 'font-medium price-down';
|
| 667 |
+
previewPriceType.textContent = currentPriceType === 'market' ? 'Market' : 'Limit';
|
| 668 |
+
|
| 669 |
+
if (currentPriceType === 'limit' && inputs.limitPrice.value) {
|
| 670 |
+
previewLimitPrice.textContent = `$${parseFloat(inputs.limitPrice.value).toFixed(2)}`;
|
| 671 |
+
previewLimitPriceContainer.classList.remove('hidden');
|
| 672 |
+
} else {
|
| 673 |
+
previewLimitPriceContainer.classList.add('hidden');
|
| 674 |
+
}
|
| 675 |
+
|
| 676 |
+
previewQuantity.textContent = quantity;
|
| 677 |
+
|
| 678 |
+
let price = assetData.price;
|
| 679 |
+
if (currentPriceType === 'limit' && inputs.limitPrice.value) {
|
| 680 |
+
price = parseFloat(inputs.limitPrice.value);
|
| 681 |
+
}
|
| 682 |
+
|
| 683 |
+
const total = (price * quantity).toFixed(2);
|
| 684 |
+
previewCost.textContent = `$${total}`;
|
| 685 |
+
}
|
| 686 |
+
|
| 687 |
+
// Autocomplete suggestions
|
| 688 |
+
function showSuggestions(value) {
|
| 689 |
+
suggestions.innerHTML = '';
|
| 690 |
+
if (!value) {
|
| 691 |
+
suggestions.classList.add('hidden');
|
| 692 |
+
return;
|
| 693 |
+
}
|
| 694 |
+
|
| 695 |
+
const matches = assets.filter(a =>
|
| 696 |
+
a.ticker.includes(value.toLowerCase()) ||
|
| 697 |
+
a.name.toLowerCase().includes(value.toLowerCase())
|
| 698 |
+
);
|
| 699 |
+
|
| 700 |
+
if (matches.length === 0) {
|
| 701 |
+
suggestions.classList.add('hidden');
|
| 702 |
+
return;
|
| 703 |
+
}
|
| 704 |
+
|
| 705 |
+
matches.forEach(asset => {
|
| 706 |
+
const div = document.createElement('div');
|
| 707 |
+
div.className = 'flex justify-between items-center';
|
| 708 |
+
div.innerHTML = `
|
| 709 |
+
<div>
|
| 710 |
+
<div class="font-medium">${asset.name}</div>
|
| 711 |
+
<div class="text-xs text-gray-500">${asset.ticker.toUpperCase()}</div>
|
| 712 |
+
</div>
|
| 713 |
+
<div class="text-right">
|
| 714 |
+
<div class="font-medium">$${asset.price.toFixed(2)}</div>
|
| 715 |
+
<div class="text-xs ${asset.change > 0 ? 'price-up' : asset.change < 0 ? 'price-down' : 'price-neutral'}">
|
| 716 |
+
<i class="fas ${asset.change > 0 ? 'fa-arrow-up' : asset.change < 0 ? 'fa-arrow-down' : 'fa-minus'} mr-1"></i>
|
| 717 |
+
${Math.abs(asset.change)}%
|
| 718 |
+
</div>
|
| 719 |
+
</div>
|
| 720 |
+
`;
|
| 721 |
+
|
| 722 |
+
div.onclick = () => {
|
| 723 |
+
inputs.asset.value = asset.ticker;
|
| 724 |
+
suggestions.classList.add('hidden');
|
| 725 |
+
updateError('asset', validateInput('asset', asset.ticker));
|
| 726 |
+
updateOrderPreview();
|
| 727 |
+
};
|
| 728 |
+
|
| 729 |
+
suggestions.appendChild(div);
|
| 730 |
+
});
|
| 731 |
+
|
| 732 |
+
suggestions.classList.remove('hidden');
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
// Handle price type selection
|
| 736 |
+
function handlePriceTypeSelection(type) {
|
| 737 |
+
currentPriceType = type;
|
| 738 |
+
priceTypeButtons.forEach(btn => {
|
| 739 |
+
if (btn.dataset.type === type) {
|
| 740 |
+
btn.classList.remove('bg-gray-200', 'dark:bg-gray-600', 'dark:text-gray-300');
|
| 741 |
+
btn.classList.add('bg-blue-600', 'text-white', 'dark:bg-blue-700');
|
| 742 |
+
} else {
|
| 743 |
+
btn.classList.remove('bg-blue-600', 'text-white', 'dark:bg-blue-700');
|
| 744 |
+
btn.classList.add('bg-gray-200', 'dark:bg-gray-600', 'dark:text-gray-300');
|
| 745 |
+
}
|
| 746 |
+
});
|
| 747 |
+
|
| 748 |
+
if (type === 'limit') {
|
| 749 |
+
limitPriceContainer.classList.remove('hidden');
|
| 750 |
+
previewLimitPriceContainer.classList.remove('hidden');
|
| 751 |
+
} else {
|
| 752 |
+
limitPriceContainer.classList.add('hidden');
|
| 753 |
+
previewLimitPriceContainer.classList.add('hidden');
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
updateOrderPreview();
|
| 757 |
+
}
|
| 758 |
+
|
| 759 |
+
// Render portfolio chart
|
| 760 |
+
function renderPortfolioChart() {
|
| 761 |
+
if (chartInstance) chartInstance.destroy();
|
| 762 |
+
|
| 763 |
+
const ctx = document.getElementById('portfolio-chart').getContext('2d');
|
| 764 |
+
chartInstance = new Chart(ctx, {
|
| 765 |
+
type: 'doughnut',
|
| 766 |
+
data: {
|
| 767 |
+
labels: ['Stocks', 'ETFs', 'Crypto', 'Cash'],
|
| 768 |
+
datasets: [{
|
| 769 |
+
data: [6500, 3200, 645.67, 5000],
|
| 770 |
+
backgroundColor: [
|
| 771 |
+
'#1d4ed8',
|
| 772 |
+
'#3b82f6',
|
| 773 |
+
'#93c5fd',
|
| 774 |
+
'#dbeafe'
|
| 775 |
+
],
|
| 776 |
+
borderWidth: 0
|
| 777 |
+
}]
|
| 778 |
+
},
|
| 779 |
+
options: {
|
| 780 |
+
responsive: true,
|
| 781 |
+
maintainAspectRatio: false,
|
| 782 |
+
plugins: {
|
| 783 |
+
legend: {
|
| 784 |
+
position: 'bottom',
|
| 785 |
+
labels: {
|
| 786 |
+
color: isDark ? '#e5e7eb' : '#4b5563',
|
| 787 |
+
font: {
|
| 788 |
+
family: "'Inter', sans-serif"
|
| 789 |
+
}
|
| 790 |
+
}
|
| 791 |
+
},
|
| 792 |
+
tooltip: {
|
| 793 |
+
callbacks: {
|
| 794 |
+
label: function(context) {
|
| 795 |
+
const label = context.label || '';
|
| 796 |
+
const value = context.raw || 0;
|
| 797 |
+
const total = context.dataset.data.reduce((a, b) => a + b, 0);
|
| 798 |
+
const percentage = Math.round((value / total) * 100);
|
| 799 |
+
return `${label}: $${value.toLocaleString()} (${percentage}%)`;
|
| 800 |
+
}
|
| 801 |
+
}
|
| 802 |
+
}
|
| 803 |
+
},
|
| 804 |
+
cutout: '70%'
|
| 805 |
+
}
|
| 806 |
+
});
|
| 807 |
+
}
|
| 808 |
+
|
| 809 |
+
// Theme toggle
|
| 810 |
+
function updateTheme() {
|
| 811 |
+
themeBody.classList.toggle('dark', isDark);
|
| 812 |
+
themeToggle.innerHTML = isDark
|
| 813 |
+
? '<i class="fas fa-sun mr-2"></i><span>Light Mode</span>'
|
| 814 |
+
: '<i class="fas fa-moon mr-2"></i><span>Dark Mode</span>';
|
| 815 |
+
|
| 816 |
+
if (themeToggleMobile) {
|
| 817 |
+
themeToggleMobile.innerHTML = isDark
|
| 818 |
+
? '<i class="fas fa-sun mr-2"></i><span>Light Mode</span>'
|
| 819 |
+
: '<i class="fas fa-moon mr-2"></i><span>Dark Mode</span>';
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
| 823 |
+
|
| 824 |
+
// Re-render chart with updated theme colors
|
| 825 |
+
if (chartInstance) {
|
| 826 |
+
chartInstance.options.plugins.legend.labels.color = isDark ? '#e5e7eb' : '#4b5563';
|
| 827 |
+
chartInstance.update();
|
| 828 |
+
}
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
// Initialize
|
| 832 |
+
function init() {
|
| 833 |
+
// Set initial theme
|
| 834 |
+
updateTheme();
|
| 835 |
+
|
| 836 |
+
// Initialize marquee
|
| 837 |
+
initMarquee();
|
| 838 |
+
|
| 839 |
+
// Render portfolio chart
|
| 840 |
+
renderPortfolioChart();
|
| 841 |
+
|
| 842 |
+
// Set default price type
|
| 843 |
+
handlePriceTypeSelection('market');
|
| 844 |
+
|
| 845 |
+
// Event listeners
|
| 846 |
+
themeToggle.addEventListener('click', () => {
|
| 847 |
+
isDark = !isDark;
|
| 848 |
+
updateTheme();
|
| 849 |
+
});
|
| 850 |
+
|
| 851 |
+
if (themeToggleMobile) {
|
| 852 |
+
themeToggleMobile.addEventListener('click', () => {
|
| 853 |
+
isDark = !isDark;
|
| 854 |
+
updateTheme();
|
| 855 |
+
});
|
| 856 |
+
}
|
| 857 |
+
|
| 858 |
+
mobileMenuButton.addEventListener('click', () => {
|
| 859 |
+
mobileMenu.classList.toggle('hidden');
|
| 860 |
+
});
|
| 861 |
+
|
| 862 |
+
priceTypeButtons.forEach(btn => {
|
| 863 |
+
btn.addEventListener('click', () => {
|
| 864 |
+
handlePriceTypeSelection(btn.dataset.type);
|
| 865 |
+
});
|
| 866 |
+
});
|
| 867 |
+
|
| 868 |
+
// Form submission
|
| 869 |
+
tradeForm.addEventListener('submit', (event) => {
|
| 870 |
+
event.preventDefault();
|
| 871 |
+
const asset = inputs.asset.value.trim();
|
| 872 |
+
const quantity = parseFloat(inputs.quantity.value);
|
| 873 |
+
const type = orderType.value;
|
| 874 |
+
|
| 875 |
+
const assetError = validateInput('asset', asset);
|
| 876 |
+
const quantityError = validateInput('quantity', quantity);
|
| 877 |
+
|
| 878 |
+
updateError('asset', assetError);
|
| 879 |
+
updateError('quantity', quantityError);
|
| 880 |
+
|
| 881 |
+
if (!assetError && !quantityError) {
|
| 882 |
+
const limitPrice = currentPriceType === 'limit' ? inputs.limitPrice.value : null;
|
| 883 |
+
const result = simulateTrade(asset, quantity, type, currentPriceType, limitPrice);
|
| 884 |
+
|
| 885 |
+
if (result) {
|
| 886 |
+
tradeResult.textContent = result;
|
| 887 |
+
tradeResult.classList.remove('text-red-500');
|
| 888 |
+
tradeResult.classList.add('text-gray-700', 'dark:text-gray-300', 'fade-in');
|
| 889 |
+
suggestions.classList.add('hidden');
|
| 890 |
+
|
| 891 |
+
// Reset form
|
| 892 |
+
setTimeout(() => {
|
| 893 |
+
tradeForm.reset();
|
| 894 |
+
tradeResult.textContent = '';
|
| 895 |
+
handlePriceTypeSelection('market');
|
| 896 |
+
updateOrderPreview();
|
| 897 |
+
}, 3000);
|
| 898 |
+
} else {
|
| 899 |
+
tradeResult.textContent = 'Error placing order. Please try again.';
|
| 900 |
+
tradeResult.classList.remove('text-gray-700', 'dark:text-gray-300');
|
| 901 |
+
tradeResult.classList.add('text-red-500');
|
| 902 |
+
}
|
| 903 |
+
} else {
|
| 904 |
+
tradeResult.textContent = '';
|
| 905 |
+
}
|
| 906 |
+
});
|
| 907 |
+
|
| 908 |
+
// Real-time validation and autocomplete
|
| 909 |
+
const debounce = (fn, delay) => {
|
| 910 |
+
let timeout;
|
| 911 |
+
return (...args) => {
|
| 912 |
+
clearTimeout(timeout);
|
| 913 |
+
timeout = setTimeout(() => fn(...args), delay);
|
| 914 |
+
};
|
| 915 |
+
};
|
| 916 |
+
|
| 917 |
+
inputs.asset.addEventListener('input', debounce(() => {
|
| 918 |
+
const value = inputs.asset.value;
|
| 919 |
+
updateError('asset', validateInput('asset', value));
|
| 920 |
+
showSuggestions(value);
|
| 921 |
+
updateOrderPreview();
|
| 922 |
+
}, 300));
|
| 923 |
+
|
| 924 |
+
inputs.quantity.addEventListener('input', debounce(() => {
|
| 925 |
+
const value = parseFloat(inputs.quantity.value);
|
| 926 |
+
updateError('quantity', validateInput('quantity', value));
|
| 927 |
+
updateOrderPreview();
|
| 928 |
+
}, 300));
|
| 929 |
+
|
| 930 |
+
inputs.limitPrice.addEventListener('input', debounce(() => {
|
| 931 |
+
updateOrderPreview();
|
| 932 |
+
}, 300));
|
| 933 |
+
|
| 934 |
+
orderType.addEventListener('change', () => {
|
| 935 |
+
updateOrderPreview();
|
| 936 |
+
});
|
| 937 |
+
|
| 938 |
+
// Close suggestions when clicking outside
|
| 939 |
+
document.addEventListener('click', (event) => {
|
| 940 |
+
if (!inputs.asset.contains(event.target) && !suggestions.contains(event.target)) {
|
| 941 |
+
suggestions.classList.add('hidden');
|
| 942 |
+
}
|
| 943 |
+
});
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
// Initialize when DOM is loaded
|
| 947 |
+
document.addEventListener('DOMContentLoaded', init);
|
| 948 |
+
</script>
|
| 949 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Davidpascal/first-project" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 950 |
+
</html>
|