import { useState } from 'react' import { ChoiceButton } from 'shared/components/choice-button.mjs' import { ControlSettings } from 'shared/components/account/control.mjs' // Shared input for list inputs export const ListSetting = ({ name, list, config, current, update, t }) => { if (typeof current === 'undefined') current = config.dflt const [value, setValue] = useState(current) const handleChange = (newCurrent) => { if (newCurrent === config.dflt) reset() else { update.ui([name], newCurrent) setValue(newCurrent) } } const reset = () => { update.ui([name]) setValue(config.dflt) } return ( <>
{t(`ui-settings:${name}.d`)}
{config.list.map((entry) => ({t(`ui-settings:${name}.d`)}