Handy/src/components/settings/VolumeSlider.tsx
Jackson a286fe5143
Add custom sound and control notif volume (#214)
* Add custom sound and control notif volume

* Modularize the picker and slider, consolidate the playback and loading

* Move custom sounds to advanced

* pairs of audio

* custom sound handling

---------

Co-authored-by: CJ Pais <cj@cjpais.com>
2025-10-16 09:08:27 -07:00

28 lines
776 B
TypeScript

import React from "react";
import { Slider } from "../ui/Slider";
import { useSettings } from "../../hooks/useSettings";
export const VolumeSlider: React.FC<{ disabled?: boolean }> = ({
disabled = false,
}) => {
const { getSetting, updateSetting } = useSettings();
const audioFeedbackVolume = getSetting("audio_feedback_volume") ?? 0.5;
return (
<Slider
value={audioFeedbackVolume}
onChange={(value: number) =>
updateSetting("audio_feedback_volume", value)
}
min={0}
max={1}
step={0.1}
label="Volume"
description="Adjust the volume of audio feedback sounds"
descriptionMode="tooltip"
grouped
formatValue={(value) => `${Math.round(value * 100)}%`}
disabled={disabled}
/>
);
};