-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
325 lines (284 loc) · 12.6 KB
/
index.html
File metadata and controls
325 lines (284 loc) · 12.6 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="theme-color" content="#000000">
<title>Whitebell International</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
:root {
--bg-deep: #000000;
--bg-card: #121212;
--bg-hover: #1a1a1a;
--text-main: #ffffff;
--text-dim: #a1a1aa;
--emerald: #10b981;
--rose: #f43f5e;
--border: #27272a;
--radius: 24px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-deep);
color: var(--text-main);
padding: 20px;
padding-top: env(safe-area-inset-top, 60px);
padding-bottom: 80px;
line-height: 1.5;
}
/* POWERFUL LOADING SCREEN */
#loader {
position: fixed; inset: 0;
background: #000;
display: flex; flex-direction: column;
justify-content: center; align-items: center;
z-index: 9999;
transition: opacity 0.8s ease-out;
}
.loader-logo {
font-weight: 300;
font-size: 1.5rem;
letter-spacing: 8px;
text-transform: uppercase;
color: #fff;
animation: fadeInOut 2s infinite alternate;
}
.loader-spinner {
width: 48px;
height: 48px;
border: 4px solid rgba(255,255,255,0.12);
border-top-color: #ffffff;
border-radius: 50%;
margin-top: 14px;
animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInOut { from { opacity: 0.3; } to { opacity: 1; } }
/* BRANDING */
.brand-nav {
max-width: 1100px;
margin: 0 auto 40px auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.brand-logo {
font-weight: 700; font-size: 1rem;
letter-spacing: 2px; text-transform: uppercase;
}
/* MAIN SUMMARY */
.summary-box {
max-width: 1100px;
margin: 0 auto 50px auto;
text-align: center;
}
.total-label { font-size: 0.85rem; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.total-amount { font-size: clamp(3rem, 10vw, 4.5rem); font-weight: 800; letter-spacing: -3px; margin: 10px 0; }
.badge-pl {
display: inline-flex;
padding: 8px 16px;
border-radius: 100px;
font-weight: 700;
font-size: 0.95rem;
background: #111;
border: 1px solid var(--border);
}
/* HOLDINGS GRID */
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 20px;
max-width: 1100px;
margin: 0 auto;
}
.card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 24px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover { border-color: #3f3f46; background: var(--bg-hover); transform: translateY(-4px); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; }
.ticker-name { font-size: 1.25rem; font-weight: 800; }
.live-price { font-size: 1rem; font-weight: 600; color: var(--text-dim); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px; }
.stat-group span { display: block; }
.stat-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }
.stat-value { font-size: 0.95rem; font-weight: 600; }
.card-footer {
padding-top: 20px;
border-top: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
}
/* CHART SECTION */
.chart-section {
max-width: 1100px;
margin: 80px auto 40px auto;
background: var(--bg-card);
border-radius: var(--radius);
padding: 40px;
border: 1px solid var(--border);
text-align: center;
}
.chart-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 30px; }
.chart-wrapper { max-width: 500px; margin: 0 auto; position: relative; }
/* COLORS */
.green { color: var(--emerald); }
.red { color: var(--rose); }
.mxn-small { font-size: 0.85rem; color: var(--text-dim); font-weight: 600; margin-top: 6px; display:block; margin-left:auto; margin-right:auto }
</style>
</head>
<body>
<div id="loader">
<div class="loader-logo">Whitebell International</div>
<div class="loader-spinner" aria-hidden="true"></div>
</div>
<nav class="brand-nav">
<div class="brand-logo">Whitebell International</div>
<div style="font-size: 0.8rem; color: var(--text-dim)">Global Private Wealth</div>
</nav>
<header class="summary-box">
<div class="total-label">Total Portfolio Value</div>
<div class="total-amount" id="mainBalance">$0.00</div>
<div id="mainBalanceMXN" class="mxn-small">MXN $0.00</div>
<div class="badge-pl" id="mainPL">
<span id="plText">Syncing...</span>
</div>
</header>
<main class="grid" id="portfolioGrid"></main>
<section class="chart-section">
<div class="chart-title">Asset Allocation</div>
<div class="chart-wrapper">
<canvas id="assetChart"></canvas>
</div>
</section>
<script>
const SHEET_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vR4yW6c71viKRN29tZJTjhX-A8m16RGPBZhQGh41HPvZ74f4INr2RO5fSH1n7brNKu5Fooja3oy_8Z0/pub?gid=0&single=true&output=csv";
const PROXY = "https://corsproxy.io/?" + encodeURIComponent(SHEET_URL);
async function updateDashboard() {
try {
const [response, fxResp] = await Promise.all([
fetch(PROXY),
fetch('https://api.exchangerate.host/latest?base=USD&symbols=MXN')
]);
const data = await response.text();
let usdToMxn = 18.0;
try { const fxJson = await fxResp.json(); usdToMxn = fxJson?.rates?.MXN || usdToMxn; } catch(e) { console.warn('FX fetch failed, using fallback', e); }
processData(data, usdToMxn);
} catch (e) {
console.error("Fetch error:", e);
}
}
function processData(csv, usdToMxn = 18.0) {
const rows = csv.split('\n').slice(1);
const grid = document.getElementById('portfolioGrid');
grid.innerHTML = ""; // Clear existing
let totalMktValue = 0;
let totalCost = 0;
let totalPL_MXN = 0;
// Distribution Data
const tickers = [];
const values = [];
rows.forEach(row => {
const cols = row.replace(/"/g, '').split(',');
if(cols.length < 4) return;
const name = cols[0].trim().toUpperCase();
const price = parseFloat(cols[1]);
const cost = parseFloat(cols[2]);
const qty = parseFloat(cols[3]);
if(isNaN(price) || isNaN(qty)) return;
const mktValue = price * qty;
const costBasis = cost * qty;
const pl = mktValue - costBasis;
const plPct = (pl / costBasis) * 100;
const plMXN = pl * usdToMxn;
totalPL_MXN += plMXN;
totalMktValue += mktValue;
totalCost += costBasis;
// Collect for Chart
tickers.push(name);
values.push(mktValue);
// Render Card
grid.innerHTML += `
<div class="card">
<div class="card-header">
<span class="ticker-name">${name}</span>
<span class="live-price">$${price.toLocaleString()}</span>
</div>
<div class="stat-grid">
<div class="stat-group"><span class="stat-label">Shares</span><span class="stat-value">${qty}</span></div>
<div class="stat-group" style="text-align:right"><span class="stat-label">Market Value</span><span class="stat-value">$${mktValue.toLocaleString(undefined, {minimumFractionDigits:2})}</span></div>
<div class="stat-group"><span class="stat-label">Avg Cost</span><span class="stat-value">$${cost.toLocaleString()}</span></div>
<div class="stat-group" style="text-align:right"><span class="stat-label">Return</span><span class="stat-value ${pl >= 0 ? 'green' : 'red'}">${pl >= 0 ? '▲' : '▼'} ${Math.abs(plPct).toFixed(2)}%</span></div>
</div>
<div class="card-footer">
<span class="total-label" style="margin:0">Total P&L</span>
<div style="display:flex;flex-direction:column;align-items:flex-end">
<span class="stat-value ${pl >= 0 ? 'green' : 'red'}" style="font-size:1.1rem; font-weight:800">
${pl >= 0 ? '+' : ''}$${pl.toLocaleString(undefined, {minimumFractionDigits:2})}
</span>
<span class="mxn-small">MXN ${plMXN >= 0 ? '+' : ''}${Math.abs(plMXN).toLocaleString(undefined, {minimumFractionDigits:2})}</span>
</div>
</div>
</div>
`;
});
updateHeader(totalMktValue, totalCost, totalPL_MXN);
renderChart(tickers, values);
// Smooth transition out of loader
setTimeout(() => {
document.getElementById('loader').style.opacity = "0";
setTimeout(() => document.getElementById('loader').style.display = "none", 800);
}, 1000);
}
function updateHeader(total, cost, totalPL_MXN = 0) {
const pl = total - cost;
const pct = (pl / cost) * 100;
document.getElementById('mainBalance').innerText = `$${total.toLocaleString(undefined, {maximumFractionDigits:0})}`;
const plText = document.getElementById('plText');
plText.innerText = `${pl >= 0 ? '+' : ''}$${pl.toLocaleString()} (${pct.toFixed(2)}%)`;
plText.className = pl >= 0 ? 'green' : 'red';
document.getElementById('mainBalanceMXN').innerText = `MXN ${totalPL_MXN >= 0 ? '+' : ''}${totalPL_MXN.toLocaleString(undefined, {minimumFractionDigits:2})}`;
}
function renderChart(labels, data) {
const ctx = document.getElementById('assetChart').getContext('2d');
new Chart(ctx, {
type: 'doughnut',
data: {
labels: labels,
datasets: [{
data: data,
backgroundColor: ['#ffffff', '#10b981', '#3f3f46', '#71717a', '#a1a1aa', '#27272a'],
borderWidth: 0,
hoverOffset: 20
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
cutout: '85%',
plugins: {
legend: {
position: 'bottom',
labels: { color: '#a1a1aa', font: { family: 'Inter', size: 12 }, padding: 20 }
}
}
}
});
}
updateDashboard();
</script>
<footer style="max-width:1100px;margin:40px auto 20px auto;text-align:center;color:var(--text-dim);font-size:0.9rem">
© 2026 Whitebell International • <a href="#" style="color:var(--text-dim);text-decoration:underline">Privacy</a> • <a href="#" style="color:var(--text-dim);text-decoration:underline">Terms & Conditions</a>
</footer>
</body>
</html>