-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDashboard.html
More file actions
277 lines (259 loc) · 14.9 KB
/
Copy pathDashboard.html
File metadata and controls
277 lines (259 loc) · 14.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html lang="en">
<head>
<base target="_self">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Financial Dashboard | Wealth Management</title>
<meta name="description" content="Professional financial dashboard for wealth management and investment tracking">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: "#1e40af",
secondary: "#3b82f6",
accent: "#10b981",
danger: "#ef4444",
warning: "#f59e0b",
dark: "#1f2937",
light: "#f8fafc"
},
spacing: {
"unit": "1rem"
}
}
}
}
</script>
</head>
<body class="min-h-screen bg-gray-50">
<!-- Header -->
<header class="sticky top-0 z-50 bg-white shadow-sm border-b" role="banner">
<div class="container mx-auto px-4 py-3">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-4">
<h1 class="text-xl font-bold text-gray-800">WealthTrack</h1>
<nav class="hidden md:flex space-x-6" aria-label="Main navigation">
<a href="#" class="nav-link text-primary font-medium hover:text-secondary transition-colors">Dashboard</a>
<a href="#" class="nav-link text-gray-600 hover:text-primary transition-colors">Portfolio</a>
<a href="#" class="nav-link text-gray-600 hover:text-primary transition-colors">Transactions</a>
<a href="#" class="nav-link text-gray-600 hover:text-primary transition-colors">Reports</a>
<a href="#" class="nav-link text-gray-600 hover:text-primary transition-colors">Settings</a>
</nav>
</div>
<div class="flex items-center space-x-4">
<div class="relative" aria-hidden="true">
<i class="fas fa-bell text-gray-500 hover:text-primary cursor-pointer"></i>
<span class="absolute -top-1 -right-1 bg-danger text-white text-xs rounded-full w-4 h-4 flex items-center justify-center">3</span>
</div>
<div class="flex items-center space-x-2">
<img src="https://picsum.photos/32?random=1" alt="User profile" class="w-8 h-8 rounded-full">
<span class="text-sm font-medium text-gray-700">John Doe</span>
</div>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="container mx-auto px-4 py-6">
<!-- Stats Overview -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8" role="region" aria-label="Overview statistics">
<div class="bg-white rounded-lg shadow-sm p-6 border-l-4 border-primary">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-600">Total Portfolio Value</p>
<p class="text-2xl font-bold text-gray-800"><span id="totalValue">$0.00</span></p>
</div>
<i class="fas fa-chart-line text-primary text-xl" aria-hidden="true"></i>
</div>
<p class="text-sm text-accent mt-2" id="portfolioChange" aria-live="polite">
<i class="fas fa-arrow-up"></i> 0% from last month
</p>
</div>
<div class="bg-white rounded-lg shadow-sm p-6 border-l-4 border-accent">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-600">Cash Balance</p>
<p class="text-2xl font-bold text-gray-800"><span id="cashBalance">$0.00</span></p>
</div>
<i class="fas fa-wallet text-accent text-xl" aria-hidden="true"></i>
</div>
<p class="text-sm text-gray-600 mt-2">Available for investment</p>
</div>
<div class="bg-white rounded-lg shadow-sm p-6 border-l-4 border-secondary">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-600">Monthly Income</p>
<p class="text-2xl font-bold text-gray-800"><span id="monthlyIncome">$0.00</span></p>
</div>
<i class="fas fa-money-bill-wave text-secondary text-xl" aria-hidden="true"></i>
</div>
<p class="text-sm text-accent mt-2" id="incomeChange"><i class="fas fa-arrow-up"></i> 0% from last month</p>
</div>
<div class="bg-white rounded-lg shadow-sm p-6 border-l-4 border-warning">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-600">Expenses</p>
<p class="text-2xl font-bold text-gray-800"><span id="expenses">$0.00</span></p>
</div>
<i class="fas fa-receipt text-warning text-xl" aria-hidden="true"></i>
</div>
<p class="text-sm text-danger mt-2" id="expensesChange"><i class="fas fa-arrow-up"></i> 0% from last month</p>
</div>
</div>
<!-- Charts and Detailed Views -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8">
<!-- Portfolio Allocation -->
<div class="lg:col-span-2 bg-white rounded-lg shadow-sm p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-lg font-semibold text-gray-800">Portfolio Allocation</h2>
<select class="text-sm border rounded px-3 py-1 text-gray-700">
<option>Last 30 Days</option>
<option>Last 90 Days</option>
<option>Year to Date</option>
</select>
</div>
<div class="h-64 bg-gray-50 rounded-lg flex items-center justify-center">
<p class="text-gray-500">Portfolio allocation chart visualization</p>
</div>
</div>
<!-- Recent Transactions -->
<div class="bg-white rounded-lg shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-6">Recent Transactions</h2>
<div id="transactionsList" class="space-y-4" aria-live="polite">
<!-- JS will render transactions here -->
</div>
</div>
</div>
<!-- Investment Performance -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Performance Chart -->
<div class="bg-white rounded-lg shadow-sm p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-lg font-semibold text-gray-800">Investment Performance</h2>
<div class="flex space-x-2">
<button class="px-3 py-1 text-sm bg-primary text-white rounded">1M</button>
<button class="px-3 py-1 text-sm bg-gray-200 text-gray-700 rounded">6M</button>
<button class="px-3 py-1 text-sm bg-gray-200 text-gray-700 rounded">1Y</button>
</div>
</div>
<div class="h-64 bg-gray-50 rounded-lg flex items-center justify-center">
<p class="text-gray-500">Investment performance chart visualization</p>
</div>
</div>
<!-- Quick Actions -->
<div class="bg-white rounded-lg shadow-sm p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-6">Quick Actions</h2>
<div class="grid grid-cols-2 gap-4">
<button data-action="add-funds" class="bg-primary text-white py-3 px-4 rounded-lg hover:bg-secondary transition-colors" aria-label="Add Funds">
<i class="fas fa-plus mr-2" aria-hidden="true"></i>Add Funds
</button>
<button data-action="transfer" class="bg-accent text-white py-3 px-4 rounded-lg hover:bg-green-500 transition-colors" aria-label="Transfer">
<i class="fas fa-exchange-alt mr-2" aria-hidden="true"></i>Transfer
</button>
<button data-action="rebalance" class="bg-secondary text-white py-3 px-4 rounded-lg hover:bg-blue-500 transition-colors" aria-label="Rebalance">
<i class="fas fa-chart-pie mr-2" aria-hidden="true"></i>Rebalance
</button>
<button data-action="reports" class="bg-warning text-white py-3 px-4 rounded-lg hover:bg-yellow-500 transition-colors" aria-label="Reports">
<i class="fas fa-file-invoice-dollar mr-2" aria-hidden="true"></i>Reports
</button>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-white border-t mt-12">
<div class="container mx-auto px-4 py-6">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="text-sm text-gray-600 mb-4 md:mb-0">
© 2024 WealthTrack Financial. All rights reserved.
</div>
<div class="flex space-x-6">
<a href="#" class="text-gray-500 hover:text-primary transition-colors">Privacy Policy</a>
<a href="#" class="text-gray-500 hover:text-primary transition-colors">Terms of Service</a>
<a href="#" class="text-gray-500 hover:text-primary transition-colors">Support</a>
</div>
</div>
</div>
</footer>
<script>
// Improved script: only handle intended elements, format currency, render dynamic lists
document.addEventListener("DOMContentLoaded", function() {
const portfolioData = {
totalValue: 245678.90,
cashBalance: 45230.15,
monthlyIncome: 8450.00,
expenses: 4210.75,
portfolioChangePct: 12.5,
incomeChangePct: 3.2,
expensesChangePct: 1.8
};
const recentTransactions = [
{ id: 1, type: "purchase", description: "Stock Purchase", symbol: "AAPL", company: "Apple Inc.", amount: -2500.00, date: "Today", icon: "arrow-down", color: "primary" },
{ id: 2, type: "dividend", description: "Dividend", symbol: "MSFT", company: "Microsoft", amount: 150.75, date: "Yesterday", icon: "arrow-up", color: "accent" },
{ id: 3, type: "transfer", description: "Transfer", symbol: "", company: "Savings Account", amount: 1000.00, date: "2 days ago", icon: "exchange-alt", color: "warning" }
];
const fmt = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'USD', maximumFractionDigits: 2 });
// Render overview stats
document.getElementById('totalValue').textContent = fmt.format(portfolioData.totalValue);
document.getElementById('cashBalance').textContent = fmt.format(portfolioData.cashBalance);
document.getElementById('monthlyIncome').textContent = fmt.format(portfolioData.monthlyIncome);
document.getElementById('expenses').textContent = fmt.format(portfolioData.expenses);
document.getElementById('portfolioChange').innerHTML = `<i class="fas fa-arrow-up" aria-hidden="true"></i> ${portfolioData.portfolioChangePct}% from last month`;
document.getElementById('incomeChange').innerHTML = `<i class="fas fa-arrow-up" aria-hidden="true"></i> ${portfolioData.incomeChangePct}% from last month`;
document.getElementById('expensesChange').innerHTML = `<i class="fas fa-arrow-up" aria-hidden="true"></i> ${portfolioData.expensesChangePct}% from last month`;
// Render recent transactions dynamically
const txList = document.getElementById('transactionsList');
txList.innerHTML = '';
recentTransactions.forEach(tx => {
const positive = tx.amount > 0;
const colorClass = positive ? 'text-accent' : 'text-danger';
const avatarBg = tx.color ? `bg-${tx.color}` : 'bg-gray-300';
const item = document.createElement('div');
item.className = 'flex items-center justify-between';
item.innerHTML = `
<div class="flex items-center space-x-3">
<div class="w-10 h-10 ${avatarBg} rounded-full flex items-center justify-center text-white">
<i class="fas fa-${tx.icon} text-sm" aria-hidden="true"></i>
</div>
<div>
<p class="text-sm font-medium text-gray-800">${tx.description}</p>
<p class="text-xs text-gray-500">${tx.symbol ? tx.symbol + ' - ' + tx.company : tx.company}</p>
</div>
</div>
<div class="text-right">
<p class="text-sm font-medium ${colorClass}">${positive ? '+' : ''}${fmt.format(tx.amount)}</p>
<p class="text-xs text-gray-500">${tx.date}</p>
</div>
`;
txList.appendChild(item);
});
// Only prevent default for nav links (safer than blocking all anchors)
document.querySelectorAll('.nav-link').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
console.log('Navigation clicked (simulated):', link.textContent.trim());
});
});
// Event delegation for quick actions using data-action
document.body.addEventListener('click', (e) => {
const btn = e.target.closest('[data-action]');
if (!btn) return;
const action = btn.getAttribute('data-action');
console.log('Quick action:', action);
// TODO: hook real modal/dialog logic here
// Example: show a small non-blocking toast (console for now)
});
// Small improvement: keyboard accessible notification for actions
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
console.log('Escape pressed — close overlays if any');
}
});
});
</script>
</body>
</html>