Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Extra Monetization Checkbox to Editors + Code Cleanup #230

Merged
merged 6 commits into from Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions .env

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -38,5 +38,6 @@ build/Release
node_modules
.tern-port
.envrc
.env

build/
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -56,6 +56,7 @@
"cross-env": "^5.0.5",
"debug": "^4.1.1",
"diff-match-patch": "^1.0.0",
"dotenv": "^7.0.0",
"embedjs": "^0.0.11",
"express": "^4.15.4",
"filesize": "^3.5.11",
Expand Down
11 changes: 9 additions & 2 deletions src/client/Wrapper.js
Expand Up @@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { IntlProvider } from 'react-intl';
import { withRouter, Link } from 'react-router-dom';
import { renderRoutes } from 'react-router-config';
import { Alert, LocaleProvider, Layout } from 'antd';
import { message, Alert, LocaleProvider, Layout } from 'antd';
import enUS from 'antd/lib/locale-provider/en_US';
import Cookie from 'js-cookie';
import { findLanguage, getRequestLocale, getBrowserLocale, loadLanguage } from './translations';
Expand Down Expand Up @@ -188,6 +188,13 @@ export default class Wrapper extends React.PureComponent {
this.props.setUsedLocale(lang);
}

/*
* Display a coming soon message when user clicks on any "Click Here" button
*/
messageComingSoon = () => {
message.success('Coming soon!', 3);
}

handleMenuItemClick(key) {
switch (key) {
case 'logout':
Expand Down Expand Up @@ -238,7 +245,7 @@ export default class Wrapper extends React.PureComponent {
case 'merchandise':
case 'exchange':
case 'teardrop-smt':
alert("Coming soon!")
this.messageComingSoon();
break;
default:
break;
Expand Down
3 changes: 1 addition & 2 deletions src/client/components/Editor/Editor.js
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import ReactDOM from 'react-dom';
import { withRouter, Link } from 'react-router-dom';
import classNames from 'classnames';
import { injectIntl, FormattedMessage } from 'react-intl';
import _ from 'lodash';
import readingTime from 'reading-time';
import { Checkbox, Form, Input, Select, Button, Collapse, Menu, Dropdown, Icon } from 'antd';
import { Checkbox, Form, Input, Select, Button, Collapse } from 'antd';
import { rewardsValues } from '../../../common/constants/rewards';
import Action from '../Button/Action';
import requiresLogin from '../../auth/requiresLogin';
Expand Down
13 changes: 6 additions & 7 deletions src/client/components/Editor/EditorBeLikeTerry.js
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import ReactDOM from 'react-dom';
import { withRouter, Link } from 'react-router-dom';
import classNames from 'classnames';
import { injectIntl, FormattedMessage } from 'react-intl';
import _ from 'lodash';
import readingTime from 'reading-time';
import { Checkbox, Form, Input, Select, Button, Collapse, Menu, Dropdown, Icon } from 'antd';
import { Checkbox, Form, Input, Select, Button, Collapse } from 'antd';
import { rewardsValues } from '../../../common/constants/rewards';
import Action from '../Button/Action';
import requiresLogin from '../../auth/requiresLogin';
Expand Down Expand Up @@ -41,6 +40,7 @@ class EditorBeLikeTerry extends React.Component {
onError: PropTypes.func,
onImageUpload: PropTypes.func,
onImageInvalid: PropTypes.func,
handleExtraMonetization: PropTypes.func,
};

static defaultProps = {
Expand All @@ -61,6 +61,7 @@ class EditorBeLikeTerry extends React.Component {
onError: () => {},
onImageUpload: () => {},
onImageInvalid: () => {},
handleExtraMonetization: () => {},
};

constructor(props) {
Expand All @@ -72,7 +73,6 @@ class EditorBeLikeTerry extends React.Component {
};

this.onUpdate = this.onUpdate.bind(this);
this.onHashtagUpdate = this.onHashtagUpdate.bind(this)
this.setValues = this.setValues.bind(this);
this.setBodyAndRender = this.setBodyAndRender.bind(this);
this.throttledUpdate = this.throttledUpdate.bind(this);
Expand Down Expand Up @@ -116,10 +116,6 @@ class EditorBeLikeTerry extends React.Component {
_.throttle(this.throttledUpdate, 200, { leading: false, trailing: true })();
}

onHashtagUpdate(value) {
console.log(value);
}

setValues(post) {
// NOTE: Used to rollback damaged drafts - https://github.com/busyorg/busy/issues/1412
// Might be deleted after a while.
Expand Down Expand Up @@ -379,6 +375,9 @@ class EditorBeLikeTerry extends React.Component {
<FormattedMessage id="like_post" defaultMessage="Like this post" />
</Checkbox>,
)}
<Checkbox onChange={this.props.handleExtraMonetization} disabled={isUpdating}>
<FormattedMessage id="extra_monetization" defaultMessage="Extra Monitezation" />
</Checkbox>
</Form.Item>
<div className="Editor__bottom">
<span className="Editor__bottom__info">
Expand Down
21 changes: 5 additions & 16 deletions src/client/components/Editor/EditorMain.js
Expand Up @@ -6,7 +6,7 @@ import classNames from 'classnames';
import { injectIntl, FormattedMessage } from 'react-intl';
import _ from 'lodash';
import readingTime from 'reading-time';
import { message, Checkbox, Form, Input, Select, Button, Collapse } from 'antd';
import { Checkbox, Form, Input, Select, Button, Collapse } from 'antd';
import { rewardsValues } from '../../../common/constants/rewards';
import Action from '../Button/Action';
import requiresLogin from '../../auth/requiresLogin';
Expand Down Expand Up @@ -40,6 +40,7 @@ class EditorMain extends React.Component {
onError: PropTypes.func,
onImageUpload: PropTypes.func,
onImageInvalid: PropTypes.func,
handleExtraMonetization: PropTypes.func,
};

static defaultProps = {
Expand All @@ -60,6 +61,7 @@ class EditorMain extends React.Component {
onError: () => {},
onImageUpload: () => {},
onImageInvalid: () => {},
handleExtraMonetization: () => {},
};

constructor(props) {
Expand All @@ -71,13 +73,11 @@ class EditorMain extends React.Component {
};

this.onUpdate = this.onUpdate.bind(this);
this.onHashtagUpdate = this.onHashtagUpdate.bind(this)
this.setValues = this.setValues.bind(this);
this.setBodyAndRender = this.setBodyAndRender.bind(this);
this.throttledUpdate = this.throttledUpdate.bind(this);
this.handleDelete = this.handleDelete.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.displayComingSoon = this.displayComingSoon.bind(this);
}

componentDidMount() {
Expand Down Expand Up @@ -116,10 +116,6 @@ class EditorMain extends React.Component {
_.throttle(this.throttledUpdate, 200, { leading: false, trailing: true })();
}

onHashtagUpdate(value) {
console.log(value);
}

setValues(post) {
// NOTE: Used to rollback damaged drafts - https://github.com/busyorg/busy/issues/1412
// Might be deleted after a while.
Expand Down Expand Up @@ -215,13 +211,6 @@ class EditorMain extends React.Component {
this.props.onDelete();
}

/*
* Display a coming soon message when user clicks on any "Click Here" button
*/
displayComingSoon = () => {
message.success('Coming soon!', 3);
}

render() {
const { intl, form, loading, isUpdating, saving, draftId } = this.props;
const { getFieldDecorator } = form;
Expand Down Expand Up @@ -415,8 +404,8 @@ Want to "mine the human" some more, you can also try one of our specialized edit
<FormattedMessage id="like_post" defaultMessage="Like this post" />
</Checkbox>,
)}
<Checkbox onChange={this.displayComingSoon} disabled={isUpdating}>
<FormattedMessage id="extra_monetization" πdeefaultMessage="Extra Monitezation" />
<Checkbox onChange={this.props.handleExtraMonetization} disabled={isUpdating}>
<FormattedMessage id="extra_monetization" defaultMessage="Extra Monitezation" />
</Checkbox>
</Form.Item>
<div className="Editor__bottom">
Expand Down
13 changes: 6 additions & 7 deletions src/client/components/Editor/EditorSurpassingGoogle.js
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import ReactDOM from 'react-dom';
import { withRouter, Link } from 'react-router-dom';
import classNames from 'classnames';
import { injectIntl, FormattedMessage } from 'react-intl';
import _ from 'lodash';
import readingTime from 'reading-time';
import { Checkbox, Form, Input, Select, Button, Collapse, Menu, Dropdown, Icon } from 'antd';
import { Checkbox, Form, Input, Select, Button, Collapse } from 'antd';
import { rewardsValues } from '../../../common/constants/rewards';
import Action from '../Button/Action';
import requiresLogin from '../../auth/requiresLogin';
Expand Down Expand Up @@ -41,6 +40,7 @@ class EditorSurpassingGoogle extends React.Component {
onError: PropTypes.func,
onImageUpload: PropTypes.func,
onImageInvalid: PropTypes.func,
handleExtraMonetization: PropTypes.func,
};

static defaultProps = {
Expand All @@ -61,6 +61,7 @@ class EditorSurpassingGoogle extends React.Component {
onError: () => {},
onImageUpload: () => {},
onImageInvalid: () => {},
handleExtraMonetization: () => {},
};

constructor(props) {
Expand All @@ -72,7 +73,6 @@ class EditorSurpassingGoogle extends React.Component {
};

this.onUpdate = this.onUpdate.bind(this);
this.onHashtagUpdate = this.onHashtagUpdate.bind(this)
this.setValues = this.setValues.bind(this);
this.setBodyAndRender = this.setBodyAndRender.bind(this);
this.throttledUpdate = this.throttledUpdate.bind(this);
Expand Down Expand Up @@ -116,10 +116,6 @@ class EditorSurpassingGoogle extends React.Component {
_.throttle(this.throttledUpdate, 200, { leading: false, trailing: true })();
}

onHashtagUpdate(value) {
console.log(value);
}

setValues(post) {
// NOTE: Used to rollback damaged drafts - https://github.com/busyorg/busy/issues/1412
// Might be deleted after a while.
Expand Down Expand Up @@ -388,6 +384,9 @@ class EditorSurpassingGoogle extends React.Component {
<FormattedMessage id="like_post" defaultMessage="Like this post" />
</Checkbox>,
)}
<Checkbox onChange={this.props.handleExtraMonetization} disabled={isUpdating}>
<FormattedMessage id="extra_monetization" defaultMessage="Extra Monitezation" />
</Checkbox>
</Form.Item>
<div className="Editor__bottom">
<span className="Editor__bottom__info">
Expand Down
14 changes: 6 additions & 8 deletions src/client/components/Editor/EditorTeardrop.js
Expand Up @@ -2,18 +2,16 @@ import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import ReactDOM from 'react-dom';
import { withRouter, Link } from 'react-router-dom';
import classNames from 'classnames';
import { injectIntl, FormattedMessage } from 'react-intl';
import _ from 'lodash';
import readingTime from 'reading-time';
import { Checkbox, Form, Input, Select, Button, Collapse, Menu, Dropdown, Icon } from 'antd';
import { Checkbox, Form, Input, Select, Button, Collapse } from 'antd';
import { rewardsValues } from '../../../common/constants/rewards';
import Action from '../Button/Action';
import requiresLogin from '../../auth/requiresLogin';
import withEditor from './withEditor';
import EditorInput from './EditorInput';
import UlogDropdown from './UlogDropdown';
import { remarkable } from '../Story/Body';
import BodyContainer from '../../containers/Story/BodyContainer';
import './Editor.less';
Expand Down Expand Up @@ -41,6 +39,7 @@ class EditorTeardrop extends React.Component {
onError: PropTypes.func,
onImageUpload: PropTypes.func,
onImageInvalid: PropTypes.func,
handleExtraMonetization: PropTypes.func,
};

static defaultProps = {
Expand All @@ -61,6 +60,7 @@ class EditorTeardrop extends React.Component {
onError: () => {},
onImageUpload: () => {},
onImageInvalid: () => {},
handleExtraMonetization: () => {},
};

constructor(props) {
Expand All @@ -72,7 +72,6 @@ class EditorTeardrop extends React.Component {
};

this.onUpdate = this.onUpdate.bind(this);
this.onHashtagUpdate = this.onHashtagUpdate.bind(this)
this.setValues = this.setValues.bind(this);
this.setBodyAndRender = this.setBodyAndRender.bind(this);
this.throttledUpdate = this.throttledUpdate.bind(this);
Expand Down Expand Up @@ -116,10 +115,6 @@ class EditorTeardrop extends React.Component {
_.throttle(this.throttledUpdate, 200, { leading: false, trailing: true })();
}

onHashtagUpdate(value) {
console.log(value);
}

setValues(post) {
// NOTE: Used to rollback damaged drafts - https://github.com/busyorg/busy/issues/1412
// Might be deleted after a while.
Expand Down Expand Up @@ -383,6 +378,9 @@ Ulogs.org allows you to enjoy the entire steem ecosystem. So, incase you change
<FormattedMessage id="like_post" defaultMessage="Like this post" />
</Checkbox>,
)}
<Checkbox onChange={this.props.handleExtraMonetization} disabled={isUpdating}>
<FormattedMessage id="extra_monetization" defaultMessage="Extra Monitezation" />
</Checkbox>
</Form.Item>
<div className="Editor__bottom">
<span className="Editor__bottom__info">
Expand Down