Skip to content

Commit 579f9ec

Browse files
committed
Restore colored sentiment indicator boxes and add Bitcoin comparison to all economic charts
1 parent 028daa2 commit 579f9ec

File tree

1 file changed

+119
-31
lines changed

1 file changed

+119
-31
lines changed

index.html

Lines changed: 119 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,62 @@
281281
border-top-color: #60a5fa;
282282
}
283283

284+
.sentiment-indicator {
285+
margin-top: 12px;
286+
padding: 10px 16px;
287+
border-radius: 8px;
288+
display: flex;
289+
align-items: center;
290+
justify-content: center;
291+
gap: 10px;
292+
font-size: 14px;
293+
font-weight: 600;
294+
border: 2px solid;
295+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
296+
}
297+
298+
.sentiment-indicator.good {
299+
background-color: #dcfce7;
300+
border-color: #16a34a;
301+
color: #15803d;
302+
box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
303+
}
304+
305+
.sentiment-indicator.bad {
306+
background-color: #fee2e2;
307+
border-color: #dc2626;
308+
color: #b91c1c;
309+
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
310+
}
311+
312+
.sentiment-indicator.neutral {
313+
background-color: #fef3c7;
314+
border-color: #d97706;
315+
color: #a16207;
316+
box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
317+
}
318+
319+
body.dark .sentiment-indicator.good {
320+
background-color: #14532d;
321+
border-color: #16a34a;
322+
color: #bbf7d0;
323+
box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
324+
}
325+
326+
body.dark .sentiment-indicator.bad {
327+
background-color: #991b1b;
328+
border-color: #dc2626;
329+
color: #fecaca;
330+
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
331+
}
332+
333+
body.dark .sentiment-indicator.neutral {
334+
background-color: #78350f;
335+
border-color: #d97706;
336+
color: #fed7aa;
337+
box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
338+
}
339+
284340
@keyframes spin {
285341
0% {
286342
transform: rotate(0deg);
@@ -523,7 +579,7 @@ <h2 class="chart-title">💵 DXY vs Bitcoin 3M</h2>
523579
<!-- Row 2: Industrial Production + Financial Conditions -->
524580
<div class="charts-row">
525581
<div class="chart-card">
526-
<h2 class="chart-title">🏭 Industrial Production</h2>
582+
<h2 class="chart-title">🏭 Industrial Production vs Bitcoin</h2>
527583
<div class="chart-container">
528584
<canvas id="pmiChart"></canvas>
529585
</div>
@@ -534,7 +590,7 @@ <h2 class="chart-title">🏭 Industrial Production</h2>
534590
</div>
535591

536592
<div class="chart-card">
537-
<h2 class="chart-title">📊 Financial Conditions</h2>
593+
<h2 class="chart-title">📊 Financial Conditions vs Bitcoin</h2>
538594
<div class="chart-container">
539595
<canvas id="nfciChart"></canvas>
540596
</div>
@@ -548,7 +604,7 @@ <h2 class="chart-title">📊 Financial Conditions</h2>
548604
<!-- Row 3: M2 Money Supply + Treasury Account -->
549605
<div class="charts-row">
550606
<div class="chart-card">
551-
<h2 class="chart-title">💰 M2 Money Supply</h2>
607+
<h2 class="chart-title">💰 M2 Money Supply vs Bitcoin</h2>
552608
<div class="chart-container">
553609
<canvas id="m2Chart"></canvas>
554610
</div>
@@ -559,7 +615,7 @@ <h2 class="chart-title">💰 M2 Money Supply</h2>
559615
</div>
560616

561617
<div class="chart-card">
562-
<h2 class="chart-title">🏛️ Treasury Account</h2>
618+
<h2 class="chart-title">🏛️ Treasury Account vs Bitcoin</h2>
563619
<div class="chart-container">
564620
<canvas id="tgaChart"></canvas>
565621
</div>
@@ -1158,10 +1214,10 @@ <h2 class="chart-title">🏛️ Treasury Account</h2>
11581214
'bitcoinChart': '₿ Bitcoin Price (USD)',
11591215
'm2BitcoinChart': '📈 M2 vs Bitcoin YoY',
11601216
'dxyBitcoinChart': '💵 DXY vs Bitcoin 3M',
1161-
'pmiChart': '🏭 Industrial Production',
1162-
'nfciChart': '📊 Financial Conditions',
1163-
'm2Chart': '💰 M2 Money Supply',
1164-
'tgaChart': '🏛️ Treasury Account'
1217+
'pmiChart': '🏭 Industrial Production vs Bitcoin',
1218+
'nfciChart': '📊 Financial Conditions vs Bitcoin',
1219+
'm2Chart': '💰 M2 Money Supply vs Bitcoin',
1220+
'tgaChart': '🏛️ Treasury Account vs Bitcoin'
11651221
};
11661222

11671223
// Find the canvas or restore it if it was replaced by loading/error state
@@ -1255,36 +1311,23 @@ <h2 class="chart-title">🏛️ Treasury Account</h2>
12551311

12561312
if (!sentimentEl) {
12571313
sentimentEl = document.createElement('div');
1258-
sentimentEl.className = 'sentiment-indicator mt-3 flex items-center justify-center space-x-2 p-2 rounded-lg';
1314+
sentimentEl.className = 'sentiment-indicator';
12591315
container.appendChild(sentimentEl);
12601316
}
12611317

12621318
const latestValue = data[data.length - 1].value;
12631319
const sentiment = getCryptoSentiment(label, latestValue, data);
12641320

1265-
const colors = {
1266-
good: 'bg-green-100 dark:bg-green-900/20 border border-green-200 dark:border-green-800',
1267-
neutral: 'bg-yellow-100 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800',
1268-
bad: 'bg-red-100 dark:bg-red-900/20 border border-red-200 dark:border-red-800'
1269-
};
1270-
1271-
const textColors = {
1272-
good: 'text-green-700 dark:text-green-300',
1273-
neutral: 'text-yellow-700 dark:text-yellow-300',
1274-
bad: 'text-red-700 dark:text-red-300'
1275-
};
1276-
12771321
const lights = {
12781322
good: '🟢',
12791323
neutral: '🟡',
12801324
bad: '🔴'
12811325
};
12821326

1283-
sentimentEl.className = `sentiment-indicator mt-3 flex items-center justify-center space-x-2 p-2 rounded-lg ${colors[sentiment.status]}`;
1327+
sentimentEl.className = `sentiment-indicator ${sentiment.status}`;
12841328
sentimentEl.innerHTML = `
1285-
<span class="text-lg">${lights[sentiment.status]}</span>
1286-
<span class="font-medium ${textColors[sentiment.status]}">${sentiment.status.toUpperCase()}</span>
1287-
<span class="text-sm ${textColors[sentiment.status]}">${sentiment.reason}</span>
1329+
<span>${lights[sentiment.status]}</span>
1330+
<span>${sentiment.status.toUpperCase()}: ${sentiment.reason}</span>
12881331
`;
12891332
}
12901333

@@ -1333,10 +1376,10 @@ <h2 class="chart-title">🏛️ Treasury Account</h2>
13331376
'bitcoinChart': '₿ Bitcoin Price (USD)',
13341377
'm2BitcoinChart': '📈 M2 vs Bitcoin YoY',
13351378
'dxyBitcoinChart': '💵 DXY vs Bitcoin 3M',
1336-
'pmiChart': '🏭 Industrial Production',
1337-
'nfciChart': '📊 Financial Conditions',
1338-
'm2Chart': '💰 M2 Money Supply',
1339-
'tgaChart': '🏛️ Treasury Account'
1379+
'pmiChart': '🏭 Industrial Production vs Bitcoin',
1380+
'nfciChart': '📊 Financial Conditions vs Bitcoin',
1381+
'm2Chart': '💰 M2 Money Supply vs Bitcoin',
1382+
'tgaChart': '🏛️ Treasury Account vs Bitcoin'
13401383
};
13411384

13421385
// Find the canvas or restore it if it was replaced by loading/error state
@@ -1516,6 +1559,44 @@ <h2 class="chart-title">🏛️ Treasury Account</h2>
15161559
return { status: 'neutral', reason: 'Mixed currency signals' };
15171560
}
15181561

1562+
if (canvasId === 'pmiChart') {
1563+
// PMI vs Bitcoin
1564+
const bitcoinTrend = latest2 > data2[data2.length - 5]?.value ? 'rising' : 'falling';
1565+
if (latest1 > 52 && bitcoinTrend === 'rising') return { status: 'good', reason: 'Strong economy + Bitcoin gains' };
1566+
if (latest1 < 48 && bitcoinTrend === 'falling') return { status: 'bad', reason: 'Weak economy + Bitcoin decline' };
1567+
if (latest1 > 52) return { status: 'good', reason: 'Strong industrial expansion' };
1568+
return { status: 'neutral', reason: 'Mixed economic signals' };
1569+
}
1570+
1571+
if (canvasId === 'nfciChart') {
1572+
// NFCI vs Bitcoin
1573+
const bitcoinTrend = latest2 > data2[data2.length - 5]?.value ? 'rising' : 'falling';
1574+
if (latest1 < -0.5 && bitcoinTrend === 'rising') return { status: 'good', reason: 'Loose conditions + Bitcoin gains' };
1575+
if (latest1 > 0.5 && bitcoinTrend === 'falling') return { status: 'bad', reason: 'Tight conditions + Bitcoin decline' };
1576+
if (latest1 < -0.5) return { status: 'good', reason: 'Loose financial conditions' };
1577+
return { status: 'neutral', reason: 'Mixed financial signals' };
1578+
}
1579+
1580+
if (canvasId === 'm2Chart') {
1581+
// M2 vs Bitcoin
1582+
const m2Trend = latest1 > data1[data1.length - 5]?.value ? 'rising' : 'falling';
1583+
const bitcoinTrend = latest2 > data2[data2.length - 5]?.value ? 'rising' : 'falling';
1584+
if (m2Trend === 'rising' && bitcoinTrend === 'rising') return { status: 'good', reason: 'Liquidity growth + Bitcoin gains' };
1585+
if (m2Trend === 'falling' && bitcoinTrend === 'falling') return { status: 'bad', reason: 'Liquidity drain + Bitcoin decline' };
1586+
if (m2Trend === 'rising') return { status: 'good', reason: 'Increasing liquidity' };
1587+
return { status: 'neutral', reason: 'Mixed liquidity signals' };
1588+
}
1589+
1590+
if (canvasId === 'tgaChart') {
1591+
// TGA vs Bitcoin
1592+
const tgaTrend = latest1 < data1[data1.length - 5]?.value ? 'falling' : 'rising';
1593+
const bitcoinTrend = latest2 > data2[data2.length - 5]?.value ? 'rising' : 'falling';
1594+
if (tgaTrend === 'falling' && bitcoinTrend === 'rising') return { status: 'good', reason: 'Liquidity injection + Bitcoin gains' };
1595+
if (tgaTrend === 'rising' && bitcoinTrend === 'falling') return { status: 'bad', reason: 'Liquidity drain + Bitcoin decline' };
1596+
if (tgaTrend === 'falling') return { status: 'good', reason: 'Treasury liquidity injection' };
1597+
return { status: 'neutral', reason: 'Mixed treasury signals' };
1598+
}
1599+
15191600
return { status: 'neutral', reason: 'Monitoring trends' };
15201601
}
15211602

@@ -1777,7 +1858,7 @@ <h2 class="chart-title">🏛️ Treasury Account</h2>
17771858
showDataError('dxyBitcoinChart', 'DXY or Bitcoin data unavailable');
17781859
}
17791860

1780-
// Create economic indicator charts - REAL DATA ONLY
1861+
// Create economic indicator charts with Bitcoin comparison - REAL DATA ONLY
17811862
const economicCharts = [
17821863
{ key: 'pmi', id: 'pmiChart', label: 'PMI', color: '#2563eb', name: 'PMI data' },
17831864
{ key: 'nfci', id: 'nfciChart', label: 'NFCI', color: '#16a34a', name: 'NFCI data' },
@@ -1786,7 +1867,14 @@ <h2 class="chart-title">🏛️ Treasury Account</h2>
17861867
];
17871868

17881869
economicCharts.forEach(chart => {
1789-
if (chartData[chart.key] && chartData[chart.key].length > 0) {
1870+
if (chartData[chart.key] && chartData[chart.key].length > 0 && chartData.bitcoin && chartData.bitcoin.length > 0) {
1871+
// Create dual axis chart with Bitcoin comparison
1872+
const economicData = chartData[chart.key].slice(-settings.dataPoints);
1873+
const bitcoinData = chartData.bitcoin.slice(-settings.dataPoints);
1874+
createDualAxisChart(chart.id, economicData, bitcoinData, chart.label, 'Bitcoin Price', chart.color, '#f7931a');
1875+
chartsCreated++;
1876+
} else if (chartData[chart.key] && chartData[chart.key].length > 0) {
1877+
// Fallback to single chart if Bitcoin data unavailable
17901878
createChart(chart.id, chartData[chart.key].slice(-settings.dataPoints), chart.label, chart.color);
17911879
chartsCreated++;
17921880
} else {

0 commit comments

Comments
 (0)