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.

refactor(ui): move widget/skeleton static inline styles into SCSS

Juan Denis5a297adf97fa
diff --git a/frontend/src/components/EnvironmentVariables.jsx b/frontend/src/components/EnvironmentVariables.jsx
index aea4730b..2e68bfec 100644
--- a/frontend/src/components/EnvironmentVariables.jsx
+++ b/frontend/src/components/EnvironmentVariables.jsx
@@ -689,7 +689,7 @@ const EnvironmentVariables = ({ appId }) => {
ref={fileInputRef}
accept=".env,.txt"
onChange={handleFileUpload}
- style={{ display: 'none' }}
+ className="hidden"
/>
<Button variant="outline" onClick={() => fileInputRef.current?.click()}>
{t('app.environmentVariables.chooseFile', 'Choose File')}
diff --git a/frontend/src/components/PageSkeleton.jsx b/frontend/src/components/PageSkeleton.jsx
index c23e4539..d886e8de 100644
--- a/frontend/src/components/PageSkeleton.jsx
+++ b/frontend/src/components/PageSkeleton.jsx
@@ -237,7 +237,7 @@ function TreeSkeleton({ rows }) {
<div className="sk-page__rail">
<Skeleton variant="block" height={32} radius={8} />
{range(rows).map((i) => (
- <div className="sk-page__twig" key={i} style={{ paddingLeft: `${(i % 3) * 14}px` }}>
+ <div className="sk-page__twig" key={i}>
<Skeleton variant="block" width={14} height={14} radius={4} />
<Skeleton variant="line" width={raggedWidth(i, [70, 88, 56, 78, 64, 92])} height={10} />
</div>
diff --git a/frontend/src/components/dashboard/widgets/renderers.jsx b/frontend/src/components/dashboard/widgets/renderers.jsx
index cce36cae..4a9fd2ec 100644
--- a/frontend/src/components/dashboard/widgets/renderers.jsx
+++ b/frontend/src/components/dashboard/widgets/renderers.jsx
@@ -183,7 +183,8 @@ function WidgetChart({
<svg
viewBox={`0 0 ${w} ${h}`}
preserveAspectRatio="none"
- style={{ width: '100%', height, display: 'block' }}
+ className="skw-chart__svg"
+ style={{ height }}
aria-hidden="true"
>
<defs>
@@ -423,7 +424,7 @@ function WGauge({ cfg, ctx }) {
return (
<div className="skw-gauge">
- <svg viewBox="0 0 140 82" style={{ width: '100%', maxWidth: 200 }} role="img" aria-label={`${metric.label} ${formatValue(value, metric.unit)}`}>
+ <svg viewBox="0 0 140 82" className="skw-gauge__svg" role="img" aria-label={`${metric.label} ${formatValue(value, metric.unit)}`}>
<path d={GAUGE_PATH} fill="none" stroke="var(--surface-3)" strokeWidth="12" strokeLinecap="round" />
<path
d={GAUGE_PATH}
@@ -433,7 +434,7 @@ function WGauge({ cfg, ctx }) {
strokeLinecap="round"
strokeDasharray={`${(GAUGE_ARC * ratio).toFixed(1)} ${GAUGE_ARC.toFixed(1)}`}
/>
- <text x="70" y="63" textAnchor="middle" fill={color} style={{ font: '600 24px var(--sans)' }}>
+ <text x="70" y="63" textAnchor="middle" fill={color}>
{formatValue(value, metric.unit)}
</text>
</svg>
diff --git a/frontend/src/pages/FileManager.jsx b/frontend/src/pages/FileManager.jsx
index ed5eb49d..8d715330 100644
--- a/frontend/src/pages/FileManager.jsx
+++ b/frontend/src/pages/FileManager.jsx
@@ -880,7 +880,7 @@ function FileManager() {
type="file"
ref={fileInputRef}
multiple
- style={{ display: 'none' }}
+ className="hidden"
onChange={handleUploadInput}
/>
diff --git a/frontend/src/styles/components/_dashboard-widgets.scss b/frontend/src/styles/components/_dashboard-widgets.scss
index 09662d4c..480bf532 100644
--- a/frontend/src/styles/components/_dashboard-widgets.scss
+++ b/frontend/src/styles/components/_dashboard-widgets.scss
@@ -786,6 +786,15 @@ $skw-z-tv: 200;
color: var(--text-faint);
font-size: 10.5px;
}
+
+ &__svg {
+ width: 100%;
+ max-width: 200px;
+
+ text {
+ font: 600 24px var(--sans);
+ }
+ }
}
// ---- topn: ranked bars --------------------------------------
@@ -1739,6 +1748,13 @@ $skw-z-tv: 200;
> svg { flex: 1; min-height: 0; }
+ // Also used bare (outside .skw-chart) by the stat widget's sparkline,
+ // where the svg fills the tile on its own.
+ &__svg {
+ display: block;
+ width: 100%;
+ }
+
&__cross {
position: absolute;
top: 0;
diff --git a/frontend/src/styles/components/_skeleton.scss b/frontend/src/styles/components/_skeleton.scss
index 8360f8ce..46f15ab4 100644
--- a/frontend/src/styles/components/_skeleton.scss
+++ b/frontend/src/styles/components/_skeleton.scss
@@ -403,6 +403,12 @@
display: flex;
align-items: center;
gap: $space-2;
+
+ // Decorative depth stagger. Twigs start as the rail's second child
+ // (after the leading block), which offsets the 3-cycle by two —
+ // hence 3n / 3n+1 rather than 3n+2 / 3n.
+ &:nth-child(3n) { padding-left: 14px; }
+ &:nth-child(3n + 1) { padding-left: 28px; }
}
@media (max-width: $breakpoint-md) {