Unverified Commit c508fddc authored by andreswebs's avatar andreswebs
Browse files

fix CashIn

parent 3ab15295
{
"compilerOptions": {
"baseUrl": "src"
}
}
\ No newline at end of file
......@@ -3,11 +3,17 @@
"version": "0.0.1",
"private": true,
"dependencies": {
"@material-ui/core": "^4.9.5",
"@material-ui/core": "^4.9.9",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^10.0.0",
"@testing-library/jest-dom": "^5.3.0",
"@testing-library/react": "^10.0.2",
"@testing-library/user-event": "^10.0.1",
"@types/jest": "^25.2.1",
"@types/material-ui": "^0.21.7",
"@types/node": "^13.11.0",
"@types/react": "^16.9.32",
"@types/react-dom": "^16.9.6",
"@types/react-redux": "^7.1.7",
"axios": "^0.19.2",
"big.js": "^5.2.2",
"chart.js": "^2.9.3",
......@@ -15,9 +21,9 @@
"classnames": "^2.2.6",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
......@@ -26,23 +32,24 @@
"prettier": "^1.19.1",
"prop-types": "^15.7.2",
"qrcode.react": "^1.0.0",
"react": "^16.13.0",
"react": "^16.13.1",
"react-bootstrap-sweetalert": "^5.1.9",
"react-chartist": "^0.14.3",
"react-chartjs-2": "^2.9.0",
"react-dom": "^16.13.0",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"react-scripts": "3.4.1",
"react-table": "^6.9.2",
"redux": "^4.0.5",
"redux-actions": "^2.6.5",
"redux-thunk": "^2.3.0"
"redux-thunk": "^2.3.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"husky": "^4.2.3",
"lint-staged": "^10.0.8",
"lint-staged": "^10.1.1",
"redux-devtools-extension": "^2.13.8"
},
"scripts": {
......
......@@ -21,6 +21,7 @@
// // // Example: input = #999 => output = 153, 153, 153
// // // Example: input = 999 => output = 153, 153, 153
// #############################
/** @type any */
const hexToRgb = input => {
input += '';
input = input.replace('#', '');
......
import React from 'react';
import Slide from '@material-ui/core/Slide';
const Transition = React.forwardRef((props, ref) => (
<Slide direction="up" {...props} ref={ref} />
));
export default Transition;
......@@ -354,7 +354,8 @@ Wizard.propTypes = {
steps: PropTypes.arrayOf(
PropTypes.shape({
stepName: PropTypes.string.isRequired,
stepComponent: PropTypes.func.isRequired,
stepComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
.isRequired,
stepId: PropTypes.string.isRequired
})
).isRequired,
......
......@@ -5,29 +5,35 @@ import Dialog from '@material-ui/core/Dialog';
import Toolbar from '@material-ui/core/Toolbar';
import IconButton from '@material-ui/core/IconButton';
import CloseIcon from '@material-ui/icons/Close';
import Slide from '@material-ui/core/Slide';
import Wizard from 'components/ui/Wizard';
import Transition from 'components/ui/Transition';
import SelectMethod from './SelectMethod';
import Cash from './Cash';
function Transition(props) {
return <Slide direction="up" {...props} />;
}
// interface Drawer {
// handleClose: () => void;
// handleOpen: () => void;
// }
class CashIn extends Component {
constructor() {
super();
this.state = {
open: false
};
this.handleClose = () => {
this.setState({ open: false });
};
this.handleOpen = () => {
this.setState({ open: true });
};
this.handleClose = this.handleClose.bind(this);
this.handleOpen = this.handleOpen.bind(this);
}
state = {
open: false
};
handleClose() {
this.setState({ open: false });
}
handleOpen() {
this.setState({ open: true });
}
render() {
......
......@@ -5,19 +5,15 @@ import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import Toolbar from '@material-ui/core/Toolbar';
import IconButton from '@material-ui/core/IconButton';
import Slide from '@material-ui/core/Slide';
import CloseIcon from '@material-ui/icons/Close';
import Wizard from 'components/ui/Wizard';
import Transition from 'components/ui/Transition';
import SelectMethod from './SelectMethod';
import actions from './actions';
import Cash from './CashOut';
function Transition(props) {
return <Slide direction="up" {...props} />;
}
class CashOut extends Component {
constructor() {
super();
......
import { createAction } from 'redux-actions';
import { fetchApi } from 'utils';
import { WALLET_ACTIONS } from './constants';
const WALLET_ACTIONS_PATH = process.env.REACT_APP_WALLET_ACTIONS_PATH;
const reset = createAction(WALLET_ACTIONS, () => ({
status: 'initial'
}));
function reset() {
return {
type: WALLET_ACTIONS,
payload: {
status: 'initial'
}
};
}
const begin = createAction(WALLET_ACTIONS, () => ({
status: 'pending'
}));
function begin() {
return {
type: WALLET_ACTIONS,
payload: {
status: 'pending'
}
};
}
const failure = createAction(WALLET_ACTIONS, error => ({
error,
status: 'error'
}));
function failure(error) {
return {
type: WALLET_ACTIONS,
payload: {
status: 'error',
error
},
error: true
};
}
const success = createAction(WALLET_ACTIONS, methods => ({
methods,
status: 'success'
}));
function success(methods) {
return {
type: WALLET_ACTIONS,
payload: {
methods,
status: 'success'
}
};
}
function getActions() {
return function getActionsThunk(dispatch) {
......
......@@ -8,6 +8,7 @@ import { WALLET_ACTIONS_FEES } from './CashOut/constants';
import { WALLET_TO_WALLET } from './WalletToWallet/constants';
import { CASH_OUT } from './CashOut/methods/constants';
// TODO: correct snake_case to camelCase
const initialState = {
status: 'initial',
cash_in: [],
......@@ -15,6 +16,7 @@ const initialState = {
fees: [],
fees_status: 'initial',
error: null,
methods: [],
walletToWallet: {
status: 'initial',
response: null,
......@@ -25,9 +27,9 @@ const initialState = {
function walletActionsReducer(state = initialState, action) {
switch (action.type) {
case WALLET_ACTIONS: {
const { error, status } = action.payload;
const { error = state.error, status = state.status } = action.payload;
let { methods } = action.payload;
let { methods = state.methods } = action.payload;
let cash_in = state.cash_in;
let cash_out = state.cash_out;
......@@ -68,7 +70,7 @@ function walletActionsReducer(state = initialState, action) {
...state,
cash_in,
cash_out,
error: error || state.error,
error,
status
};
}
......
/// <reference types="react-scripts" />
......@@ -11,6 +11,8 @@ import { monthEarningsReducer as monthEarnings } from './month-earnings/reducer'
import { transactionsReducer as transactions } from './transactions/reducer';
import { lastTransactionsReducer as lastTransactions } from './last-transactions/reducer';
// TODO: refactor & move to ./wallet-actions
const reducers = {
login,
currencyValues,
......
{
"compilerOptions": {
"baseUrl": "src",
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"typeRoots": [
"./node_modules/@types"
]
},
"include": [
"src"
],
"exclude": [
"src/assets/**/*"
]
}
\ No newline at end of file
This diff is collapsed.
Supports Markdown
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