add message for signed in users on privacy page and add sign out button

This commit is contained in:
Sean Yesmunt 2020-02-24 13:20:45 -05:00
parent 75c326c98b
commit 92ea75b1d8
4 changed files with 74 additions and 42 deletions

View file

@ -985,5 +985,8 @@
"Internal sharing is required while signed in.": "Internal sharing is required while signed in.",
"Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.": "Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.",
"FINAL WARNING: This action is permanent and cannot be undone.": "FINAL WARNING: This action is permanent and cannot be undone.",
"Sign In to lbry.tv to Earn Rewards From Inviting Your Friends": "Sign In to lbry.tv to Earn Rewards From Inviting Your Friends"
"Sign In to lbry.tv to Earn Rewards From Inviting Your Friends": "Sign In to lbry.tv to Earn Rewards From Inviting Your Friends",
"Email %help_link% or join our %chat_link% if you encounter any trouble verifying.": "Email %help_link% or join our %chat_link% if you encounter any trouble verifying.",
"You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%": "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%",
"You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.": "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%."
}

View file

@ -1,17 +1,23 @@
import { connect } from 'react-redux';
import { doSetDaemonSetting } from 'redux/actions/settings';
import { doSetWelcomeVersion, doToggle3PAnalytics } from 'redux/actions/app';
import PrivacyAgreement from './view';
import { doSetWelcomeVersion, doToggle3PAnalytics, doSignOut } from 'redux/actions/app';
import { DAEMON_SETTINGS } from 'lbry-redux';
import { WELCOME_VERSION } from 'config.js';
import { selectUserVerifiedEmail } from 'lbryinc';
import PrivacyAgreement from './view';
const select = state => ({
authenticated: selectUserVerifiedEmail(state),
});
const perform = dispatch => ({
setWelcomeVersion: version => dispatch(doSetWelcomeVersion(version || WELCOME_VERSION)),
setShareDataInternal: share => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, share)),
setShareDataThirdParty: share => dispatch(doToggle3PAnalytics(share)),
signOut: () => dispatch(doSignOut()),
});
export default connect(
null,
select,
perform
)(PrivacyAgreement);

View file

@ -14,13 +14,15 @@ const NONE = 'none';
type Props = {
setWelcomeVersion: () => void,
signOut: () => void,
setShareDataInternal: boolean => void,
setShareDataThirdParty: boolean => void,
history: { replace: string => void },
authenticated: boolean,
};
function PrivacyAgreement(props: Props) {
const { setWelcomeVersion, setShareDataInternal, setShareDataThirdParty, history } = props;
const { setWelcomeVersion, setShareDataInternal, setShareDataThirdParty, history, authenticated, signOut } = props;
const [share, setShare] = useState(undefined); // preload
const [agree, setAgree] = useState(false); // preload
@ -55,10 +57,10 @@ function PrivacyAgreement(props: Props) {
</div>
</div>
<hr />
<p className="section__body section__subtitle">
{__('Can this app send information about your usage to inform publishers and improve the software?')}
</p>
<Form onSubmit={handleSubmit} className="section__body">
<p className="section__subtitle">
{__('Can this app send information about your usage to inform publishers and improve the software?')}
</p>
<fieldset>
<FormField
name={'shareFreely'}
@ -89,6 +91,7 @@ function PrivacyAgreement(props: Props) {
onChange={e => setShare(LIMITED)}
/>
<FormField
disabled={authenticated}
name={'shareNot'}
type="radio"
checked={share === NONE}
@ -102,45 +105,60 @@ function PrivacyAgreement(props: Props) {
users, though this information is not stored permanently.`)}
onChange={e => setShare(NONE)}
/>
{authenticated && (
<div className="card--inline section--padded">
<p className="help--inline">
<I18nMessage
tokens={{
signout_button: <Button button="link" label={__('Sign Out')} onClick={signOut} />,
}}
>
You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.
</I18nMessage>
</p>
</div>
)}
</fieldset>
<p className="section__subtitle">
<I18nMessage
tokens={{
terms: <Button button="link" href="https://www.lbry.com/termsofservice" label={__('Terms of Service')} />,
}}
>
Do you agree to the %terms%?
</I18nMessage>
</p>
<fieldset>
<FormField
name={'agreeButton'}
type="radio"
label={'Yes'}
checked={agree === true}
onChange={e => setAgree(e.target.checked)}
/>
<FormField
name={'disagreeButton'}
type="radio"
checked={agree === false}
label={__('No')}
onChange={e => setAgree(!e.target.checked)}
/>
</fieldset>
{share === NONE && (
<>
<p className="help">
{__(
'While we respect the desire for maximally private usage, please note that choosing this option hurts the ability for creators to understand how their content is performing.'
)}
</p>
</>
)}
<div className="section__body">
<p className="section__subtitle">
<I18nMessage
tokens={{
terms: (
<Button button="link" href="https://www.lbry.com/termsofservice" label={__('Terms of Service')} />
),
}}
>
Do you agree to the %terms%?
</I18nMessage>
</p>
<fieldset>
<FormField
name={'agreeButton'}
type="radio"
label={'Yes'}
checked={agree === true}
onChange={e => setAgree(e.target.checked)}
/>
<FormField
name={'disagreeButton'}
type="radio"
checked={agree === false}
label={__('No')}
onChange={e => setAgree(!e.target.checked)}
/>
</fieldset>
</div>
<div className={'card__actions'}>
<Button button="primary" label={__(`Let's go`)} disabled={!share || !agree} type="submit" />
</div>
{share === NONE && (
<p className="help">
{__(
'While we respect the desire for maximally private usage, please note that choosing this option hurts the ability for creators to understand how their content is performing.'
)}
</p>
)}
</Form>
</section>
);

View file

@ -212,6 +212,11 @@ a {
color: var(--color-black);
}
.help--inline {
@extend .help;
margin-top: 0;
}
.empty {
color: var(--color-text-empty);
font-style: italic;