Skip to content

Commit d2274d1

Browse files
author
jacquesbach
committed
Undo forecast card styling
1 parent 796faee commit d2274d1

3 files changed

Lines changed: 14 additions & 57 deletions

File tree

static/css/style.css

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,14 @@
195195
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
196196
display: flex;
197197
flex-direction: column;
198-
justify-content: flex-start;
199-
height: 100%;
200-
box-sizing: border-box;
201-
overflow: hidden; /* Verhindert das Auslaufen des Inhalts während der Animation */
202-
transition: height 0.3s ease; /* Macht das Aufklappen geschmeidig */
198+
justify-content: center;
203199
}
204200

201+
background: var(--card-bg);
202+
203+
/* WICHTIG: Ändere 'center' auf 'flex-start' */
204+
205+
205206
.card-gradient {
206207
background: var(--gradient);
207208
color: white;

static/js/layout.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -85,37 +85,6 @@ async function resetDatabaseLayout() {
8585
}
8686
}
8787

88-
function resizeForecastCardToFit() {
89-
if (!window.dashboardGrid) return;
90-
91-
const gridItem = document.getElementById('card-forecast');
92-
const innerCard = gridItem.querySelector('.card');
93-
94-
if (!gridItem || !innerCard) return;
95-
96-
// 1. Temporär feste Höhen lösen
97-
innerCard.style.height = 'auto';
98-
innerCard.style.minHeight = 'auto';
99-
100-
// 2. Die tatsächliche Höhe messen
101-
// Wir nehmen scrollHeight, um den Inhalt außerhalb des sichtbaren Bereichs zu erfassen
102-
const requiredHeightPx = innerCard.scrollHeight;
103-
104-
// 3. Gridstack Zellen-Metriken
105-
const cellHeight = dashboardGrid.getCellHeight();
106-
const margin = dashboardGrid.getOpts().margin || 20;
107-
108-
// 4. Berechnung der benötigten Rows (h)
109-
// Wir addieren einen kleinen Puffer (10px) für Padding-Unterschiede
110-
const newH = Math.ceil((requiredHeightPx + 10) / (cellHeight + margin));
111-
112-
// 5. Update ausführen
113-
dashboardGrid.update(gridItem, { h: newH });
114-
115-
// 6. Zurück auf 100%, damit die Card-Klasse das Gridstack-Item wieder voll ausfüllt
116-
innerCard.style.height = '100%';
117-
}
118-
11988
document.addEventListener("DOMContentLoaded", async () => {
12089
// --- PHASE 1: Das Gerüst aufbauen ---
12190
initGridstack();

static/js/script.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,14 +1047,6 @@ async function loadForecast() {
10471047
}
10481048
}
10491049
});
1050-
// 1. Sicherstellen, dass die Details am Anfang ausgeblendet sind
1051-
document.getElementById("shapDetailCard").style.display = "none";
1052-
1053-
// 2. WICHTIG: Die Karte sofort an den Inhalt (Global SHAP etc.) anpassen
1054-
// Ein kleines Delay hilft, damit das Chart fertig gerendert ist
1055-
setTimeout(() => {
1056-
resizeForecastCardToFit();
1057-
}, 200);
10581050
}
10591051

10601052
async function loadFeatureImportance() {
@@ -1161,27 +1153,23 @@ function showShapDetails(point) {
11611153
const container = document.getElementById("shapForcePlot");
11621154

11631155
// ===== ResizeObserver nur einmal registrieren =====
1164-
const cardItem = document.getElementById("card-forecast");
1165-
if (!cardItem._resizeObserverAttached) {
1156+
if (!container._resizeObserverAttached) {
1157+
11661158
const observer = new ResizeObserver(() => {
1167-
// Wir nutzen einen winzigen Delay, damit Gridstack erst fertig zeichnet
1168-
clearTimeout(window._shapResizeTimer);
1169-
window._shapResizeTimer = setTimeout(() => {
1170-
if (window._lastShapPoint) {
1171-
showShapDetails(window._lastShapPoint);
1172-
}
1173-
}, 50);
1159+
if (window._lastShapPoint) {
1160+
showShapDetails(window._lastShapPoint);
1161+
}
11741162
});
1175-
observer.observe(cardItem);
1176-
cardItem._resizeObserverAttached = true;
1163+
1164+
observer.observe(container);
1165+
container._resizeObserverAttached = true;
11771166
}
11781167

11791168
container.innerHTML = "";
11801169
container.style.position = "relative";
11811170
container.style.display = "flex";
11821171
container.style.alignItems = "center";
11831172
container.style.justifyContent = "center";
1184-
container.style.width = "100%";
11851173
container.style.height = "100px";
11861174
container.style.overflow = "visible";
11871175

@@ -1415,5 +1403,4 @@ function showShapDetails(point) {
14151403
}
14161404

14171405
document.getElementById("seasonInterpretation").innerText = text;
1418-
resizeForecastCardToFit();
14191406
}

0 commit comments

Comments
 (0)