diff --git a/src/features/policies/arrange/useArrange.ts b/src/features/policies/arrange/useArrange.ts index c4e6feb5..c1231078 100644 --- a/src/features/policies/arrange/useArrange.ts +++ b/src/features/policies/arrange/useArrange.ts @@ -94,7 +94,6 @@ export function useArrange(source: Pick ({id, label: t(resolveLabels[id])})), // An untouched form is not wrong yet; submit stays disabled until it is complete. errors: { diff --git a/src/features/settings/useRuntimeSettingsForm.ts b/src/features/settings/useRuntimeSettingsForm.ts index 9281308f..fd513cdf 100644 --- a/src/features/settings/useRuntimeSettingsForm.ts +++ b/src/features/settings/useRuntimeSettingsForm.ts @@ -10,7 +10,6 @@ import { numericFieldView, recorderFields, recorderAccess, - recorderPatchValue, recorderView, recordingNote, runtimeApplyReason, @@ -76,7 +75,7 @@ export function useRuntimeSettingsForm() { })); const patch: RuntimeSettingsPatch = {}; if (baseline) { - for (const recorder of recorders) if (recorder.value !== modeOf(recorder.id)) patch[recorder.id] = recorderPatchValue(recorder.value); + for (const recorder of recorders) if (recorder.value !== modeOf(recorder.id)) patch[recorder.id] = recorder.value; if (hasLevel && level !== baseline.log?.level) patch.log = {level: level as NonNullable['level']}; for (const field of numeric) if (!field.invalid && Number(field.value) !== numericAccess[field.id].read(baseline)) numericAccess[field.id].write(patch, Number(field.value)); diff --git a/src/features/settings/view.test.ts b/src/features/settings/view.test.ts index ab46f0a2..891da3cd 100644 --- a/src/features/settings/view.test.ts +++ b/src/features/settings/view.test.ts @@ -17,7 +17,6 @@ import { profileView, recorderAccess, recorderFields, - recorderPatchValue, recorderView, flowRecordingNote, recordingNote, @@ -73,9 +72,6 @@ it('recorder controls follow the reported state and the wire form', () => { expect(forbidden.disabled).toBe(true); expect(forbidden.status).toBe('settings.recordingForbidden'); expect(recorderView('record_dns_log', 'off', undefined, t).tone).toBe('neutral'); - expect(recorderPatchValue('auto')).toBe('auto'); - expect(recorderPatchValue('on')).toBe('on'); - expect(recorderPatchValue('off')).toBe('off'); const recording = {flows: active, logs: active, dns_log: active, events: {active: false}, grace_remaining_seconds: 0} as never; expect(recordingNote(recording, t)).toBe('settings.recordingDetached'); expect(recordingNote({...(recording as object), grace_remaining_seconds: 42} as never, t)).toBe('settings.recordingGrace:{"n":42}'); diff --git a/src/features/settings/view.ts b/src/features/settings/view.ts index e44a242a..e631ddeb 100644 --- a/src/features/settings/view.ts +++ b/src/features/settings/view.ts @@ -1,5 +1,5 @@ import {formatBytes} from '../../i18n/format'; -import type {Capabilities, RecorderMode, RecorderState, RuntimeSettingField, RuntimeSettings, RuntimeSettingsPatch, GeoData, Version} from '../../api/model'; +import type {Capabilities, RecorderState, RuntimeSettingField, RuntimeSettings, RuntimeSettingsPatch, GeoData, Version} from '../../api/model'; import {engineOf} from '../../api/engines'; import {formatList, formatNumber, type Lang, type Params, type Translator} from '../../i18n'; import {href} from '../../shell/route'; @@ -18,8 +18,6 @@ export const recorderAccess: Record = {auto: 'settings.record.auto', on: 'settings.record.on', off: 'settings.record.off'}; -// The wire form is the choice itself. -export const recorderPatchValue = (choice: RecorderChoice): RecorderMode => choice; export function recorderView(id: Recorder, choice: RecorderChoice, state: RecorderState | undefined, t: Translator) { const forbidden = state ? !state.allowed : false; return { diff --git a/src/ui/charts/ShareBar.tsx b/src/ui/charts/ShareBar.tsx deleted file mode 100644 index 25d6ac79..00000000 --- a/src/ui/charts/ShareBar.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import {useT} from '../../i18n'; -import {shareDescription, useChartDescription} from './description'; -import {ChartTip, useChartTip} from './tip'; - -export type ShareSegment = {id: string; label: string; count: number; color: string; text: string}; - -// One bar split by share, left to right from the largest, with the counts in the legend under it. -export function ShareBar({label, segments}: {label: string; segments: ShareSegment[]}) { - const t = useT(); - const describedBy = useChartDescription(); - const {ref: tipRef, tip: tipState, show: showTip, hide: hideTip} = useChartTip(); - const total = segments.reduce((sum, segment) => sum + segment.count, 0); - return ( -
-
- {/* An empty share has no part of the bar; the legend still lists it with its zero. */} - {segments - .filter(segment => segment.count > 0 || !total) - .map(segment => ( - showTip(event, [segment.label, segment.text])} - /> - ))} -
-
    - {segments.map(segment => ( -
  • - - {segment.label} - {segment.text} -
  • - ))} -
- -
- ); -} diff --git a/src/ui/charts/index.ts b/src/ui/charts/index.ts index 8e0ee951..64d184bd 100644 --- a/src/ui/charts/index.ts +++ b/src/ui/charts/index.ts @@ -9,4 +9,3 @@ export {Waffle, type WaffleShare} from './Waffle'; export {MarkerPlot, type MarkerGroup, type MarkerRow, type MarkerKind} from './MarkerPlot'; export {Heatmap, type HeatRow} from './Heatmap'; export {Scatter, ScatterLegend, type ScatterPoint, type ScatterSeries} from './Scatter'; -export {ShareBar, type ShareSegment} from './ShareBar'; diff --git a/src/ui/styles/charts.css b/src/ui/styles/charts.css index fc59bb2c..d61034d3 100644 --- a/src/ui/styles/charts.css +++ b/src/ui/styles/charts.css @@ -443,45 +443,6 @@ padding-block: 4px; } -/* ---- Share bar ---- */ -.rp-sharebar { - display: flex; - flex-direction: column; - gap: 10px; -} -.rp-sharebar .bar { - display: flex; - gap: 2px; - height: 16px; - border-radius: var(--rp-r-md); - overflow: hidden; -} -.rp-sharebar .bar > i { - flex-basis: 0; - min-width: 4px; -} -.rp-sharebar .legend { - display: flex; - flex-wrap: wrap; - gap: 6px 16px; - margin: 0; - padding: 0; - list-style: none; - font-size: var(--rp-text-sm); -} -.rp-sharebar .legend li { - display: inline-flex; - align-items: center; - gap: 6px; -} -.rp-sharebar .legend .sw { - width: 10px; - height: 10px; - border-radius: 3px; -} -.rp-sharebar .legend b { - font-variant-numeric: tabular-nums; -} /* On a phone a lead tile takes the first row alone and the rest pair up below it, so the odd last tile no longer fills its row. */ @media (max-width: 599.98px) {