import React from 'react'; import * as Popover from '@radix-ui/react-popover'; import { configStore, useConfigValue } from '@plannotator/ui/config'; import { DIFF_STYLE_OPTIONS, OVERFLOW_OPTIONS, INDICATOR_OPTIONS, LINE_DIFF_OPTIONS, LINE_BG_INTENSITY_OPTIONS, } from '@plannotator/ui/components/Settings'; function CompactSegmented({ options, value, onChange }: { options: { value: T; label: string }[]; value: T; onChange: (v: T) => void; }) { return (
{options.map((opt) => ( ))}
); } function CompactStepper({ value, min, max, onChange, label }: { value: number; min: number; max: number; onChange: (v: number) => void; label: string; }) { const clamp = (n: number) => Math.max(min, Math.min(max, n)); return (
{label}
{value}
); } function CompactToggle({ checked, onChange, label }: { checked: boolean; onChange: (v: boolean) => void; label: string; }) { return ( ); } export const DiffOptionsPopover: React.FC = () => { const diffStyle = useConfigValue('diffStyle'); const diffOverflow = useConfigValue('diffOverflow'); const diffIndicators = useConfigValue('diffIndicators'); const diffLineDiffType = useConfigValue('diffLineDiffType'); const diffShowLineNumbers = useConfigValue('diffShowLineNumbers'); const diffShowBackground = useConfigValue('diffShowBackground'); const diffHideWhitespace = useConfigValue('diffHideWhitespace'); const diffExpandUnchanged = useConfigValue('diffExpandUnchanged'); const diffTabSize = useConfigValue('diffTabSize'); const diffLineBgIntensity = useConfigValue('diffLineBgIntensity'); return (
Layout
configStore.set('diffStyle', v)} />
configStore.set('diffOverflow', v)} />
Indicators
configStore.set('diffIndicators', v)} />
Inline diff
configStore.set('diffLineDiffType', v)} />
configStore.set('diffShowLineNumbers', v)} label="Line numbers" /> configStore.set('diffShowBackground', v)} label="Diff background" /> {diffShowBackground && (
configStore.set('diffLineBgIntensity', v)} />
)} configStore.set('diffExpandUnchanged', v)} label="Full file context" /> configStore.set('diffHideWhitespace', v)} label="Hide whitespace" /> configStore.set('diffTabSize', v)} />
); };