Skip to content

Commit 796faee

Browse files
author
jacquesbach
committed
Change Forecast Card Styles
1 parent c9ded83 commit 796faee

3 files changed

Lines changed: 25 additions & 10 deletions

File tree

static/css/style.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,16 @@
198198
justify-content: flex-start;
199199
height: 100%;
200200
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 */
201203
}
202204

203205
.card-gradient {
204206
background: var(--gradient);
205207
color: white;
206208
box-shadow: 0 15px 35px rgba(255, 75, 114, 0.25);
207209
}
208-
210+
209211
.card-gradient .label {
210212
color: rgba(255, 255, 255, 0.85);
211213
font-size: 0.9em;

static/js/layout.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,27 @@ function resizeForecastCardToFit() {
9393

9494
if (!gridItem || !innerCard) return;
9595

96-
// 1. Wir erlauben der Karte kurz, ihre natürliche, volle Höhe anzunehmen
96+
// 1. Temporär feste Höhen lösen
9797
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
98102
const requiredHeightPx = innerCard.scrollHeight;
99-
100-
// 2. Zurücksetzen für das Flex-Layout
101-
innerCard.style.height = '100%';
102103

103-
// 3. Höhe einer einzelnen Gridstack-Zelle plus Margin abrufen
104-
const cellHeight = dashboardGrid.getCellHeight();
104+
// 3. Gridstack Zellen-Metriken
105+
const cellHeight = dashboardGrid.getCellHeight();
105106
const margin = dashboardGrid.getOpts().margin || 20;
106107

107-
// 4. Ausrechnen, wie viele "Blöcke" (h) wir brauchen, aufgerundet
108-
const newH = Math.ceil((requiredHeightPx + margin) / (cellHeight + margin));
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));
109111

110-
// 5. Gridstack anweisen, die neue Höhe anzuwenden
112+
// 5. Update ausführen
111113
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%';
112117
}
113118

114119
document.addEventListener("DOMContentLoaded", async () => {

static/js/script.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,14 @@ 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);
10501058
}
10511059

10521060
async function loadFeatureImportance() {

0 commit comments

Comments
 (0)