mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-17 05:26:36 +00:00
use standard action creator naming convention
This commit is contained in:
parent
c46ed8f6ed
commit
9a612eb6de
@ -1,22 +1,22 @@
|
||||
import {
|
||||
GENERATE_WALLET_CONTINUE_TO_PAPER,
|
||||
GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER,
|
||||
GENERATE_WALLET_FILE,
|
||||
GENERATE_WALLET_HAS_DOWNLOADED_FILE,
|
||||
GENERATE_WALLET_DOWNLOAD_FILE,
|
||||
GENERATE_WALLET_SHOW_PASSWORD
|
||||
} from 'actions/generateWalletConstants';
|
||||
|
||||
export const SHOW_GENERATE_WALLET_PASSWORD_ACTION = () => {
|
||||
export const generateWalletShowPassword = () => {
|
||||
return { type: GENERATE_WALLET_SHOW_PASSWORD };
|
||||
};
|
||||
|
||||
export const GENERATE_WALLET_FILE_ACTION = () => {
|
||||
export const generateWalletGenerateFile = () => {
|
||||
return { type: GENERATE_WALLET_FILE };
|
||||
};
|
||||
|
||||
export const GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION = () => {
|
||||
return { type: GENERATE_WALLET_HAS_DOWNLOADED_FILE };
|
||||
export const generateWalletDownloadFile = () => {
|
||||
return { type: GENERATE_WALLET_DOWNLOAD_FILE };
|
||||
};
|
||||
|
||||
export const GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION = () => {
|
||||
return { type: GENERATE_WALLET_CONTINUE_TO_PAPER };
|
||||
export const generateWalletConfirmContinueToPaper = () => {
|
||||
return { type: GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER };
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
export const GENERATE_WALLET_SHOW_PASSWORD = 'GENERATE_WALLET_SHOW_PASSWORD';
|
||||
export const GENERATE_WALLET_FILE = 'GENERATE_WALLET_FILE';
|
||||
export const GENERATE_WALLET_HAS_DOWNLOADED_FILE =
|
||||
'GENERATE_WALLET_HAS_DOWNLOADED_FILE';
|
||||
export const GENERATE_WALLET_CONTINUE_TO_PAPER =
|
||||
'GENERATE_WALLET_CONTINUE_TO_PAPER';
|
||||
export const GENERATE_WALLET_DOWNLOAD_FILE = 'GENERATE_WALLET_DOWNLOAD_FILE';
|
||||
export const GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER =
|
||||
'GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER';
|
||||
|
@ -6,35 +6,35 @@ import {
|
||||
SWAP_UPDATE_BITY_RATES
|
||||
} from './swapConstants';
|
||||
|
||||
export const SWAP_ORIGIN_KIND_TO = value => {
|
||||
export const swapOriginKind = value => {
|
||||
return {
|
||||
type: SWAP_ORIGIN_KIND,
|
||||
value
|
||||
};
|
||||
};
|
||||
|
||||
export const SWAP_DESTINATION_KIND_TO = value => {
|
||||
export const swapDestinationKind = value => {
|
||||
return {
|
||||
type: SWAP_DESTINATION_KIND,
|
||||
value
|
||||
};
|
||||
};
|
||||
|
||||
export const SWAP_ORIGIN_AMOUNT_TO = value => {
|
||||
export const swapOriginAmount = value => {
|
||||
return {
|
||||
type: SWAP_ORIGIN_AMOUNT,
|
||||
value
|
||||
};
|
||||
};
|
||||
|
||||
export const SWAP_DESTINATION_AMOUNT_TO = value => {
|
||||
export const swapDestinationAmount = value => {
|
||||
return {
|
||||
type: SWAP_DESTINATION_AMOUNT,
|
||||
value
|
||||
};
|
||||
};
|
||||
|
||||
export const SWAP_UPDATE_BITY_RATES_TO = value => {
|
||||
export const swapUpdateBityRates = value => {
|
||||
return {
|
||||
type: SWAP_UPDATE_BITY_RATES,
|
||||
value
|
||||
|
@ -31,10 +31,10 @@ class GenerateWalletPasswordComponent extends Component {
|
||||
hasDownloadedWalletFile: PropTypes.bool,
|
||||
canProceedToPaper: PropTypes.bool,
|
||||
// actions
|
||||
SHOW_GENERATE_WALLET_PASSWORD_ACTION: PropTypes.func,
|
||||
GENERATE_WALLET_FILE_ACTION: PropTypes.func,
|
||||
GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION: PropTypes.func,
|
||||
GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION: PropTypes.func
|
||||
generateWalletShowPassword: PropTypes.func,
|
||||
generateWalletGenerateFile: PropTypes.func,
|
||||
generateWalletDownloadFile: PropTypes.func,
|
||||
generateWalletConfirmContinueToPaper: PropTypes.func
|
||||
};
|
||||
|
||||
|
||||
@ -54,10 +54,10 @@ class GenerateWalletPasswordComponent extends Component {
|
||||
showPassword,
|
||||
generateWalletFile,
|
||||
hasDownloadedWalletFile,
|
||||
SHOW_GENERATE_WALLET_PASSWORD_ACTION,
|
||||
GENERATE_WALLET_FILE_ACTION,
|
||||
GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION,
|
||||
GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION
|
||||
generateWalletShowPassword,
|
||||
generateWalletGenerateFile,
|
||||
generateWalletDownloadFile,
|
||||
generateWalletConfirmContinueToPaper
|
||||
|
||||
} = this.props;
|
||||
|
||||
@ -77,11 +77,11 @@ class GenerateWalletPasswordComponent extends Component {
|
||||
validate={[required, minLength9]}
|
||||
component={GenerateWalletPasswordInputComponent}
|
||||
showPassword={showPassword}
|
||||
SHOW_GENERATE_WALLET_PASSWORD_ACTION={SHOW_GENERATE_WALLET_PASSWORD_ACTION}
|
||||
generateWalletShowPassword={generateWalletShowPassword}
|
||||
name="password"
|
||||
type="text"/>
|
||||
<br/>
|
||||
<button onClick={() => GENERATE_WALLET_FILE_ACTION()}
|
||||
<button onClick={() => generateWalletGenerateFile()}
|
||||
disabled={generateWalletPassword ? generateWalletPassword.syncErrors : true}
|
||||
className="btn btn-primary btn-block">
|
||||
{translate('NAV_GenerateWallet')}
|
||||
@ -108,7 +108,7 @@ class GenerateWalletPasswordComponent extends Component {
|
||||
download="UTC--2017-04-26T23-07-03.538Z--c5b7fff4e1669e38e8d6bc8fffe7e562b2b70f43"
|
||||
aria-label="Download Keystore File (UTC / JSON · Recommended · Encrypted)"
|
||||
aria-describedby="x_KeystoreDesc"
|
||||
onClick={() => GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION()}>{translate('x_Download')}</a>
|
||||
onClick={() => generateWalletDownloadFile()}>{translate('x_Download')}</a>
|
||||
<p className="sr-only" id="x_KeystoreDesc">{translate('x_KeystoreDesc')}</p>
|
||||
<br/><br/><br/><br/>
|
||||
</div>
|
||||
@ -120,7 +120,7 @@ class GenerateWalletPasswordComponent extends Component {
|
||||
<br/><br/>
|
||||
<a role="button"
|
||||
className={`btn btn-info ${hasDownloadedWalletFile ? '' : 'disabled'}`}
|
||||
onClick={() => GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION()}> I understand. Continue. </a>
|
||||
onClick={() => generateWalletConfirmContinueToPaper()}> I understand. Continue. </a>
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -8,7 +8,7 @@ export default class GenerateWalletPasswordInputComponent extends Component {
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
SHOW_GENERATE_WALLET_PASSWORD_ACTION: PropTypes.func,
|
||||
generateWalletShowPassword: PropTypes.func,
|
||||
showPassword: PropTypes.bool,
|
||||
input: PropTypes.object,
|
||||
meta: PropTypes.object
|
||||
@ -27,7 +27,7 @@ export default class GenerateWalletPasswordInputComponent extends Component {
|
||||
placeholder="Do NOT forget to save this!"
|
||||
aria-label="Enter a strong password (at least 9 characters)"/>
|
||||
<span
|
||||
onClick={() => this.props.SHOW_GENERATE_WALLET_PASSWORD_ACTION()}
|
||||
onClick={() => this.props.generateWalletShowPassword()}
|
||||
aria-label="make password visible"
|
||||
role="button"
|
||||
className="input-group-addon eye"/>
|
||||
|
@ -17,10 +17,10 @@ class GenerateWallet extends Component {
|
||||
generateWalletFile: PropTypes.bool,
|
||||
canProceedToPaper: PropTypes.bool,
|
||||
// actions
|
||||
SHOW_GENERATE_WALLET_PASSWORD_ACTION: PropTypes.func,
|
||||
GENERATE_WALLET_FILE_ACTION: PropTypes.func,
|
||||
GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION: PropTypes.func,
|
||||
GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION: PropTypes.func
|
||||
generateWalletShowPassword: PropTypes.func,
|
||||
generateWalletGenerateFile: PropTypes.func,
|
||||
generateWalletDownloadFile: PropTypes.func,
|
||||
generateWalletConfirmContinueToPaper: PropTypes.func
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@ -44,10 +44,10 @@ export default class WantToSwapMy extends Component {
|
||||
destinationKind: PropTypes.string,
|
||||
destinationKindOptions: PropTypes.array,
|
||||
originKindOptions: PropTypes.array,
|
||||
SWAP_ORIGIN_KIND_TO: PropTypes.func,
|
||||
SWAP_DESTINATION_KIND_TO: PropTypes.func,
|
||||
SWAP_ORIGIN_AMOUNT_TO: PropTypes.func,
|
||||
SWAP_DESTINATION_AMOUNT_TO: PropTypes.func
|
||||
swapOriginKind: PropTypes.func,
|
||||
swapDestinationKind: PropTypes.func,
|
||||
swapOriginAmount: PropTypes.func,
|
||||
swapDestinationAmount: PropTypes.func
|
||||
};
|
||||
|
||||
onClickStartSwap() {}
|
||||
@ -60,38 +60,38 @@ export default class WantToSwapMy extends Component {
|
||||
this.props.destinationKind
|
||||
);
|
||||
let bityRate = this.props.bityRates[pairName];
|
||||
this.props.SWAP_ORIGIN_AMOUNT_TO(originAmountAsNumber);
|
||||
this.props.SWAP_DESTINATION_AMOUNT_TO(originAmountAsNumber * bityRate);
|
||||
this.props.swapOriginAmount(originAmountAsNumber);
|
||||
this.props.swapDestinationAmount(originAmountAsNumber * bityRate);
|
||||
} else {
|
||||
this.props.SWAP_ORIGIN_AMOUNT_TO('');
|
||||
this.props.SWAP_DESTINATION_AMOUNT_TO('');
|
||||
this.props.swapOriginAmount('');
|
||||
this.props.swapDestinationAmount('');
|
||||
}
|
||||
};
|
||||
|
||||
onChangeDestinationAmount(amount) {
|
||||
let destinationAmountAsNumber = parseFloat(amount);
|
||||
if (destinationAmountAsNumber) {
|
||||
this.props.SWAP_DESTINATION_AMOUNT_TO(destinationAmountAsNumber);
|
||||
this.props.swapDestinationAmount(destinationAmountAsNumber);
|
||||
let pairName = combineAndUpper(
|
||||
this.props.destinationKind,
|
||||
this.props.originKind
|
||||
);
|
||||
let bityRate = this.props.bityRates[pairName];
|
||||
this.props.SWAP_ORIGIN_AMOUNT_TO(destinationAmountAsNumber * bityRate);
|
||||
this.props.swapOriginAmount(destinationAmountAsNumber * bityRate);
|
||||
} else {
|
||||
this.props.SWAP_ORIGIN_AMOUNT_TO('');
|
||||
this.props.SWAP_DESTINATION_AMOUNT_TO('');
|
||||
this.props.swapOriginAmount('');
|
||||
this.props.swapDestinationAmount('');
|
||||
}
|
||||
}
|
||||
|
||||
async onChangeDestinationKind(event) {
|
||||
let newDestinationKind = event.target.value;
|
||||
this.props.SWAP_DESTINATION_KIND_TO(newDestinationKind);
|
||||
this.props.swapDestinationKind(newDestinationKind);
|
||||
}
|
||||
|
||||
async onChangeOriginKind(event) {
|
||||
let newOriginKind = event.target.value;
|
||||
this.props.SWAP_ORIGIN_KIND_TO(newOriginKind);
|
||||
this.props.swapOriginKind(newOriginKind);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -21,11 +21,11 @@ class Swap extends Component {
|
||||
destinationKind: PropTypes.string,
|
||||
destinationKindOptions: PropTypes.array,
|
||||
originKindOptions: PropTypes.array,
|
||||
SWAP_ORIGIN_KIND_TO: PropTypes.func,
|
||||
SWAP_DESTINATION_KIND_TO: PropTypes.func,
|
||||
SWAP_ORIGIN_AMOUNT_TO: PropTypes.func,
|
||||
SWAP_DESTINATION_AMOUNT_TO: PropTypes.func,
|
||||
SWAP_UPDATE_BITY_RATES_TO: PropTypes.func
|
||||
swapOriginKind: PropTypes.func,
|
||||
swapDestinationKind: PropTypes.func,
|
||||
swapOriginAmount: PropTypes.func,
|
||||
swapDestinationAmount: PropTypes.func,
|
||||
swapUpdateBityRates: PropTypes.func
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@ -38,7 +38,7 @@ class Swap extends Component {
|
||||
!bityRates.BTCREP
|
||||
) {
|
||||
this.bity.getAllRates().then(data => {
|
||||
this.props.SWAP_UPDATE_BITY_RATES_TO(data);
|
||||
this.props.swapUpdateBityRates(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -52,10 +52,10 @@ class Swap extends Component {
|
||||
destinationKind,
|
||||
destinationKindOptions,
|
||||
originKindOptions,
|
||||
SWAP_ORIGIN_KIND_TO,
|
||||
SWAP_DESTINATION_KIND_TO,
|
||||
SWAP_ORIGIN_AMOUNT_TO,
|
||||
SWAP_DESTINATION_AMOUNT_TO
|
||||
swapOriginKind,
|
||||
swapDestinationKind,
|
||||
swapOriginAmount,
|
||||
swapDestinationAmount
|
||||
} = this.props;
|
||||
|
||||
let wantToSwapMyProps = {
|
||||
@ -66,10 +66,10 @@ class Swap extends Component {
|
||||
destinationKind,
|
||||
destinationKindOptions,
|
||||
originKindOptions,
|
||||
SWAP_ORIGIN_KIND_TO,
|
||||
SWAP_DESTINATION_KIND_TO,
|
||||
SWAP_ORIGIN_AMOUNT_TO,
|
||||
SWAP_DESTINATION_AMOUNT_TO
|
||||
swapOriginKind,
|
||||
swapDestinationKind,
|
||||
swapOriginAmount,
|
||||
swapDestinationAmount
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {
|
||||
GENERATE_WALLET_SHOW_PASSWORD,
|
||||
GENERATE_WALLET_FILE,
|
||||
GENERATE_WALLET_HAS_DOWNLOADED_FILE,
|
||||
GENERATE_WALLET_CONTINUE_TO_PAPER
|
||||
GENERATE_WALLET_DOWNLOAD_FILE,
|
||||
GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER
|
||||
} from 'actions/generateWalletConstants';
|
||||
|
||||
const initialState = {
|
||||
@ -28,14 +28,14 @@ export function generateWallet(state = initialState, action) {
|
||||
};
|
||||
}
|
||||
|
||||
case GENERATE_WALLET_HAS_DOWNLOADED_FILE: {
|
||||
case GENERATE_WALLET_DOWNLOAD_FILE: {
|
||||
return {
|
||||
...state,
|
||||
hasDownloadedWalletFile: true
|
||||
};
|
||||
}
|
||||
|
||||
case GENERATE_WALLET_CONTINUE_TO_PAPER: {
|
||||
case GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER: {
|
||||
return {
|
||||
...state,
|
||||
canProceedToPaper: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user