Jelajahi Sumber

feat(ui): restore the smooth curve in the WAN chart

Back to the monotone areas the chart had before #1790, with Bars as the only alternative view.

Part of #1975
Nacho 3 minggu lalu
induk
melakukan
eb4c1ea17c

+ 1 - 1
CHANGELOG.md

@@ -9,7 +9,7 @@ y este proyecto se adhiere a [Versionado Semántico](https://semver.org/lang/es/
 
 ### Added
 
-- The WAN traffic chart alternates Linear and Bars, with Linear as the default (#1975). The stepped line was retired; the choice is remembered per browser.
+- The WAN traffic chart alternates Curve and Bars, with Curve as the default (#1975). Curve is the smooth monotone line the chart had before #1790; the stepped variant is gone and the choice is remembered per browser.
 
 - A Send test button next to the push switch (#1973). Turning notifications on could not be checked: a push only leaves when a real urgent alert fires, so a broken setup stayed silent until an alert was missed. The button sends one notification to this device through the same path as real alerts and reports what the push service answered, including the reason on a rejection. An expired subscription is removed and the switch turns off. One test per user every ten seconds.
 

+ 1 - 1
app/public/locales/en/translation.json

@@ -660,7 +660,7 @@
       "total24h": "Total 24h",
       "uploadMbps": "Upload (Mbps)",
       "viewBars": "Bars",
-      "viewLinear": "Linear",
+      "viewCurve": "Curve",
       "viewAria": "Traffic chart view",
       "contracted": "Contracted: ↓ {{down}} / ↑ {{up}} Mbps",
       "contractedLine": "↓ {{mbps}} Mbps",

+ 1 - 1
app/public/locales/es/translation.json

@@ -660,7 +660,7 @@
       "total24h": "Total 24h",
       "uploadMbps": "Subida (Mbps)",
       "viewBars": "Barras",
-      "viewLinear": "Lineal",
+      "viewCurve": "Curva",
       "viewAria": "Vista del gráfico de tráfico",
       "contracted": "Contratado: ↓ {{down}} / ↑ {{up}} Mbps",
       "contractedLine": "↓ {{mbps}} Mbps",

+ 11 - 11
app/src/sections/WanTraffic.tsx

@@ -57,17 +57,17 @@ export function WanTraffic() {
   const { t } = useTranslation()
   const { traffic: trafficByRange, wan, isDemo } = useNetPulse()
   const [range, setRange] = useState<TimeRange>('24h')
-  // #1975: Lineal (interpola entre puntos, la vista de siempre) y Barras (una
-  // barra por bucket). La escalonada se retiro. La eleccion se recuerda por
-  // navegador y Lineal es el default.
-  const [view, setView] = useState<'linear' | 'bars'>(() => {
+  // #1975: Curva (monotone, el trazo original que pide el usuario) y Barras
+  // (una barra por bucket). La eleccion se recuerda por navegador y Curva es
+  // el default.
+  const [view, setView] = useState<'curve' | 'bars'>(() => {
     try {
-      return localStorage.getItem('netpulse.trafficView') === 'bars' ? 'bars' : 'linear'
+      return localStorage.getItem('netpulse.trafficView') === 'bars' ? 'bars' : 'curve'
     } catch {
-      return 'linear'
+      return 'curve'
     }
   })
-  const setTrafficView = (v: 'linear' | 'bars') => {
+  const setTrafficView = (v: 'curve' | 'bars') => {
     setView(v)
     try {
       localStorage.setItem('netpulse.trafficView', v)
@@ -145,11 +145,11 @@ export function WanTraffic() {
         <div className="flex shrink-0 items-center gap-2">
           <SegmentedControl
             options={[
-              { value: 'linear', label: t('home.traffic.viewLinear') },
+              { value: 'curve', label: t('home.traffic.viewCurve') },
               { value: 'bars', label: t('home.traffic.viewBars') },
             ]}
             value={view}
-            onChange={(v) => setTrafficView(v as 'linear' | 'bars')}
+            onChange={(v) => setTrafficView(v as 'curve' | 'bars')}
             size="sm"
             ariaLabel={t('home.traffic.viewAria')}
           />
@@ -216,7 +216,7 @@ export function WanTraffic() {
             ) : (
               <>
                 <Area
-                  type="linear"
+                  type="monotone"
                   dataKey="down"
                   stroke="#22D3EE"
                   strokeWidth={2}
@@ -227,7 +227,7 @@ export function WanTraffic() {
                   animationEasing="ease-out"
                 />
                 <Area
-                  type="linear"
+                  type="monotone"
                   dataKey="up"
                   stroke="#A78BFA"
                   strokeWidth={2}