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