Skip to content

Commit

Permalink
Merge pull request #506 from bitholla/2.0
Browse files Browse the repository at this point in the history
2.0
  • Loading branch information
abeikverdi authored Jan 28, 2021
2 parents 4308d0e + c3d4a5d commit 1639976
Show file tree
Hide file tree
Showing 32 changed files with 652 additions and 290 deletions.
2 changes: 1 addition & 1 deletion server/api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
version: "2.0.1"
version: "2.0.2"
title: HollaEx Kit
host: api.hollaex.com
basePath: /v2
Expand Down
2 changes: 1 addition & 1 deletion server/ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const watch = process.env.NODE_ENV === 'production' ? false : true;
const ignore_watch = ['logs', 'node_modules', 'tools', 'db/functions', 'db/triggers', 'storage'];
const ignore_watch = ['logs', 'node_modules', 'tools', 'db/functions', 'db/triggers', 'storage', 'package.json', 'package.json.*', 'package-lock.json', 'package-lock.json.*'];
const max_memory_restart = '4000M';
const node_args = ['--max_old_space_size=4096'];
const mode = process.env.DEPLOYMENT_MODE || 'all';
Expand Down
9 changes: 5 additions & 4 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.1",
"version": "2.0.2",
"private": false,
"description": "HollaEx Kit",
"keywords": [
Expand Down Expand Up @@ -34,7 +34,8 @@
"install": "0.10.4",
"json2csv": "4.5.4",
"jsonwebtoken": "7.4.3",
"lodash": "4.17.5",
"latest-version": "5.1.0",
"lodash": "4.17.20",
"mathjs": "3.20.2",
"moment": "2.21.0",
"moment-timezone": "0.5.28",
Expand All @@ -43,7 +44,7 @@
"node-cron": "2.0.3",
"nodemailer": "6.4.6",
"npm": "5.7.1",
"npmi": "4.0.0",
"npm-programmatic": "0.0.12",
"otp": "0.1.3",
"pg": "6.4.2",
"pg-hstore": "2.3.2",
Expand All @@ -56,7 +57,7 @@
"request-promise": "4.2.2",
"sequelize": "4.37.7",
"swagger-express-mw": "0.1.0",
"uglify-es": "^3.3.9",
"uglify-es": "3.3.9",
"uuid": "3.2.1",
"validator": "9.4.1",
"winston": "3.2.1",
Expand Down
78 changes: 57 additions & 21 deletions server/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,67 @@ const morgan = require('morgan');
const { logEntryRequest, stream, loggerPlugin } = require('./config/logger');
const { domainMiddleware, helmetMiddleware } = require('./config/middleware');
const morganType = process.env.NODE_ENV === 'development' ? 'dev' : 'combined';
const npmi = require('npmi');
const multer = require('multer');
const moment = require('moment');
const { checkStatus } = require('./init');
const UglifyJS = require('uglify-es');
const cors = require('cors');
const mathjs = require('mathjs');
const bluebird = require('bluebird');
const rp = require('request-promise');
const uuid = require('uuid/v4');
const fs = require('fs');
const path = require('path');
const latestVersion = require('latest-version');
const { resolve } = bluebird;
const npm = require('npm-programmatic');

const getInstalledLibrary = async (name, version) => {
const jsonFilePath = path.resolve(__dirname, './node_modules', name, 'package.json');

let fileData = fs.readFileSync(jsonFilePath);
fileData = JSON.parse(fileData);

loggerPlugin.verbose(`${name} library found`);
if (version === 'latest') {
const v = await latestVersion(name);
if (fileData.version === v) {
loggerPlugin.verbose(`${name} version ${version} found`);
const lib = require(name);
return resolve(lib);
} else {
throw new Error('Version does not match');
}
} else {
if (fileData.version === version) {
loggerPlugin.verbose(`${name} version ${version} found`);
const lib = require(name);
return resolve(lib);
} else {
throw new Error('Version does not match');
}
}
};

const installLibrary = (library) => {
return new Promise((resolve, reject) => {
npmi({
name: library,
npmLoad: {
save: false,
forceInstall: false,
loglevel: 'silent'
}
}, (err, result) => {
if (err) {
reject(err);
} else {
try {
const lib = require(library);
resolve(lib);
} catch (err) {
reject(err);
}
}
const [name, version = 'latest'] = library.split('@');
return getInstalledLibrary(name, version)
.then((data) => {
return data;
})
.catch((err) => {
loggerPlugin.verbose(`${name} version ${version} installing`);
return npm.install([`${name}@${version}`], {
cwd: path.resolve(__dirname, './'),
save: true,
output: true
});
})
.then(() => {
loggerPlugin.verbose(`${name} version ${version} installed`);
const lib = require(name);
return lib;
});
});
};

app.use(morgan(morganType, { stream }));
Expand Down Expand Up @@ -1008,6 +1040,10 @@ checkStatus()
loggerPlugin,
multer,
moment,
mathjs,
bluebird,
rp,
uuid,
meta: plugin.meta,
installedLibraries: {}
};
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.1
2.0.2
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hollaex-kit",
"version": "2.0.1",
"version": "2.0.2",
"private": true,
"dependencies": {
"@ant-design/compatible": "1.0.5",
Expand Down
4 changes: 3 additions & 1 deletion web/src/actions/appActions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { setLanguage as storeLanguageInBrowser } from '../utils/string';
import { hasTheme } from 'utils/theme';
import { DEFAULT_LANGUAGE, LANGUAGE_KEY } from '../config/constants';
import axios from 'axios';

Expand Down Expand Up @@ -267,8 +268,9 @@ export const getExchangeInfo = () => {
dispatch(setConfig(res.data));
if (res.data.defaults) {
const themeColor = localStorage.getItem('theme');
const isThemeValid = hasTheme(themeColor, res.data.color);
const language = localStorage.getItem(LANGUAGE_KEY);
if (!themeColor && res.data.defaults.theme) {
if (res.data.defaults.theme && (!themeColor || !isThemeValid)) {
dispatch(changeTheme(res.data.defaults.theme));
localStorage.setItem('theme', res.data.defaults.theme);
}
Expand Down
56 changes: 56 additions & 0 deletions web/src/actions/walletActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export const ACTION_KEYS = {
USER_TRADES_PENDING: 'USER_TRADES_PENDING',
USER_TRADES_FULFILLED: 'USER_TRADES_FULFILLED',
USER_TRADES_REJECTED: 'USER_TRADES_REJECTED',
ORDER_HISTORY_PENDING: 'ORDER_HISTORY_PENDING',
ORDER_HISTORY_FULFILLED: 'ORDER_HISTORY_FULFILLED',
ORDER_HISTORY_REJECTED: 'ORDER_HISTORY_REJECTED',
USER_DEPOSITS_PENDING: 'USER_DEPOSITS_PENDING',
USER_DEPOSITS_FULFILLED: 'USER_DEPOSITS_FULFILLED',
USER_DEPOSITS_REJECTED: 'USER_DEPOSITS_REJECTED',
Expand Down Expand Up @@ -178,6 +181,59 @@ export const getUserOrders = ({
};
};

export const getOrdersHistory = ({
symbol,
limit = 50,
page = 1,
start_date,
end_date,
open,
...rest
}) => {
let dataParams = { page, limit };
if (symbol) {
dataParams.symbol = symbol;
}

if (start_date) {
dataParams.start_date = start_date;
}

if (end_date) {
dataParams.end_date = end_date;
}

if (open !== undefined) {
dataParams.open = open;
}
const query = querystring.stringify(dataParams);

return (dispatch) => {
dispatch({ type: ACTION_KEYS.ORDER_HISTORY_PENDING, payload: { page } });
axios
.get(`${ENDPOINTS.TRADES}?${query}`)
.then((body) => {
dispatch({
type: ACTION_KEYS.ORDER_HISTORY_FULFILLED,
payload: {
...body.data,
page,
isRemaining: body.data.count > page * limit,
},
});
// if (body.data.count > page * limit) {
// dispatch(getUserTrades({ symbol, limit, page: page + 1 }));
// }
})
.catch((err) => {
dispatch({
type: ACTION_KEYS.ORDER_HISTORY_REJECTED,
payload: err.response,
});
});
};
};

export const downloadUserTrades = (key) => {
const query = querystring.stringify({
format: 'csv',
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/ConfigProvider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ConfigProvider extends Component {
<ProjectConfig.Provider
value={{
defaults,
icons: icons[activeTheme],
icons: icons[activeTheme] || {},
allIcons: icons,
color,
themeOptions,
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Form/TradeFormFields/Clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Clear = (props) => {
const { onClick } = props;

return (
<div className="d-flex justify-content-end">
<div className="d-flex justify-content-end mb-0">
<span className="pointer text-uppercase blue-link" onClick={onClick}>
{STRINGS['CLEAR']}
</span>
Expand Down
2 changes: 1 addition & 1 deletion web/src/config/colors/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const options = { safe: true, delimiter: '_' };
export const nestedColors = {
base: {
background: '#f8f8f8',
'top-bar-navigation': '#f3f3f3',
'top-bar-navigation': '#000000',
'secondary-navigation-bar': '#e9e9e9',
'wallet-sidebar-and-popup': '#f8f8f8',
footer: '#000000',
Expand Down
5 changes: 3 additions & 2 deletions web/src/containers/App/Socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
requestInitial,
requestConstant,
} from '../../actions/appActions';

import { hasTheme } from 'utils/theme';
import { playBackgroundAudioNotification } from '../../utils/utils';
import { getToken, isLoggedIn } from '../../utils/token';

Expand Down Expand Up @@ -139,8 +139,9 @@ class Container extends Component {
this.props.setConfig(res.data);
if (res.data.defaults) {
const themeColor = localStorage.getItem('theme');
const isThemeValid = hasTheme(themeColor, res.data.color);
const language = localStorage.getItem(LANGUAGE_KEY);
if (!themeColor && res.data.defaults.theme) {
if (res.data.defaults.theme && (!themeColor || !isThemeValid)) {
this.props.changeTheme(res.data.defaults.theme);
localStorage.setItem('theme', res.data.defaults.theme);
}
Expand Down
16 changes: 16 additions & 0 deletions web/src/containers/OperatorControls/_OperatorControls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ $operator-controls__panel-border-color: #a7a7a7;
}
}

&.add-theme {
.ReactModal__Content {
width: 532px !important;
}
}

.ReactModal__Overlay {
position: fixed;
z-index: 10001 !important;
Expand Down Expand Up @@ -296,3 +302,13 @@ $operator-controls__panel-border-color: #a7a7a7;
border: none !important;
}
}

.operator-button_underline {
&.ant-btn > span {
text-decoration: underline;
}
&.ant-btn-link {
padding: 4px 8px;
color: white;
}
}
Loading

0 comments on commit 1639976

Please sign in to comment.