Commit 0ccd246c authored by Benjamin Chodoroff's avatar Benjamin Chodoroff
Browse files

remove redux-modules

switch to ducks style
parent f9abfe7b
......@@ -3,8 +3,7 @@ import {connect} from 'react-redux';
import AppPropTypes from 'app/utils/AppPropTypes';
import Header from 'app/components/modules/Header';
import LpFooter from 'app/components/modules/lp/LpFooter';
import user from 'app/redux/User';
import g from 'app/redux/GlobalReducer';
import * as userActions from 'app/redux/UserReducer';
import TopRightMenu from 'app/components/modules/TopRightMenu';
import { browserHistory } from 'react-router';
import classNames from 'classnames';
......@@ -336,12 +335,11 @@ export default connect(
},
dispatch => ({
loginUser: () =>
dispatch(user.actions.usernamePasswordLogin()),
dispatch(userActions.usernamePasswordLogin({})),
depositSteem: (username) => {
const new_window = window.open();
new_window.opener = null;
new_window.location = 'https://blocktrades.us/?input_coin_type=btc&output_coin_type=steem&receive_address=' + username;
//dispatch(g.actions.showDialog({name: 'blocktrades_deposit', params: {outputCoinType: 'VESTS'}}));
},
})
)(App);
import React from 'react';
import {connect} from 'react-redux'
import Link from 'app/components/elements/Link'
import g from 'app/redux/GlobalReducer'
import * as globalActions from 'app/redux/GlobalReducer';
import links from 'app/utils/Links'
import tt from 'counterpart';
......@@ -67,7 +67,7 @@ export default connect(
},
dispatch => ({
clearMetaElement: (formId, element) => {
dispatch(g.actions.clearMetaElement({formId, element}))
dispatch(globalActions.clearMetaElement({formId, element}))
}
})
)(CardView)
......@@ -6,10 +6,10 @@ import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import Voting from 'app/components/elements/Voting';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import user from 'app/redux/User';
import * as userActions from 'app/redux/UserReducer';
import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper';
import Userpic from 'app/components/elements/Userpic';
import transaction from 'app/redux/Transaction'
import * as transactionActions from 'app/redux/TransactionReducer';
import tt from 'counterpart';
import {parsePayoutAmount} from 'app/utils/ParsersAndFormatters';
import {Long} from 'bytebuffer';
......@@ -400,9 +400,9 @@ const Comment = connect(
// mapDispatchToProps
dispatch => ({
unlock: () => { dispatch(user.actions.showLogin()) },
unlock: () => { dispatch(userActions.showLogin()) },
deletePost: (author, permlink) => {
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'delete_comment',
operation: {author, permlink},
confirm: tt('g.are_you_sure'),
......
......@@ -3,8 +3,9 @@ import { Link } from 'react-router';
import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper';
import Icon from 'app/components/elements/Icon';
import { connect } from 'react-redux';
import user from 'app/redux/User';
import transaction from 'app/redux/Transaction'
import * as userActions from 'app/redux/UserReducer';
import * as transactionActions from 'app/redux/TransactionReducer';
import * as globalActions from 'app/redux/GlobalReducer';
import Voting from 'app/components/elements/Voting';
import Reblog from 'app/components/elements/Reblog';
import MarkdownViewer from 'app/components/cards/MarkdownViewer';
......@@ -375,21 +376,21 @@ export default connect(
// mapDispatchToProps
dispatch => ({
dispatchSubmit: (data) => { dispatch(user.actions.usernamePasswordLogin({...data})) },
clearError: () => { dispatch(user.actions.loginError({error: null})) },
unlock: () => { dispatch(user.actions.showLogin()) },
dispatchSubmit: (data) => { dispatch(userActions.usernamePasswordLogin({...data})) },
clearError: () => { dispatch(userActions.loginError({error: null})) },
unlock: () => { dispatch(userActions.showLogin()) },
deletePost: (author, permlink) => {
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'delete_comment',
operation: {author, permlink},
confirm: tt('g.are_you_sure')
}));
},
showPromotePost: (author, permlink) => {
dispatch({type: 'global/SHOW_DIALOG', payload: {name: 'promotePost', params: {author, permlink}}});
dispatch(globalActions.showDialog({ name: 'promotePost', params: { author, permlink } }));
},
showExplorePost: (permlink) => {
dispatch({type: 'global/SHOW_DIALOG', payload: {name: 'explorePost', params: {permlink}}});
dispatch(globalActions.showDialog({ name: 'explorePost', params: { permlink } }));
},
})
)(PostFull)
......
......@@ -3,7 +3,7 @@ import { Link } from 'react-router';
import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper';
import Icon from 'app/components/elements/Icon';
import { connect } from 'react-redux';
import user from 'app/redux/User';
import * as userActions from 'app/redux/UserReducer';
import Reblog from 'app/components/elements/Reblog';
import Voting from 'app/components/elements/Voting';
import {immutableAccessor} from 'app/utils/Accessors';
......@@ -271,7 +271,7 @@ export default connect(
},
(dispatch) => ({
dispatchSubmit: data => { dispatch(user.actions.usernamePasswordLogin({...data})) },
clearError: () => { dispatch(user.actions.loginError({error: null})) }
dispatchSubmit: data => { dispatch(userActions.usernamePasswordLogin({...data})) },
clearError: () => { dispatch(userActions.loginError({error: null})) }
})
)(PostSummary)
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import tt from 'counterpart';
import * as userActions from 'app/redux/UserReducer';
import { actions as fetchDataSagaActions } from 'app/redux/FetchDataSaga';
import PostSummary from 'app/components/cards/PostSummary';
import Post from 'app/components/pages/Post';
import LoadingIndicator from 'app/components/elements/LoadingIndicator';
......@@ -7,8 +11,6 @@ import CloseButton from 'react-foundation-components/lib/global/close-button';
import {findParent} from 'app/utils/DomUtils';
import Icon from 'app/components/elements/Icon';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate';
import {connect} from 'react-redux'
import tt from 'counterpart';
function topPosition(domElt) {
if (!domElt) {
......@@ -168,10 +170,10 @@ export default connect(
},
dispatch => ({
fetchState: (pathname) => {
dispatch({type: 'FETCH_STATE', payload: {pathname}})
dispatch(fetchDataSagaActions.fetchState({pathname}));
},
removeHighSecurityKeys: () => {
dispatch({type: 'user/REMOVE_HIGH_SECURITY_KEYS'})
dispatch(userActions.removeHighSecurityKeys());
}
})
)(PostsList)
/* eslint react/prop-types: 0 */
import React from 'react'
import transaction from 'app/redux/Transaction'
import LoadingIndicator from 'app/components/elements/LoadingIndicator'
import {validate_account_name} from 'app/utils/ChainValidation'
import {cleanReduxInput} from 'app/utils/ReduxForms'
import tt from 'counterpart';
import { APP_NAME } from 'app/client_config';
import {PrivateKey, PublicKey, key_utils} from '@steemit/steem-js/lib/auth/ecc';
import {api} from '@steemit/steem-js';
import * as transactionActions from 'app/redux/TransactionReducer';
import * as appActions from 'app/redux/AppReducer';
import LoadingIndicator from 'app/components/elements/LoadingIndicator';
import {validate_account_name} from 'app/utils/ChainValidation';
import {cleanReduxInput} from 'app/utils/ReduxForms';
import { APP_NAME } from 'app/client_config';
const {string, oneOf} = React.PropTypes
class ChangePassword extends React.Component {
......@@ -252,7 +254,7 @@ export default reduxForm(
{authType: 'posting', oldAuth: password, newAuth: ph('posting', newWif)},
{authType: 'memo', oldAuth: password, newAuth: ph('memo', newWif)},
]
dispatch(transaction.actions.updateAuthorities({
dispatch(transactionActions.updateAuthorities({
twofa,
// signingKey provides the password if it was not provided in auths
signingKey: authType ? password : null,
......@@ -262,11 +264,11 @@ export default reduxForm(
}))
},
notify: (message) => {
dispatch({type: 'ADD_NOTIFICATION', payload: {
dispatch(appActions.addNotification({
key: "chpwd_" + Date.now(),
message,
dismissAfter: 5000}
});
dismissAfter: 5000,
}));
},
})
)(ChangePassword)
......@@ -2,7 +2,8 @@
import React from 'react'
import ReactDOM from 'react-dom';
import {reduxForm} from 'redux-form'; // @deprecated, instead use: app/utils/ReactForm.js
import transaction from 'app/redux/Transaction'
import * as transactionActions from 'app/redux/TransactionReducer';
import * as appActions from 'app/redux/AppReducer';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import TransactionError from 'app/components/elements/TransactionError'
import LoadingIndicator from 'app/components/elements/LoadingIndicator'
......@@ -103,17 +104,17 @@ export default reduxForm(
const amount = [parseFloat(amt).toFixed(3), DEBT_TICKER].join(" ")
const requestid = Math.floor(Date.now() / 1000)
const conf = tt('postfull_jsx.in_week_convert_DEBT_TOKEN_to_LIQUID_TOKEN', { amount: amount.split(' ')[0], DEBT_TOKEN, LIQUID_TOKEN})
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'convert',
operation: {owner, requestid, amount},
confirm: conf + '?',
successCallback: () => {
success()
dispatch({type: 'ADD_NOTIFICATION', payload:
{key: "convert_sd_to_steem_" + Date.now(),
message: tt('g.order_placed') + ': ' + conf,
dismissAfter: 5000}
})
success();
dispatch(appActions.addNotification({
key: "convert_sd_to_steem_" + Date.now(),
message: tt('g.order_placed') + ': ' + conf,
dismissAfter: 5000,
}));
},
errorCallback: () => {error()}
}))
......
......@@ -2,10 +2,10 @@ import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import LoadingIndicator from 'app/components/elements/LoadingIndicator';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate';
import transaction from 'app/redux/Transaction';
import * as transactionActions from 'app/redux/TransactionReducer';
import * as userActions from 'app/redux/UserReducer';
import {Set, Map} from 'immutable'
import tt from 'counterpart';
import user from 'app/redux/User';
const {string, bool, any} = PropTypes;
......@@ -135,7 +135,7 @@ module.exports = connect(
updateFollow: (follower, following, action, done) => {
const what = action ? [action] : [];
const json = ['follow', {follower, following, what}];
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'custom_json',
operation: {
id: 'follow',
......@@ -148,7 +148,7 @@ module.exports = connect(
},
showLogin: e => {
if (e) e.preventDefault();
dispatch(user.actions.showLogin())
dispatch(userActions.showLogin())
},
})
)(Follow);
......@@ -2,8 +2,7 @@
import React, {PropTypes, Component} from 'react'
import {Map, List} from 'immutable'
import {connect} from 'react-redux'
import user from 'app/redux/User'
import g from 'app/redux/GlobalReducer'
import * as globalActions from 'app/redux/GlobalReducer';
import ShowKey from 'app/components/elements/ShowKey'
import tt from 'counterpart';
......@@ -111,8 +110,8 @@ export default connect(
dispatch => ({
showChangePassword: (username, authType, priorAuthKey) => {
const name = 'changePassword'
dispatch(g.actions.remove({key: name}))
dispatch(g.actions.showDialog({name, params: {username, authType, priorAuthKey}}))
dispatch(globalActions.remove({key: name}))
dispatch(globalActions.showDialog({name, params: {username, authType, priorAuthKey}}))
},
})
)(Keys)
import React from 'react';
import {connect} from 'react-redux';
import {markNotificationRead} from 'app/utils/ServerApiClient';
import * as appActions from 'app/redux/AppReducer';
class MarkNotificationRead extends React.Component {
......@@ -27,5 +28,5 @@ class MarkNotificationRead extends React.Component {
}
export default connect(null, dispatch => ({
update: (payload) => { dispatch({type: 'UPDATE_NOTIFICOUNTERS', payload})},
update: (payload) => { dispatch(appActions.updateNotificounters(payload)) },
}))(MarkNotificationRead);
......@@ -2,7 +2,7 @@ import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
// import LoadingIndicator from 'app/components/elements/LoadingIndicator';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import transaction from 'app/redux/Transaction';
import * as transactionActions from 'app/redux/TransactionReducer';
import Icon from 'app/components/elements/Icon';
import tt from 'counterpart';
......@@ -81,7 +81,7 @@ module.exports = connect(
dispatch => ({
reblog: (account, author, permlink, successCallback, errorCallback) => {
const json = ['reblog', {account, author, permlink}]
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'custom_json',
confirm: tt('g.are_you_sure'),
operation: {
......
import React from 'react';
import reactForm from 'app/utils/ReactForm'
import transaction from 'app/redux/Transaction';
import * as transactionActions from 'app/redux/TransactionReducer';
import MarkdownViewer from 'app/components/cards/MarkdownViewer'
import CategorySelector from 'app/components/cards/CategorySelector'
import {validateCategory} from 'app/components/cards/CategorySelector'
......@@ -10,7 +10,7 @@ import Tooltip from 'app/components/elements/Tooltip'
import sanitizeConfig, {allowedTags} from 'app/utils/SanitizeConfig'
import sanitize from 'sanitize-html'
import HtmlReady from 'shared/HtmlReady'
import g from 'app/redux/GlobalReducer'
import * as globalActions from 'app/redux/GlobalReducer';
import {Set} from 'immutable'
import Remarkable from 'remarkable'
import Dropzone from 'react-dropzone'
......@@ -527,17 +527,12 @@ export default (formId) => connect(
// mapDispatchToProps
dispatch => ({
clearMetaData: (id) => {
dispatch(g.actions.clearMeta({id}))
dispatch(globalActions.clearMeta({id}))
},
setMetaData: (id, jsonMetadata) => {
dispatch(g.actions.setMetaData({id, meta: jsonMetadata ? jsonMetadata.steem : null}))
},
uploadImage: (file, progress) => {
dispatch({
type: 'user/UPLOAD_IMAGE',
payload: {file, progress},
})
dispatch(globalActions.setMetaData({id, meta: jsonMetadata ? jsonMetadata.steem : null}))
},
uploadImage: (file, progress) => dispatch(userActions.uploadImage({ file, progress })),
reply: ({category, title, body, author, permlink, parent_author, parent_permlink, isHtml, isStory,
type, originalPost, autoVote = false, payoutType = '50%',
state, jsonMetadata,
......@@ -647,7 +642,7 @@ export default (formId) => connect(
json_metadata: meta,
__config
}
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'comment',
operation,
errorCallback,
......
/* eslint react/prop-types: 0 */
import React from 'react'
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import LoadingIndicator from 'app/components/elements/LoadingIndicator'
import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper'
import transaction from 'app/redux/Transaction'
import Memo from 'app/components/elements/Memo'
import tt from 'counterpart'
import React from 'react';
import tt from 'counterpart';
import * as transactionActions from 'app/redux/TransactionReducer';
import * as globalActions from 'app/redux/GlobalReducer';
import * as userActions from 'app/redux/UserReducer';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate';
import LoadingIndicator from 'app/components/elements/LoadingIndicator';
import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper';
import Memo from 'app/components/elements/Memo';
class SavingsWithdrawHistory extends React.Component {
......@@ -99,20 +102,15 @@ export default connect(
}
},
dispatch => ({
loadHistory: () => {
dispatch({
type: 'user/LOAD_SAVINGS_WITHDRAW',
payload: {},
})
},
loadHistory: () => dispatch(userActions.loadSavingsWithdraw({})),
cancelWithdraw: (fro, request_id, success, errorCallback) => {
const confirm = tt('savingswithdrawhistory_jsx.cancel_this_withdraw_request')
const successCallback = () => {
// refresh transfer history
dispatch({type: 'global/GET_STATE', payload: {url: `@${fro}/transfers`}})
dispatch(globalActions.getState({ url: `@${fro}/transfers` }));
success()
}
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'cancel_transfer_from_savings',
operation: {from: fro, request_id},
confirm,
......
import React, {PropTypes, Component} from 'react';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate';
import {connect} from 'react-redux';
import user from 'app/redux/User';
import * as userActions from 'app/redux/UserReducer';
import tt from 'counterpart';
import g from 'app/redux/GlobalReducer';
import * as globalActions from 'app/redux/GlobalReducer';
/** Display a public key. Offer to show a private key, but only if it matches the provided public key */
class ShowKey extends Component {
......@@ -100,10 +100,10 @@ export default connect(
(state, ownProps) => ownProps,
dispatch => ({
showLogin: ({username, authType}) => {
dispatch(user.actions.showLogin({loginDefault: {username, authType}}))
dispatch(userActions.showLogin({loginDefault: {username, authType}}))
},
showQRKey: ({type, isPrivate, text}) => {
dispatch(g.actions.showDialog({name: "qr_key", params: {type, isPrivate, text}}));
dispatch(globalActions.showDialog({name: "qr_key", params: {type, isPrivate, text}}));
}
})
)(ShowKey)
......@@ -2,7 +2,7 @@
import React from 'react'
import {connect} from 'react-redux'
import {renderToString} from 'react-dom/server'
import g from 'app/redux/GlobalReducer'
import * as globalActions from 'app/redux/GlobalReducer'
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import Icon from 'app/components/elements/Icon'
import tt from 'counterpart';
......@@ -99,7 +99,7 @@ export default connect(
const PASSWORD_LENGTH = 32
const private_key = key_utils.get_random_key()
const suggestedPassword = private_key.toWif().substring(3, 3 + PASSWORD_LENGTH)
dispatch(g.actions.set({key: 'suggestedPassword', value: suggestedPassword}))
dispatch(globalActions.set({key: 'suggestedPassword', value: suggestedPassword}))
},
})
)(SuggestPassword)
import React from 'react'
import {connect} from 'react-redux'
import transaction from 'app/redux/Transaction'
import * as transactionActions from 'app/redux/TransactionReducer';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import {Map} from 'immutable'
......@@ -62,11 +62,11 @@ export default connect(
// mapDispatchToProps
dispatch => ({
addListener: (opType) => {
dispatch(transaction.actions.set({key: ['TransactionError', opType + '_listener'], value: true}))
dispatch(transactionActions.set({key: ['TransactionError', opType + '_listener'], value: true}))
},
removeListener: (opType) => {
dispatch(transaction.actions.remove({key: ['TransactionError', opType]}))
dispatch(transaction.actions.remove({key: ['TransactionError', opType + '_listener']}))
dispatch(transactionActions.remove({key: ['TransactionError', opType]}))
dispatch(transactionActions.remove({key: ['TransactionError', opType + '_listener']}))
},
})
)(TransactionError)
import React, {PropTypes, Component} from 'react'
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import Keys from 'app/components/elements/Keys'
import g from 'app/redux/GlobalReducer'
import {connect} from 'react-redux';
import QRCode from 'react-qr'
import tt from 'counterpart';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'
import Keys from 'app/components/elements/Keys'
import * as globalActions from 'app/redux/GlobalReducer';
const keyTypes = ['Posting', 'Active', 'Owner', 'Memo']
......@@ -114,12 +114,12 @@ export default connect(
},
dispatch => ({
setWifShown: (shown) => {
dispatch(g.actions.receiveState({UserKeys_wifShown: shown}))
dispatch(globalActions.receiveState({UserKeys_wifShown: shown}))
},
showChangePassword: (username) => {
const name = 'changePassword'
dispatch(g.actions.remove({key: name}))
dispatch(g.actions.showDialog({name, params: {username}}))
dispatch(globalActions.remove({key: name}))
dispatch(globalActions.showDialog({name, params: {username}}))
},
})
)(UserKeys)
import React from 'react';
import { connect } from 'react-redux';
import transaction from 'app/redux/Transaction';
import Slider from 'react-rangeslider';
import tt from 'counterpart';
import CloseButton from 'react-foundation-components/lib/global/close-button';
import * as transactionActions from 'app/redux/TransactionReducer';
import Icon from 'app/components/elements/Icon';
import FormattedAsset from 'app/components/elements/FormattedAsset';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate';
......@@ -9,8 +11,6 @@ import {formatDecimal, parsePayoutAmount} from 'app/utils/ParsersAndFormatters';
import DropdownMenu from 'app/components/elements/DropdownMenu';
import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper';
import FoundationDropdown from 'app/components/elements/FoundationDropdown';
import CloseButton from 'react-foundation-components/lib/global/close-button';
import tt from 'counterpart';
const ABOUT_FLAG = <div>
<p>{tt('voting_jsx.flagging_post_can_remove_rewards_the_flag_should_be_used_for_the_following')}</p>
......@@ -299,7 +299,7 @@ export default connect(
if(weight < 0) return tt('voting_jsx.changing_to_a_downvote') + t
return null
}
dispatch(transaction.actions.broadcastOperation({
dispatch(transactionActions.broadcastOperation({
type: 'vote',
operation: {voter: username, author, permlink, weight,
__config: {title: weight < 0 ? tt('voting_jsx.confirm_flag') : null},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment