EditProfile: fix checkboxes

This commit is contained in:
Alex Gleason 2022-04-29 16:47:24 -05:00
parent b6f1de0a58
commit a9cd4014f2
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 54 additions and 49 deletions

View File

@ -353,59 +353,64 @@ const EditProfile: React.FC = () => {
</div> </div>
</div> </div>
{features.followRequests && ( {/* HACK: wrap these checkboxes in a .simple_form container so they get styled (for now) */}
<Checkbox {/* Need a either move, replace, or refactor these checkboxes. */}
label={<FormattedMessage id='edit_profile.fields.locked_label' defaultMessage='Lock account' />} <div className='simple_form'>
hint={<FormattedMessage id='edit_profile.hints.locked' defaultMessage='Requires you to manually approve followers' />} {features.followRequests && (
checked={data.locked} <Checkbox
onChange={handleCheckboxChange('locked')} label={<FormattedMessage id='edit_profile.fields.locked_label' defaultMessage='Lock account' />}
/> hint={<FormattedMessage id='edit_profile.hints.locked' defaultMessage='Requires you to manually approve followers' />}
)} checked={data.locked}
onChange={handleCheckboxChange('locked')}
/>
)}
{features.hideNetwork && ( {features.hideNetwork && (
<Checkbox <Checkbox
label={<FormattedMessage id='edit_profile.fields.hide_network_label' defaultMessage='Hide network' />} label={<FormattedMessage id='edit_profile.fields.hide_network_label' defaultMessage='Hide network' />}
hint={<FormattedMessage id='edit_profile.hints.hide_network' defaultMessage='Who you follow and who follows you will not be shown on your profile' />} hint={<FormattedMessage id='edit_profile.hints.hide_network' defaultMessage='Who you follow and who follows you will not be shown on your profile' />}
checked={account ? hidesNetwork(account): false} checked={account ? hidesNetwork(account): false}
onChange={handleHideNetworkChange} onChange={handleHideNetworkChange}
/> />
)} )}
{features.bots && ( {features.bots && (
<Checkbox <Checkbox
label={<FormattedMessage id='edit_profile.fields.bot_label' defaultMessage='This is a bot account' />} label={<FormattedMessage id='edit_profile.fields.bot_label' defaultMessage='This is a bot account' />}
hint={<FormattedMessage id='edit_profile.hints.bot' defaultMessage='This account mainly performs automated actions and might not be monitored' />} hint={<FormattedMessage id='edit_profile.hints.bot' defaultMessage='This account mainly performs automated actions and might not be monitored' />}
checked={data.bot} checked={data.bot}
onChange={handleCheckboxChange('bot')} onChange={handleCheckboxChange('bot')}
/> />
)} )}
{/* {/*
<Checkbox
label={<FormattedMessage id='edit_profile.fields.stranger_notifications_label' defaultMessage='Block notifications from strangers' />}
hint={<FormattedMessage id='edit_profile.hints.stranger_notifications' defaultMessage='Only show notifications from people you follow' />}
checked={this.state.stranger_notifications}
onChange={this.handleCheckboxChange('stranger_notifications')}
/>
*/}
{features.profileDirectory && (
<Checkbox <Checkbox
label={<FormattedMessage id='edit_profile.fields.discoverable_label' defaultMessage='Allow account discovery' />} label={<FormattedMessage id='edit_profile.fields.stranger_notifications_label' defaultMessage='Block notifications from strangers' />}
hint={<FormattedMessage id='edit_profile.hints.discoverable' defaultMessage='Display account in profile directory and allow indexing by external services' />} hint={<FormattedMessage id='edit_profile.hints.stranger_notifications' defaultMessage='Only show notifications from people you follow' />}
checked={data.discoverable} checked={this.state.stranger_notifications}
onChange={handleCheckboxChange('discoverable')} onChange={this.handleCheckboxChange('stranger_notifications')}
/> />
)} */}
{features.profileDirectory && (
<Checkbox
label={<FormattedMessage id='edit_profile.fields.discoverable_label' defaultMessage='Allow account discovery' />}
hint={<FormattedMessage id='edit_profile.hints.discoverable' defaultMessage='Display account in profile directory and allow indexing by external services' />}
checked={data.discoverable}
onChange={handleCheckboxChange('discoverable')}
/>
)}
{features.emailList && (
<Checkbox
label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />}
hint={<FormattedMessage id='edit_profile.hints.accepts_email_list' defaultMessage='Opt-in to news and marketing updates.' />}
checked={data.accepts_email_list}
onChange={handleCheckboxChange('accepts_email_list')}
/>
)}
</div>
{features.emailList && (
<Checkbox
label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />}
hint={<FormattedMessage id='edit_profile.hints.accepts_email_list' defaultMessage='Opt-in to news and marketing updates.' />}
checked={data.accepts_email_list}
onChange={handleCheckboxChange('accepts_email_list')}
/>
)}
{/* </FieldsGroup> */} {/* </FieldsGroup> */}
{/*<FieldsGroup> {/*<FieldsGroup>
<div className='fields-row__column fields-group'> <div className='fields-row__column fields-group'>

View File

@ -82,8 +82,8 @@ interface ISimpleInput {
} }
export const SimpleInput: React.FC<ISimpleInput> = (props) => { export const SimpleInput: React.FC<ISimpleInput> = (props) => {
const { hint, label, error, ...rest } = props; const { hint, error, ...rest } = props;
const Input = label ? LabelInput : 'input'; const Input = props.label ? LabelInput : 'input';
return ( return (
<InputContainer {...props}> <InputContainer {...props}>