Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(dashboard): make the trend line fill the tile it lives in

Juan Denis9c2901e18e7d
diff --git a/frontend/src/components/dashboard/widgets/renderers.jsx b/frontend/src/components/dashboard/widgets/renderers.jsx
index 4152bb12..46937784 100644
--- a/frontend/src/components/dashboard/widgets/renderers.jsx
+++ b/frontend/src/components/dashboard/widgets/renderers.jsx
@@ -23,7 +23,7 @@ import {
ShieldCheck,
Terminal,
} from 'lucide-react';
-import { Gauge, Pill, Sparkline } from '@/components/ds';
+import { Gauge, Pill } from '@/components/ds';
import { getWidgetType } from './registry';
import {
aggregate,
@@ -206,7 +206,11 @@ function WStat({ cfg, ctx }) {
</div>
{cfg.spark !== false && (
<div className="skw-stat__spark">
- <Sparkline data={series} color={color} width={220} height={40} />
+ {/* WidgetChart, not ds/Sparkline: the latter renders a
+ fixed-width SVG (width={220}), so in a tile of any other
+ size the trend line stopped short and left dead space to
+ its right. This one is viewBox-based and fills. */}
+ <WidgetChart series={[series]} colors={[color]} fill grid={false} height="100%" />
</div>
)}
</div>
diff --git a/frontend/src/styles/components/_dashboard-widgets.scss b/frontend/src/styles/components/_dashboard-widgets.scss
index 3cceab7a..a1c6c5c4 100644
--- a/frontend/src/styles/components/_dashboard-widgets.scss
+++ b/frontend/src/styles/components/_dashboard-widgets.scss
@@ -566,10 +566,19 @@ $skw-z-tv: 200;
// Negative side margins cancel the padding so the series bleeds to the
// frame edge rather than floating in a box (same trick as .sk-kpi__spark).
&__spark {
+ // Takes the tile's leftover height rather than a fixed sliver, so a
+ // taller stat widget grows its trend line instead of banking dead
+ // space under the value. `min-height: 0` lets it shrink in a 2-row
+ // tile without pushing the meta row out.
margin-top: auto;
margin-left: -2px;
margin-right: -2px;
line-height: 0;
+ flex: 1 1 auto;
+ min-height: 34px;
+ display: flex;
+
+ > svg { flex: 1; }
}
}