spb/internetpressure
Public
TypeScript 36.3%
Python 31.8%
Go 18%
JavaScript 9.8%
Shell 1.9%
SQL 1.4%
CSS 0.5%
1import type { ComponentId } from '@/lib/types';23export type MapMode = 'pressure' | 'latency' | 'loss' | 'dns' | 'routing' | 'availability' | 'incidents' | 'probes';45export const MODES: { id: MapMode; label: string; component?: ComponentId }[] = [6 { id: 'pressure', label: 'Pressure' },7 { id: 'latency', label: 'Latency', component: 'latency' },8 { id: 'loss', label: 'Packet loss' },9 { id: 'dns', label: 'DNS', component: 'dns' },10 { id: 'routing', label: 'Routing', component: 'routing' },11 { id: 'availability', label: 'Availability', component: 'availability' },12 { id: 'incidents', label: 'Incidents' },13 { id: 'probes', label: 'Probe network' },14];1516/** Packet loss (%) → pressure-like 0–100 so the same 7-colour scale applies (0 % calm … ≥ 8 % extreme). */17export function lossToScale(lossPct: number | null | undefined): number | null {18 if (lossPct == null) return null;19 return Math.min(100, (lossPct / 8) * 100);20}21