A free, open source, and extensible speech-to-text application that works completely offline.
slider-reset: add reset icon following existing UI pattern (#1779)
Cxkies099df58a591b
diff --git a/src/components/settings/debug/PasteDelay.tsx b/src/components/settings/debug/PasteDelay.tsxindex 8bc33a57..28e24479 100644--- a/src/components/settings/debug/PasteDelay.tsx+++ b/src/components/settings/debug/PasteDelay.tsx@@ -21,7 +21,7 @@ export const PasteDelay: React.FC<PasteDelayProps> = ({descriptionKey = "settings.debug.pasteDelay.description",}) => {const { t } = useTranslation();- const { settings, updateSetting } = useSettings();+ const { settings, updateSetting, resetSetting, isUpdating } = useSettings();const handleDelayChange = (value: number) => {updateSetting(settingKey, value);@@ -31,6 +31,8 @@ export const PasteDelay: React.FC<PasteDelayProps> = ({<Slidervalue={settings?.[settingKey] ?? 60}onChange={handleDelayChange}+ onReset={() => resetSetting(settingKey)}+ isResetting={isUpdating(settingKey)}min={10}max={500}step={10}diff --git a/src/components/settings/debug/RecordingBuffer.tsx b/src/components/settings/debug/RecordingBuffer.tsxindex 4bfc0f0d..c5cc1389 100644--- a/src/components/settings/debug/RecordingBuffer.tsx+++ b/src/components/settings/debug/RecordingBuffer.tsx@@ -13,7 +13,7 @@ export const RecordingBuffer: React.FC<RecordingBufferProps> = ({grouped = false,}) => {const { t } = useTranslation();- const { settings, updateSetting } = useSettings();+ const { settings, updateSetting, resetSetting, isUpdating } = useSettings();const handleBufferChange = (value: number) => {updateSetting("extra_recording_buffer_ms", value);@@ -23,6 +23,8 @@ export const RecordingBuffer: React.FC<RecordingBufferProps> = ({<Slidervalue={settings?.extra_recording_buffer_ms ?? 0}onChange={handleBufferChange}+ onReset={() => resetSetting("extra_recording_buffer_ms")}+ isResetting={isUpdating("extra_recording_buffer_ms")}min={0}max={1500}step={50}diff --git a/src/components/settings/debug/WordCorrectionThreshold.tsx b/src/components/settings/debug/WordCorrectionThreshold.tsxindex 5945d937..5de9fdab 100644--- a/src/components/settings/debug/WordCorrectionThreshold.tsx+++ b/src/components/settings/debug/WordCorrectionThreshold.tsx@@ -12,7 +12,7 @@ export const WordCorrectionThreshold: React.FC<WordCorrectionThresholdProps> = ({ descriptionMode = "tooltip", grouped = false }) => {const { t } = useTranslation();- const { settings, updateSetting } = useSettings();+ const { settings, updateSetting, resetSetting, isUpdating } = useSettings();const handleThresholdChange = (value: number) => {updateSetting("word_correction_threshold", value);@@ -22,6 +22,8 @@ export const WordCorrectionThreshold: React.FC<<Slidervalue={settings?.word_correction_threshold ?? 0.18}onChange={handleThresholdChange}+ onReset={() => resetSetting("word_correction_threshold")}+ isResetting={isUpdating("word_correction_threshold")}min={0.0}max={1.0}label={t("settings.debug.wordCorrectionThreshold.title")}diff --git a/src/components/ui/Slider.tsx b/src/components/ui/Slider.tsxindex aaa50bc4..c5af56b8 100644--- a/src/components/ui/Slider.tsx+++ b/src/components/ui/Slider.tsx@@ -1,5 +1,6 @@import React from "react";import { SettingContainer } from "./SettingContainer";+import { ResetButton } from "./ResetButton";interface SliderProps {value: number;@@ -14,6 +15,8 @@ interface SliderProps {grouped?: boolean;showValue?: boolean;formatValue?: (value: number) => string;+ onReset?: () => void;+ isResetting?: boolean;}export const Slider: React.FC<SliderProps> = ({@@ -29,6 +32,8 @@ export const Slider: React.FC<SliderProps> = ({grouped = false,showValue = true,formatValue = (v) => v.toFixed(2),+ onReset,+ isResetting = false,}) => {const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {onChange(parseFloat(e.target.value));@@ -67,6 +72,12 @@ export const Slider: React.FC<SliderProps> = ({{formatValue(value)}</span>)}+ {onReset && (+ <ResetButton+ onClick={onReset}+ disabled={disabled || isResetting}+ />+ )}</div></div></SettingContainer>