Procházet zdrojové kódy

fix(channelplan): always show the score strip and tighten the spectrum axis (#1079)

The spectrum card (chart, score strip and legend) was gated on the
radio seeing at least one network, so on an empty band - where the
scores matter most - the whole panel vanished. Render it always and
only gate the networks table; an inline note still flags the empty
band. The frequency axis range is tightened to the real extent of the
bells so 2.4 GHz no longer shows dead space before channel 1 and
after 13 (and 5 GHz drops the padding past 165).
Nacho před 2 měsíci
rodič
revize
ee04707d3d

+ 4 - 2
app/src/components/channels/ChannelSpectrum.tsx

@@ -20,8 +20,10 @@ export interface SpectrumNet {
 }
 }
 
 
 export const BAND_RANGE: Record<string, [number, number]> = {
 export const BAND_RANGE: Record<string, [number, number]> = {
-  '2.4 GHz': [2401, 2495],
-  '5 GHz': [5170, 5895],
+  // Ajustados a la extensión real de las campanas (#1076): antes el margen
+  // sobrante dejaba hueco antes del ch1 y después del 13 (y tras el 165).
+  '2.4 GHz': [2402, 2482],
+  '5 GHz': [5170, 5862],
   '6 GHz': [5955, 7115],
   '6 GHz': [5955, 7115],
 }
 }
 
 

+ 12 - 11
app/src/pages/ChannelPlan.tsx

@@ -550,19 +550,20 @@ export default function ChannelPlan() {
             </div>
             </div>
           </div>
           </div>
 
 
-          {bandScans.length === 0 ? (
-            <p className="rounded-2xl border border-border bg-surface px-4 py-3 text-caption text-warn">{t('channelPlan.noScans')}</p>
-          ) : (
-            <>
-              {/* Espectro a todo lo ancho (#1076); la puntuación baja a una
-                  tira debajo, agrupada por congestión */}
-              <div>
-                <div className="rounded-2xl border border-border bg-surface">
+          {/* Espectro a todo lo ancho (#1076); la puntuación baja a una
+              tira debajo, agrupada por congestión. Espectro, tira y leyenda
+              se muestran SIEMPRE (#1077): en una banda sin vecinos la
+              puntuación es justo lo más útil (todo limpio, elige canal). */}
+          <div>
+            <div className="rounded-2xl border border-border bg-surface">
                   <div className="flex items-start justify-between gap-3 px-5 pt-4">
                   <div className="flex items-start justify-between gap-3 px-5 pt-4">
                     <div>
                     <div>
                       <h2 className="text-sm font-bold text-text-primary">{t('channelPlan.chartTitle', { band: active.name })}</h2>
                       <h2 className="text-sm font-bold text-text-primary">{t('channelPlan.chartTitle', { band: active.name })}</h2>
                       <p className="mt-0.5 text-caption text-text-muted">{t('channelPlan.chartSub')}</p>
                       <p className="mt-0.5 text-caption text-text-muted">{t('channelPlan.chartSub')}</p>
                     </div>
                     </div>
+                    {bandScans.length === 0 && (
+                      <span className="rounded-lg bg-warn/10 px-2.5 py-1 text-caption text-warn">{t('channelPlan.noBandScans')}</span>
+                    )}
                     <span className="rounded-full bg-elevated px-2.5 py-1 text-caption font-semibold text-text-secondary">
                     <span className="rounded-full bg-elevated px-2.5 py-1 text-caption font-semibold text-text-secondary">
                       {t('channelPlan.netsCount', { n: nets.length })}
                       {t('channelPlan.netsCount', { n: nets.length })}
                     </span>
                     </span>
@@ -746,7 +747,8 @@ export default function ChannelPlan() {
                 </div>
                 </div>
               </div>
               </div>
 
 
-              {/* Tabla de redes */}
+              {/* Tabla de redes (solo si hay scans) */}
+              {bandScans.length > 0 && (
               <div className="overflow-hidden rounded-2xl border border-border bg-surface">
               <div className="overflow-hidden rounded-2xl border border-border bg-surface">
                 <div className="px-5 pt-4">
                 <div className="px-5 pt-4">
                   <h2 className="text-sm font-bold text-text-primary">{t('channelPlan.summaryNetworks')}</h2>
                   <h2 className="text-sm font-bold text-text-primary">{t('channelPlan.summaryNetworks')}</h2>
@@ -825,8 +827,7 @@ export default function ChannelPlan() {
                   </table>
                   </table>
                 </div>
                 </div>
               </div>
               </div>
-            </>
-          )}
+              )}
         </>
         </>
       )}
       )}
     </div>
     </div>