From defc08eccb501d2db74b4d89fa56a08dedcdbd04 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 22 Jan 2019 13:29:45 -0500 Subject: [PATCH 1/3] change: less intrusive first run experience --- package.json | 1 + .../component/emailCollection/index.js | 29 +++++ .../component/emailCollection/view.jsx | 46 +++++++ src/renderer/component/firstRun/index.js | 29 +++++ src/renderer/component/firstRun/view.jsx | 115 ++++++++++++++++++ src/renderer/component/socialShare/view.jsx | 4 +- src/renderer/component/userEmailNew/view.jsx | 21 ++-- .../component/userEmailVerify/view.jsx | 44 ++++--- src/renderer/constants/settings.js | 1 + .../modal/modalEmailCollection/index.js | 23 ---- .../modal/modalEmailCollection/view.jsx | 54 -------- src/renderer/modal/modalRouter/view.jsx | 36 +----- src/renderer/page/auth/view.jsx | 41 ++----- src/renderer/page/discover/view.jsx | 3 + src/renderer/redux/reducers/settings.js | 40 +++--- src/renderer/scss/all.scss | 2 + src/renderer/scss/component/_badge.scss | 1 + src/renderer/scss/component/_banner.scss | 30 +++++ src/renderer/scss/component/_card.scss | 8 +- src/renderer/scss/component/_media.scss | 4 +- src/renderer/scss/component/_yrbl.scss | 10 ++ src/renderer/scss/init/_gui.scss | 2 +- static/img/gerbil-happy.png | Bin 184394 -> 271407 bytes yarn.lock | 96 ++++++++++++++- 24 files changed, 449 insertions(+), 191 deletions(-) create mode 100644 src/renderer/component/emailCollection/index.js create mode 100644 src/renderer/component/emailCollection/view.jsx create mode 100644 src/renderer/component/firstRun/index.js create mode 100644 src/renderer/component/firstRun/view.jsx delete mode 100644 src/renderer/modal/modalEmailCollection/index.js delete mode 100644 src/renderer/modal/modalEmailCollection/view.jsx create mode 100644 src/renderer/scss/component/_banner.scss create mode 100644 src/renderer/scss/component/_yrbl.scss diff --git a/package.json b/package.json index 57c127f47..450ae9c4b 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "react-feather": "^1.0.8", "react-modal": "^3.1.7", "react-paginate": "^5.2.1", + "react-pose": "^4.0.5", "react-redux": "^5.0.3", "react-simplemde-editor": "^3.6.16", "react-toggle": "^4.0.2", diff --git a/src/renderer/component/emailCollection/index.js b/src/renderer/component/emailCollection/index.js new file mode 100644 index 000000000..360e4285f --- /dev/null +++ b/src/renderer/component/emailCollection/index.js @@ -0,0 +1,29 @@ +import * as SETTINGS from 'constants/settings'; +import { connect } from 'react-redux'; +import { doSetClientSetting } from 'redux/actions/settings'; +import { makeSelectClientSetting } from 'redux/selectors/settings'; +import { selectEmailToVerify, selectUser } from 'lbryinc'; +import FirstRunEmailCollection from './view'; + +const select = state => ({ + emailCollectionAcknowledged: makeSelectClientSetting(SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED)( + state + ), + email: selectEmailToVerify(state), + user: selectUser(state), +}); + +const perform = dispatch => () => ({ + completeFirstRun: () => { + dispatch(doSetClientSetting(SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED, true)); + dispatch(doSetClientSetting(SETTINGS.FIRST_RUN_COMPLETED, true)); + }, + acknowledgeEmail: () => { + dispatch(doSetClientSetting(SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED, true)); + }, +}); + +export default connect( + select, + perform +)(FirstRunEmailCollection); diff --git a/src/renderer/component/emailCollection/view.jsx b/src/renderer/component/emailCollection/view.jsx new file mode 100644 index 000000000..6d59bd997 --- /dev/null +++ b/src/renderer/component/emailCollection/view.jsx @@ -0,0 +1,46 @@ +// @flow +import React from 'react'; +import Button from 'component/button'; +import UserEmailNew from 'component/userEmailNew'; +import UserEmailVerify from 'component/userEmailVerify'; + +type Props = { + email: string, + emailCollectionAcknowledged: boolean, + user: ?{ has_verified_email: boolean }, + completeFirstRun: () => void, + acknowledgeEmail: () => void, +}; + +class FirstRunEmailCollection extends React.PureComponent { + render() { + const { + completeFirstRun, + email, + user, + emailCollectionAcknowledged, + acknowledgeEmail, + } = this.props; + + // this shouldn't happen + if (!user) { + return null; + } + + const cancelButton =