Преглед изворни кода

feat(ui): keep linear and bars in the WAN chart

The stepped line is gone; Linear (default) and Bars remain, with the choice remembered per browser.

Part of #1975
Nacho пре 3 недеља
родитељ
комит
e3d4e0d54c

+ 2 - 2
CHANGELOG.md

@@ -9,11 +9,11 @@ y este proyecto se adhiere a [Versionado Semántico](https://semver.org/lang/es/
 
 ### Added
 
-- The WAN traffic chart alternates Linear, Line and Bars, with Linear as the default (#1975). Linear interpolates between buckets for a continuous curve, Line keeps its stepped shape, and the choice is remembered per browser next to the existing Bars view.
+- 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.
 
 - 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.
 
-- The WAN traffic chart can draw bars instead of the line (#1975). A switch next to the range selector picks Linear, Line or Bars and remembers the choice in the browser. Nothing changes on the server.
+- The WAN traffic chart can draw bars instead of the line (#1975). A switch next to the range selector picks Linear or Bars and remembers the choice in the browser. Nothing changes on the server.
 
 ### Changed
 

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

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

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

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

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

@@ -57,18 +57,17 @@ export function WanTraffic() {
   const { t } = useTranslation()
   const { traffic: trafficByRange, wan, isDemo } = useNetPulse()
   const [range, setRange] = useState<TimeRange>('24h')
-  // #1975: Line es escalonada (stepAfter); Linear interpola entre puntos;
-  // Bars pinta una barra por bucket. La eleccion se recuerda por navegador.
-  const [view, setView] = useState<'line' | 'linear' | 'bars'>(() => {
+  // #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'>(() => {
     try {
-      const saved = localStorage.getItem('netpulse.trafficView')
-      if (saved === 'line' || saved === 'linear' || saved === 'bars') return saved
-      return 'linear' // default desde el 8-Nov: curva continua
+      return localStorage.getItem('netpulse.trafficView') === 'bars' ? 'bars' : 'linear'
     } catch {
       return 'linear'
     }
   })
-  const setTrafficView = (v: 'line' | 'linear' | 'bars') => {
+  const setTrafficView = (v: 'linear' | 'bars') => {
     setView(v)
     try {
       localStorage.setItem('netpulse.trafficView', v)
@@ -146,12 +145,11 @@ export function WanTraffic() {
         <div className="flex shrink-0 items-center gap-2">
           <SegmentedControl
             options={[
-              { value: 'line', label: t('home.traffic.viewLine') },
               { value: 'linear', label: t('home.traffic.viewLinear') },
               { value: 'bars', label: t('home.traffic.viewBars') },
             ]}
             value={view}
-            onChange={(v) => setTrafficView(v as 'line' | 'linear' | 'bars')}
+            onChange={(v) => setTrafficView(v as 'linear' | 'bars')}
             size="sm"
             ariaLabel={t('home.traffic.viewAria')}
           />
@@ -218,7 +216,7 @@ export function WanTraffic() {
             ) : (
               <>
                 <Area
-                  type={view === 'linear' ? 'linear' : 'stepAfter'}
+                  type="linear"
                   dataKey="down"
                   stroke="#22D3EE"
                   strokeWidth={2}
@@ -229,7 +227,7 @@ export function WanTraffic() {
                   animationEasing="ease-out"
                 />
                 <Area
-                  type={view === 'linear' ? 'linear' : 'stepAfter'}
+                  type="linear"
                   dataKey="up"
                   stroke="#A78BFA"
                   strokeWidth={2}