fcdd30ba8f
* feat: create vite project * feat: it's alive! * feat: `make dev` working! * feat: replace custom serviceWorker with vite plugin * test: replace Jest with Vitest * fix: run prettier * fix: skip eslint for now. * chore: remove ui.old folder * refactor: replace lodash.pick with simple destructuring * fix: eslint errors (wip) * fix: eslint errors (wip) * fix: display-name eslint errors (wip) * fix: no-console eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: build * fix: pwa manifest * refactor: pwa manifest * refactor: simplify PORT configuration * refactor: rename simple JS files * test: cover playlistUtils * fix: react-image-lightbox * feat(ui): add sourcemaps to help debug issues
45 lines
1.3 KiB
React
45 lines
1.3 KiB
React
import { NumberInput, SelectInput, useTranslate } from 'react-admin'
|
|
import { useDispatch, useSelector } from 'react-redux'
|
|
import { changeGain, changePreamp } from '../actions'
|
|
|
|
export const ReplayGainToggle = (props) => {
|
|
const translate = useTranslate()
|
|
const dispatch = useDispatch()
|
|
const gainInfo = useSelector((state) => state.replayGain)
|
|
|
|
return (
|
|
<>
|
|
<SelectInput
|
|
{...props}
|
|
fullWidth
|
|
source="replayGain"
|
|
label={translate('menu.personal.options.replaygain')}
|
|
choices={[
|
|
{ id: 'none', name: 'menu.personal.options.gain.none' },
|
|
{ id: 'album', name: 'menu.personal.options.gain.album' },
|
|
{ id: 'track', name: 'menu.personal.options.gain.track' },
|
|
]}
|
|
defaultValue={gainInfo.gainMode}
|
|
onChange={(event) => {
|
|
dispatch(changeGain(event.target.value))
|
|
}}
|
|
/>
|
|
<br />
|
|
{gainInfo.gainMode !== 'none' && (
|
|
<NumberInput
|
|
{...props}
|
|
source="preAmp"
|
|
label={translate('menu.personal.options.preAmp')}
|
|
defaultValue={gainInfo.preAmp}
|
|
step={0.5}
|
|
min={-15}
|
|
max={15}
|
|
onChange={(event) => {
|
|
dispatch(changePreamp(event.target.value))
|
|
}}
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|