import {
Callout,
Field,
} from '@rocket.chat/fuselage';
import React from 'react';
import { MarkdownText } from '../../basic/MarkdownText';
import { RawText } from '../../basic/RawText';
import { useTranslation } from '../../providers/TranslationProvider';
import { GenericSettingInput } from './inputs/GenericSettingInput';
import { BooleanSettingInput } from './inputs/BooleanSettingInput';
import { StringSettingInput } from './inputs/StringSettingInput';
import { useSetting } from './SettingsState';
export function Setting({ settingId }) {
const setting = useSetting(settingId);
const t = useTranslation();
const {
_id,
disableReset,
readonly,
type,
value,
packageValue,
blocked,
i18nLabel,
i18nDescription,
alert,
} = setting;
const label = (i18nLabel && t(i18nLabel)) || (_id || t(_id));
const hint = t.has(i18nDescription) && {t(i18nDescription)};
const callout = alert && {t(alert)};
const hasResetButton = !disableReset && !readonly && type !== 'asset' && value !== packageValue && !blocked;
const onResetButtonClick = () => {
setting.reset();
};
const inputProps = {
...setting,
label,
onChange: setting.update,
hasResetButton,
onResetButtonClick,
};
return
{(type === 'boolean' && )
|| (type === 'string' && )
// || (type === 'relativeUrl' && )
// || (type === 'password' && )
// || (type === 'int' && )
// || (type === 'select' && )
// || (type === 'language' && )
// || (type === 'color' && )
// || (type === 'font' && )
// || (type === 'code' && )
// || (type === 'action' && )
// || (type === 'asset' && )
// || (type === 'roomPick' && )
|| }
{hint && {hint}}
{callout && }
;
}