Spaces:
Sleeping
Sleeping
UI Fix: Enable scrolling + Hybrid V1/V2 Metrics Layout
Browse files- static/script.js +11 -12
static/script.js
CHANGED
|
@@ -22,7 +22,6 @@ async function runAnalysis() {
|
|
| 22 |
body: formData
|
| 23 |
});
|
| 24 |
|
| 25 |
-
// Check for HTTP errors (like 500)
|
| 26 |
if (!response.ok) {
|
| 27 |
const errorText = await response.text();
|
| 28 |
throw new Error(`Server Error (${response.status}): ${errorText}`);
|
|
@@ -39,7 +38,7 @@ async function runAnalysis() {
|
|
| 39 |
|
| 40 |
// UI State: Done
|
| 41 |
loader.style.display = 'none';
|
| 42 |
-
dashboard.style.display = '
|
| 43 |
|
| 44 |
} catch (e) {
|
| 45 |
console.error(e);
|
|
@@ -49,8 +48,7 @@ async function runAnalysis() {
|
|
| 49 |
}
|
| 50 |
|
| 51 |
function updateDashboard(data) {
|
| 52 |
-
// 1. Executive Commentary
|
| 53 |
-
// Safe check if advisory exists
|
| 54 |
if (data.advisory && data.advisory.commentary) {
|
| 55 |
document.getElementById('exec-summary-content').innerHTML = data.advisory.commentary;
|
| 56 |
document.getElementById('m-price').textContent = `$${data.advisory.low} - $${data.advisory.high}`;
|
|
@@ -59,12 +57,15 @@ function updateDashboard(data) {
|
|
| 59 |
statusEl.textContent = data.advisory.sentiment;
|
| 60 |
statusEl.style.color = data.advisory.color;
|
| 61 |
|
| 62 |
-
//
|
| 63 |
-
const formatNum = (num) => (num ? num.toFixed(1) + "x" : "--");
|
| 64 |
|
| 65 |
-
|
| 66 |
-
document.getElementById('m-
|
| 67 |
-
document.getElementById('m-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
|
|
@@ -90,13 +91,11 @@ function updateDashboard(data) {
|
|
| 90 |
|
| 91 |
if (data.comparables) {
|
| 92 |
data.comparables.forEach(c => {
|
| 93 |
-
// Colors for Rule of 40
|
| 94 |
const r40Color = c.rule_40 < 40 ? '#fa5c5c' : '#5cfa85';
|
| 95 |
-
|
| 96 |
const row = `
|
| 97 |
<tr>
|
| 98 |
<td style="font-weight:bold; color:var(--primary-gold)">${c.ticker}</td>
|
| 99 |
-
<td>$${(c.market_cap / 1e9).toFixed(
|
| 100 |
<td>${c.ev_rev ? c.ev_rev.toFixed(1) + 'x' : 'N/A'}</td>
|
| 101 |
<td style="color:${r40Color}">${c.rule_40 ? c.rule_40.toFixed(0) : '--'}</td>
|
| 102 |
<td>${c.growth ? (c.growth * 100).toFixed(0) + '%' : 'N/A'}</td>
|
|
|
|
| 22 |
body: formData
|
| 23 |
});
|
| 24 |
|
|
|
|
| 25 |
if (!response.ok) {
|
| 26 |
const errorText = await response.text();
|
| 27 |
throw new Error(`Server Error (${response.status}): ${errorText}`);
|
|
|
|
| 38 |
|
| 39 |
// UI State: Done
|
| 40 |
loader.style.display = 'none';
|
| 41 |
+
dashboard.style.display = 'flex'; // Changed to flex to match CSS
|
| 42 |
|
| 43 |
} catch (e) {
|
| 44 |
console.error(e);
|
|
|
|
| 48 |
}
|
| 49 |
|
| 50 |
function updateDashboard(data) {
|
| 51 |
+
// 1. Executive Commentary
|
|
|
|
| 52 |
if (data.advisory && data.advisory.commentary) {
|
| 53 |
document.getElementById('exec-summary-content').innerHTML = data.advisory.commentary;
|
| 54 |
document.getElementById('m-price').textContent = `$${data.advisory.low} - $${data.advisory.high}`;
|
|
|
|
| 57 |
statusEl.textContent = data.advisory.sentiment;
|
| 58 |
statusEl.style.color = data.advisory.color;
|
| 59 |
|
| 60 |
+
// --- METRICS MAPPING ---
|
|
|
|
| 61 |
|
| 62 |
+
// Row 1: Classics
|
| 63 |
+
document.getElementById('m-momentum').textContent = (data.metrics.avg_momentum ? data.metrics.avg_momentum.toFixed(1) + "%" : "--");
|
| 64 |
+
document.getElementById('m-beta').textContent = (data.metrics.avg_beta ? data.metrics.avg_beta.toFixed(2) : "--");
|
| 65 |
+
|
| 66 |
+
// Row 2: V2 Intelligence
|
| 67 |
+
document.getElementById('m-rule-40').textContent = (data.metrics.avg_rule_40 ? data.metrics.avg_rule_40.toFixed(0) : "--");
|
| 68 |
+
document.getElementById('m-vix').textContent = (data.macro ? data.macro.vix.toFixed(2) : "--");
|
| 69 |
}
|
| 70 |
|
| 71 |
|
|
|
|
| 91 |
|
| 92 |
if (data.comparables) {
|
| 93 |
data.comparables.forEach(c => {
|
|
|
|
| 94 |
const r40Color = c.rule_40 < 40 ? '#fa5c5c' : '#5cfa85';
|
|
|
|
| 95 |
const row = `
|
| 96 |
<tr>
|
| 97 |
<td style="font-weight:bold; color:var(--primary-gold)">${c.ticker}</td>
|
| 98 |
+
<td>$${(c.market_cap / 1e9).toFixed(1)}B</td>
|
| 99 |
<td>${c.ev_rev ? c.ev_rev.toFixed(1) + 'x' : 'N/A'}</td>
|
| 100 |
<td style="color:${r40Color}">${c.rule_40 ? c.rule_40.toFixed(0) : '--'}</td>
|
| 101 |
<td>${c.growth ? (c.growth * 100).toFixed(0) + '%' : 'N/A'}</td>
|