[Glitch] Change to single opt-in during profile setup in onboarding in web UI
Port 0e9801443f to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
			
			
This commit is contained in:
		
							parent
							
								
									bacb9134cc
								
							
						
					
					
						commit
						b534532eaf
					
				| 
						 | 
					@ -5,8 +5,8 @@ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
 | 
				
			||||||
import classNames from 'classnames';
 | 
					import classNames from 'classnames';
 | 
				
			||||||
import { useHistory } from 'react-router-dom';
 | 
					import { useHistory } from 'react-router-dom';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { useDispatch } from 'react-redux';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { useDispatch } from 'react-redux';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { ReactComponent as AddPhotoAlternateIcon } from '@material-symbols/svg-600/outlined/add_photo_alternate.svg';
 | 
					import { ReactComponent as AddPhotoAlternateIcon } from '@material-symbols/svg-600/outlined/add_photo_alternate.svg';
 | 
				
			||||||
import { ReactComponent as EditIcon } from '@material-symbols/svg-600/outlined/edit.svg';
 | 
					import { ReactComponent as EditIcon } from '@material-symbols/svg-600/outlined/edit.svg';
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,6 @@ export const Profile = () => {
 | 
				
			||||||
  const [avatar, setAvatar] = useState(null);
 | 
					  const [avatar, setAvatar] = useState(null);
 | 
				
			||||||
  const [header, setHeader] = useState(null);
 | 
					  const [header, setHeader] = useState(null);
 | 
				
			||||||
  const [discoverable, setDiscoverable] = useState(account.get('discoverable'));
 | 
					  const [discoverable, setDiscoverable] = useState(account.get('discoverable'));
 | 
				
			||||||
  const [indexable, setIndexable] = useState(account.get('indexable'));
 | 
					 | 
				
			||||||
  const [isSaving, setIsSaving] = useState(false);
 | 
					  const [isSaving, setIsSaving] = useState(false);
 | 
				
			||||||
  const [errors, setErrors] = useState();
 | 
					  const [errors, setErrors] = useState();
 | 
				
			||||||
  const avatarFileRef = createRef();
 | 
					  const avatarFileRef = createRef();
 | 
				
			||||||
| 
						 | 
					@ -54,10 +53,6 @@ export const Profile = () => {
 | 
				
			||||||
    setDiscoverable(e.target.checked);
 | 
					    setDiscoverable(e.target.checked);
 | 
				
			||||||
  }, [setDiscoverable]);
 | 
					  }, [setDiscoverable]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const handleIndexableChange = useCallback(e => {
 | 
					 | 
				
			||||||
    setIndexable(e.target.checked);
 | 
					 | 
				
			||||||
  }, [setIndexable]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const handleAvatarChange = useCallback(e => {
 | 
					  const handleAvatarChange = useCallback(e => {
 | 
				
			||||||
    setAvatar(e.target?.files?.[0]);
 | 
					    setAvatar(e.target?.files?.[0]);
 | 
				
			||||||
  }, [setAvatar]);
 | 
					  }, [setAvatar]);
 | 
				
			||||||
| 
						 | 
					@ -78,12 +73,12 @@ export const Profile = () => {
 | 
				
			||||||
      avatar,
 | 
					      avatar,
 | 
				
			||||||
      header,
 | 
					      header,
 | 
				
			||||||
      discoverable,
 | 
					      discoverable,
 | 
				
			||||||
      indexable,
 | 
					      indexable: discoverable,
 | 
				
			||||||
    })).then(() => history.push('/start/follows')).catch(err => {
 | 
					    })).then(() => history.push('/start/follows')).catch(err => {
 | 
				
			||||||
      setIsSaving(false);
 | 
					      setIsSaving(false);
 | 
				
			||||||
      setErrors(err.response.data.details);
 | 
					      setErrors(err.response.data.details);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }, [dispatch, displayName, note, avatar, header, discoverable, indexable, history]);
 | 
					  }, [dispatch, displayName, note, avatar, header, discoverable, history]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <>
 | 
					    <>
 | 
				
			||||||
| 
						 | 
					@ -141,17 +136,20 @@ export const Profile = () => {
 | 
				
			||||||
              <textarea id='note' value={note} onChange={handleNoteChange} maxLength={500} />
 | 
					              <textarea id='note' value={note} onChange={handleNoteChange} maxLength={500} />
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          <label className='app-form__toggle'>
 | 
				
			||||||
 | 
					            <div className='app-form__toggle__label'>
 | 
				
			||||||
 | 
					              <strong><FormattedMessage id='onboarding.profile.discoverable' defaultMessage='Make my profile discoverable' /></strong> <span className='recommended'><FormattedMessage id='recommended' defaultMessage='Recommended' /></span>
 | 
				
			||||||
 | 
					              <span className='hint'><FormattedMessage id='onboarding.profile.discoverable_hint' defaultMessage='When you opt in to discoverability on Mastodon, your posts may appear in search results and trending, and your profile may be suggested to people with similar interests to you.' /></span>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <label className='report-dialog-modal__toggle'>
 | 
					            <div className='app-form__toggle__toggle'>
 | 
				
			||||||
 | 
					              <div>
 | 
				
			||||||
                <Toggle checked={discoverable} onChange={handleDiscoverableChange} />
 | 
					                <Toggle checked={discoverable} onChange={handleDiscoverableChange} />
 | 
				
			||||||
          <FormattedMessage id='onboarding.profile.discoverable' defaultMessage='Feature profile and posts in discovery algorithms' />
 | 
					              </div>
 | 
				
			||||||
        </label>
 | 
					            </div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <label className='report-dialog-modal__toggle'>
 | 
					 | 
				
			||||||
          <Toggle checked={indexable} onChange={handleIndexableChange} />
 | 
					 | 
				
			||||||
          <FormattedMessage id='onboarding.profile.indexable' defaultMessage='Include public posts in search results' />
 | 
					 | 
				
			||||||
          </label>
 | 
					          </label>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div className='onboarding__footer'>
 | 
					        <div className='onboarding__footer'>
 | 
				
			||||||
          <Button block onClick={handleSubmit} disabled={isSaving}>{isSaving ? <LoadingIndicator /> : <FormattedMessage id='onboarding.profile.save_and_continue' defaultMessage='Save and continue' />}</Button>
 | 
					          <Button block onClick={handleSubmit} disabled={isSaving}>{isSaving ? <LoadingIndicator /> : <FormattedMessage id='onboarding.profile.save_and_continue' defaultMessage='Save and continue' />}</Button>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1224,10 +1224,6 @@ code {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.app-form {
 | 
					.app-form {
 | 
				
			||||||
  & > * {
 | 
					 | 
				
			||||||
    margin-bottom: 16px;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  &__avatar-input,
 | 
					  &__avatar-input,
 | 
				
			||||||
  &__header-input {
 | 
					  &__header-input {
 | 
				
			||||||
    display: block;
 | 
					    display: block;
 | 
				
			||||||
| 
						 | 
					@ -1292,4 +1288,49 @@ code {
 | 
				
			||||||
  &__header-input {
 | 
					  &__header-input {
 | 
				
			||||||
    aspect-ratio: 580/193;
 | 
					    aspect-ratio: 580/193;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  &__toggle {
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    align-items: center;
 | 
				
			||||||
 | 
					    gap: 16px;
 | 
				
			||||||
 | 
					    color: $darker-text-color;
 | 
				
			||||||
 | 
					    font-size: 14px;
 | 
				
			||||||
 | 
					    line-height: 20px;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .icon {
 | 
				
			||||||
 | 
					      flex: 0 0 auto;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .icon {
 | 
				
			||||||
 | 
					      width: 24px;
 | 
				
			||||||
 | 
					      height: 24px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    &__label {
 | 
				
			||||||
 | 
					      flex: 1 1 auto;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      strong {
 | 
				
			||||||
 | 
					        color: $primary-text-color;
 | 
				
			||||||
 | 
					        font-weight: 600;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      .recommended {
 | 
				
			||||||
 | 
					        position: absolute;
 | 
				
			||||||
 | 
					        margin: 0 4px;
 | 
				
			||||||
 | 
					        margin-top: -2px;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    &__toggle {
 | 
				
			||||||
 | 
					      flex: 0 0 auto;
 | 
				
			||||||
 | 
					      display: flex;
 | 
				
			||||||
 | 
					      align-items: center;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    &__toggle > div {
 | 
				
			||||||
 | 
					      display: flex;
 | 
				
			||||||
 | 
					      border-inline-start: 1px solid lighten($ui-base-color, 8%);
 | 
				
			||||||
 | 
					      padding-inline-start: 16px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue