Skip to content

Commit

Permalink
Merge pull request #575 from bitholla/2.0-develop
Browse files Browse the repository at this point in the history
2.0 develop
  • Loading branch information
abeikverdi authored Feb 26, 2021
2 parents e35674d + 4df1777 commit 2d27002
Show file tree
Hide file tree
Showing 18 changed files with 168 additions and 169 deletions.
2 changes: 1 addition & 1 deletion web/src/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export const getWaveAuction = () => {

export const getAnnouncement = () => (dispatch) => {
return axios
.get(`${PLUGIN_URL}/plugins/announcement`)
.get(`${PLUGIN_URL}/plugins/announcements`)
.then((res) => {
if (res.data && res.data.data) {
dispatch({
Expand Down
12 changes: 3 additions & 9 deletions web/src/actions/walletActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const ACTION_KEYS = {
WITHDRAWAL_CANCEL_PENDING: 'WITHDRAWAL_CANCEL_PENDING',
WITHDRAWAL_CANCEL_FULFILLED: 'WITHDRAWAL_CANCEL_FULFILLED',
WITHDRAWAL_CANCEL_REJECTED: 'WITHDRAWAL_CANCEL_REJECTED',
DEPOSIT_STATUS_SUCCESS: 'DEPOSIT_STATUS_SUCCESS',
};

const ENDPOINTS = {
Expand All @@ -39,6 +38,7 @@ const ENDPOINTS = {
WITHDRAW_FEE: (currency) => `/user/withdrawal?currency=${currency}`,
CANCEL_WITHDRAWAL: '/user/withdrawal',
CONFIRM_WITHDRAWAL: '/user/confirm-withdrawal',
CHECK_TRANSACTION: '/user/check-transaction',
};

export const performWithdraw = (currency, values) => {
Expand Down Expand Up @@ -353,13 +353,7 @@ export const performConfirmWithdrawal = (token) => {
return axios.post(ENDPOINTS.CONFIRM_WITHDRAWAL, { token });
};

export const searchUserDeposits = (params) => {
export const searchTransaction = (params) => {
const query = querystring.stringify(params);
return axios.get(`${ENDPOINTS.DEPOSITS}?${query}`);
};

export const setDeposit = (deposit) => {
return (dispatch) => {
dispatch({ type: ACTION_KEYS.DEPOSIT_STATUS_SUCCESS, payload: deposit });
};
return axios.get(`${ENDPOINTS.CHECK_TRANSACTION}?${query}`);
};
2 changes: 1 addition & 1 deletion web/src/components/CheckDeposit/_CheckDeposit.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
border-top: 1px solid $colors-border;
margin-top: 3rem;
padding: 10px 0;
span {
.field-header {
color: $colors-black;
}
.success-msg {
Expand Down
75 changes: 51 additions & 24 deletions web/src/components/CheckDeposit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Button } from '../../components';
import { STATIC_ICONS } from 'config/icons';
import renderFields from '../../components/Form/factoryFields';
import withConfig from 'components/ConfigProvider/withConfig';
import { required } from '../Form/validations';

const FORM_NAME = 'CheckDeposit';

Expand All @@ -15,35 +16,55 @@ const CheckDeposit = ({
requestDeposit,
isLoading,
message,
successMsg,
handleSubmit,
coins,
pristine,
submitting,
valid,
error,
handleSearch = () => {},
...props
}) => {
const handleItemSearch = () => {
handleSearch(props.formValues);
};
const coinOptions = [];
Object.keys(coins).forEach((data) => {
let temp = coins[data];
if (temp) {
coinOptions.push({
label: `${temp.fullname} (${temp.symbol})`,
value: data,
});
}
});

const formFields = {
transaction_id: {
type: 'text',
placeholder: STRINGS['DEPOSIT_STATUS.SEARCH_FIELD_LABEL'],
label: STRINGS['DEPOSIT_STATUS.TRANSACTION_ID'],
validate: [required],
fullWidth: true,
},
currency: {
type: 'select',
placeholder: STRINGS['DEPOSIT_STATUS.CURRENCY_FIELD_LABEL'],
label: STRINGS['COINS'],
options: coinOptions,
validate: [required],
fullWidth: true,
},
address: {
type: 'text',
placeholder: STRINGS['DEPOSIT_STATUS.ADDRESS_FIELD_LABEL'],
label:
STRINGS[
'USER_VERIFICATION.USER_DOCUMENTATION_FORM.FORM_FIELDS.ADDRESS_LABEL'
],
validate: [required],
fullWidth: true,
notification: {
stringId: 'DEPOSIT_STATUS.SEARCH',
text: isLoading
? STRINGS['DEPOSIT_STATUS.SEARCHING']
: STRINGS['DEPOSIT_STATUS.SEARCH'],
iconPath: isLoading
? props.icons['CONNECT_LOADING']
: STATIC_ICONS.SEARCH,
onClick: handleItemSearch,
},
},
};

return (
<form className="check-deposit-modal-wrapper">
<form className="check-deposit-modal-wrapper" onSubmit={handleSubmit}>
<div className="d-flex justify-content-center align-items-center flex-column">
<img
src={STATIC_ICONS.SEARCH}
Expand All @@ -53,13 +74,14 @@ const CheckDeposit = ({
<h2>{STRINGS['DEPOSIT_STATUS.CHECK_DEPOSIT_STATUS']}</h2>
</div>
<div className="inner-content">
<span>{STRINGS['DEPOSIT_STATUS.CHECK_DEPOSIT_STATUS']}</span>
<span className="field-header">
{STRINGS['DEPOSIT_STATUS.CHECK_DEPOSIT_STATUS']}
</span>
<div className="mb-5">
{STRINGS['DEPOSIT_STATUS.STATUS_DESCRIPTION']}
</div>
<span>{STRINGS['DEPOSIT_STATUS.TRANSACTION_ID']}</span>
{renderFields(formFields)}
{message === successMsg ? (
{message ? (
<div className="d-flex">
<img
src={STATIC_ICONS.VERIFICATION_ICON}
Expand All @@ -68,23 +90,28 @@ const CheckDeposit = ({
/>
<p className="success-msg">{message}</p>
</div>
) : (
<p className="error-msg">{message}</p>
)}
) : null}
{error && <div className="warning_text">{error}</div>}
</div>
<div className="w-100 buttons-wrapper d-flex mt-3">
<Button label="BACK" onClick={onCloseDialog} />
<div className="w-100 buttons-wrapper d-flex justify-content-between mt-3">
<Button label="BACK" onClick={onCloseDialog} className="mr-3" />
<Button
label={STRINGS['SUBMIT']}
disabled={pristine || submitting || !valid}
/>
</div>
</form>
);
};

const CheckDepositForm = reduxForm({
form: FORM_NAME,
enableReinitialize: true,
})(CheckDeposit);

const mapStateToProps = (state) => ({
formValues: getFormValues(FORM_NAME)(state),
coins: state.app.coins,
});

export default connect(mapStateToProps)(withConfig(CheckDepositForm));
10 changes: 10 additions & 0 deletions web/src/components/Notification/InviteFriends.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DumbField from '../Form/FormFields/DumbField';
import Button from '../Button';
import STRINGS from '../../config/localizedStrings';
import { getUserReferralCount } from '../../actions/userAction';
import { setSnackNotification } from '../../actions/appActions';
import { EditWrapper } from 'components';

const RenderDumbField = (props) => <DumbField {...props} />;
Expand All @@ -24,6 +25,14 @@ class InviteFriends extends Component {
this.props.getUserReferralCount();
}

handleCopy = () => {
const { icons: ICONS, setSnackNotification } = this.props;
setSnackNotification({
icon: ICONS.COPY_NOTIFICATION,
content: STRINGS['COPY_SUCCESS_TEXT'],
});
};

render() {
const { affiliation_code } = this.props.data;
const { affiliation, icons: ICONS } = this.props;
Expand Down Expand Up @@ -96,6 +105,7 @@ const mapStateToProps = (store) => ({

const mapDispatchToProps = (dispatch) => ({
getUserReferralCount: bindActionCreators(getUserReferralCount, dispatch),
setSnackNotification: bindActionCreators(setSnackNotification, dispatch),
});

export default connect(mapStateToProps, mapDispatchToProps)(InviteFriends);
3 changes: 3 additions & 0 deletions web/src/components/Sidebar/_Sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ $row--size: calc(#{$row--height} - #{$sidebar-sections-padding});
fill: transparent;
}
}
img.sidebar-bottom-icon {
@include size(3rem);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Sidebar = ({
})}
>
<SidebarHub {...sidebarHubProps} />
{enabledPlugins.includes('announcement') ? (
{enabledPlugins.includes('announcements') ? (
<div className="sidebar-notifications m-3">
<div className="ml-3 my-3 sidebar-title">
{STRINGS['TRADE_TAB_POSTS'].toUpperCase()}
Expand Down
6 changes: 3 additions & 3 deletions web/src/config/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1408,9 +1408,9 @@ const nestedContent = {
STATUS_DESCRIPTION:
'You can check the status of your deposit by passing the transaction ID (hash) below.',
TRANSACTION_ID: 'Transaction ID (hash)',
SEARCH_SUCCESS: 'Transaction found!',
SEARCH_ERROR:
'Transaction not found. Please check the ID and try again. If your believe there is a problem please contact support.',
SEARCH_SUCCESS: 'Search complete', // new
ADDRESS_FIELD_LABEL: 'Paste your address', // new
CURRENCY_FIELD_LABEL: 'Select the currency', // new
},
CANCEL_ORDERS: {
HEADING: 'Cancel orders',
Expand Down
66 changes: 38 additions & 28 deletions web/src/containers/Admin/General/FooterConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { Modal } from 'antd';
import { message, Modal } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import _isEqual from 'lodash/isEqual';

Expand Down Expand Up @@ -322,35 +322,45 @@ class FooterConfig extends Component {
};

handleAddLink = (formProps) => {
const custom_fields = { ...this.state.custom_fields };
let currentField = custom_fields[this.state.currentSection];
let currentFieldContent = currentField.content || {};
let currentFieldHeader = currentField.header || {};
let currentContentFields = currentFieldContent.fields || {};
custom_fields[this.state.currentSection] = {
...currentField,
content: {
...currentFieldContent,
fields: {
...currentContentFields,
[formProps.link.toLowerCase()]: {
type: 'input',
label: formProps.link,
placeholder: 'http://',
isClosable: true,
closeCallback: () =>
this.handleRemoveLinks(
currentFieldHeader.fields,
formProps.link.toLowerCase()
),
let initialCustom = { ...this.state.initialCustom };
if (
formProps.link &&
Object.keys(initialCustom).includes(formProps.link.toLowerCase())
) {
message.warn('Link already exist');
} else {
const custom_fields = { ...this.state.custom_fields };
let currentField = custom_fields[this.state.currentSection];
let currentFieldContent = currentField.content || {};
let currentFieldHeader = currentField.header || {};
let currentContentFields = currentFieldContent.fields || {};
custom_fields[this.state.currentSection] = {
...currentField,
content: {
...currentFieldContent,
fields: {
...currentContentFields,
[formProps.link.toLowerCase()]: {
type: 'input',
label: formProps.link,
placeholder: 'http://',
isClosable: true,
closeCallback: () =>
this.handleRemoveLinks(
currentFieldHeader.fields,
formProps.link.toLowerCase()
),
},
},
},
},
};
this.setState({
custom_fields,
});
this.onCancel();
};
initialCustom[formProps.link.toLowerCase()] = '';
this.setState({
initialCustom,
custom_fields,
});
this.onCancel();
}
};

handleSubmitLinks = (formProps) => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/containers/Admin/MoveToDash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MoveToDash = () => {
/>
<div>
<a
href="https://dash.bitholla.com/"
href="https://dash.bitholla.com/financial"
target="_blank"
rel="noopener noreferrer"
>
Expand Down
6 changes: 5 additions & 1 deletion web/src/containers/App/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import classnames from 'classnames';
import EventListener from 'react-event-listener';
import { Helmet } from 'react-helmet';
Expand Down Expand Up @@ -699,7 +700,10 @@ class App extends Component {
)}
</div>
</div>
<SnackNotification />
{ReactDOM.createPortal(
<SnackNotification />,
document.getElementsByTagName('body')[0]
)}
<SnackDialog />
</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion web/src/containers/MobileHome/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Home extends Component {
} */}
<div className="post-wrapper mt-4 mx-3">
<div className="post-title mb-3">{STRINGS['TRADE_TAB_POSTS']}</div>
{enabledPlugins.includes('announcement') ? (
{enabledPlugins.includes('announcements') ? (
<NotificationsList />
) : null}
</div>
Expand Down
Loading

0 comments on commit 2d27002

Please sign in to comment.