Spaces:
Running
Running
Commit ·
732db49
1
Parent(s): 52efe46
fix: sync dynamic headlines height alignment and refresh frontend cache
Browse files- static/app.js +48 -0
- static/style.css +3 -1
- templates/index.html +2 -2
static/app.js
CHANGED
|
@@ -723,6 +723,46 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 723 |
}
|
| 724 |
}
|
| 725 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 726 |
function syncThemeToggleState() {
|
| 727 |
if (!themeToggle) return;
|
| 728 |
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
|
@@ -1009,6 +1049,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 1009 |
}
|
| 1010 |
llmContainer.appendChild(div);
|
| 1011 |
}
|
|
|
|
|
|
|
| 1012 |
}
|
| 1013 |
|
| 1014 |
function updateLlmForHorizon(ticker, horizonKey, forceRefresh = false) {
|
|
@@ -1186,6 +1228,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 1186 |
latestAnalyzeHistory = normalizeHistoryPoints(data?.market?.history);
|
| 1187 |
latestAnalyzeTimeframe = getActiveTimeframe();
|
| 1188 |
try { updateDashboard(data); } catch (renderErr) { console.error('[IRIS] updateDashboard error:', renderErr); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1189 |
if (currentHorizon && currentTicker) {
|
| 1190 |
updateLlmForHorizon(currentTicker, currentHorizon, true);
|
| 1191 |
}
|
|
@@ -1384,6 +1431,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 1384 |
|
| 1385 |
window.addEventListener('resize', () => {
|
| 1386 |
resizeChartToContainer();
|
|
|
|
| 1387 |
});
|
| 1388 |
|
| 1389 |
function openFeedbackModal() {
|
|
|
|
| 723 |
}
|
| 724 |
}
|
| 725 |
|
| 726 |
+
// Headlines card height sync: keep right-column headlines card aligned with
|
| 727 |
+
// the combined height of the left-column cards.
|
| 728 |
+
function syncHeadlinesCardHeight() {
|
| 729 |
+
const headlinesCard = document.querySelector('.headlines-card');
|
| 730 |
+
if (!headlinesCard) return;
|
| 731 |
+
|
| 732 |
+
// Preserve mobile behavior where CSS intentionally removes the cap.
|
| 733 |
+
if (window.matchMedia && window.matchMedia('(max-width: 768px)').matches) {
|
| 734 |
+
headlinesCard.style.removeProperty('--headlines-card-height');
|
| 735 |
+
headlinesCard.style.removeProperty('max-height');
|
| 736 |
+
return;
|
| 737 |
+
}
|
| 738 |
+
|
| 739 |
+
const grid = document.querySelector('.dashboard-3col');
|
| 740 |
+
if (!grid) return;
|
| 741 |
+
|
| 742 |
+
const gridStyle = window.getComputedStyle(grid);
|
| 743 |
+
const gap = parseFloat(gridStyle.rowGap) || parseFloat(gridStyle.gap) || 16;
|
| 744 |
+
|
| 745 |
+
const riskCard = document.querySelector('.engine-light-card');
|
| 746 |
+
const priceCard = document.querySelector('.price-card');
|
| 747 |
+
const sentCard = document.querySelector('.sentiment-card');
|
| 748 |
+
const llmCard = document.querySelector('.llm-card');
|
| 749 |
+
|
| 750 |
+
const row1Height = Math.max(
|
| 751 |
+
riskCard?.offsetHeight || 0,
|
| 752 |
+
priceCard?.offsetHeight || 0
|
| 753 |
+
);
|
| 754 |
+
const row2Height = Math.max(
|
| 755 |
+
sentCard?.offsetHeight || 0,
|
| 756 |
+
llmCard?.offsetHeight || 0
|
| 757 |
+
);
|
| 758 |
+
|
| 759 |
+
if (row1Height > 0 && row2Height > 0) {
|
| 760 |
+
const targetHeight = row1Height + gap + row2Height;
|
| 761 |
+
headlinesCard.style.setProperty('--headlines-card-height', `${targetHeight}px`);
|
| 762 |
+
headlinesCard.style.maxHeight = `${targetHeight}px`;
|
| 763 |
+
}
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
function syncThemeToggleState() {
|
| 767 |
if (!themeToggle) return;
|
| 768 |
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
|
|
|
| 1049 |
}
|
| 1050 |
llmContainer.appendChild(div);
|
| 1051 |
}
|
| 1052 |
+
|
| 1053 |
+
requestAnimationFrame(() => syncHeadlinesCardHeight());
|
| 1054 |
}
|
| 1055 |
|
| 1056 |
function updateLlmForHorizon(ticker, horizonKey, forceRefresh = false) {
|
|
|
|
| 1228 |
latestAnalyzeHistory = normalizeHistoryPoints(data?.market?.history);
|
| 1229 |
latestAnalyzeTimeframe = getActiveTimeframe();
|
| 1230 |
try { updateDashboard(data); } catch (renderErr) { console.error('[IRIS] updateDashboard error:', renderErr); }
|
| 1231 |
+
requestAnimationFrame(() => {
|
| 1232 |
+
requestAnimationFrame(() => {
|
| 1233 |
+
syncHeadlinesCardHeight();
|
| 1234 |
+
});
|
| 1235 |
+
});
|
| 1236 |
if (currentHorizon && currentTicker) {
|
| 1237 |
updateLlmForHorizon(currentTicker, currentHorizon, true);
|
| 1238 |
}
|
|
|
|
| 1431 |
|
| 1432 |
window.addEventListener('resize', () => {
|
| 1433 |
resizeChartToContainer();
|
| 1434 |
+
syncHeadlinesCardHeight();
|
| 1435 |
});
|
| 1436 |
|
| 1437 |
function openFeedbackModal() {
|
static/style.css
CHANGED
|
@@ -481,7 +481,9 @@ header {
|
|
| 481 |
display: flex;
|
| 482 |
flex-direction: column;
|
| 483 |
overflow: hidden;
|
| 484 |
-
max-height
|
|
|
|
|
|
|
| 485 |
}
|
| 486 |
|
| 487 |
.sentiment-card {
|
|
|
|
| 481 |
display: flex;
|
| 482 |
flex-direction: column;
|
| 483 |
overflow: hidden;
|
| 484 |
+
/* No fixed max-height - JS will set it dynamically to match left columns.
|
| 485 |
+
Fallback max-height if JS is unavailable or has not run yet. */
|
| 486 |
+
max-height: var(--headlines-card-height, 480px);
|
| 487 |
}
|
| 488 |
|
| 489 |
.sentiment-card {
|
templates/index.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
})();
|
| 23 |
</script>
|
| 24 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap" rel="stylesheet">
|
| 25 |
-
<link rel="stylesheet" href="/static/style.css?v=
|
| 26 |
<link rel="icon" type="image/svg+xml"
|
| 27 |
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22 fill=%22%233b82f6%22>IA</text></svg>">
|
| 28 |
</head>
|
|
@@ -245,7 +245,7 @@
|
|
| 245 |
<script
|
| 246 |
src="https://unpkg.com/lightweight-charts@4.1.1/dist/lightweight-charts.standalone.production.js?v=4"></script>
|
| 247 |
<script src="/static/tickerValidation.js?v=1"></script>
|
| 248 |
-
<script src="/static/app.js?v=
|
| 249 |
</body>
|
| 250 |
|
| 251 |
</html>
|
|
|
|
| 22 |
})();
|
| 23 |
</script>
|
| 24 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap" rel="stylesheet">
|
| 25 |
+
<link rel="stylesheet" href="/static/style.css?v=13">
|
| 26 |
<link rel="icon" type="image/svg+xml"
|
| 27 |
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22 fill=%22%233b82f6%22>IA</text></svg>">
|
| 28 |
</head>
|
|
|
|
| 245 |
<script
|
| 246 |
src="https://unpkg.com/lightweight-charts@4.1.1/dist/lightweight-charts.standalone.production.js?v=4"></script>
|
| 247 |
<script src="/static/tickerValidation.js?v=1"></script>
|
| 248 |
+
<script src="/static/app.js?v=24"></script>
|
| 249 |
</body>
|
| 250 |
|
| 251 |
</html>
|