Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"sass-loader": "^13.3.2",
"sha1": "^1.1.1",
"style-loader": "^3.3.3",
"trackjs": "^3.10.1",
"trackjs": "^3.10.4",
"webpack": "^5.88.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
Expand All @@ -117,8 +117,7 @@
"commander": "^8.3.0",
"core-js": "^3.18",
"crc-32": "^1.2.0",
"js-cookie": "^3.0.1",
"jwt-decode": "^3.1.2",
"js-cookie": "^3.0.5",
"mobx": "^6.3.12",
"mobx-react": "^7.2.1",
"pako": "^1.0.11",
Expand Down
6 changes: 4 additions & 2 deletions plugins/fetch-blockly-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ const axios = require('axios');
// eslint-disable-next-line no-console
console.log(outputFile, 'output file');
await fs.writeFile(outputFile, mergedContent, 'utf8', err => {
// eslint-disable-next-line no-console
console.log(err, 'Error fetching blockly');
if (err) {
// eslint-disable-next-line no-console
console.log(err, 'Error fetching blockly');
}
});
})()
.then(() => {
Expand Down
14 changes: 13 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
top.location = self.location;
}
</script>
<script>
window.addEventListener('unhandledrejection', function (event) {
console.log(
'Unhandled rejection (promise: ',
event.promise,
', reason: ',
event.reason,
').',
JSON.stringify(event.promise)
);
});
</script>
</head>

<body>
Expand All @@ -55,7 +67,7 @@
<div class="rect5"></div>
</div>

<div id="main"></div>
<div id="binary-bot"></div>

<form id="fileUploadForm" style="display: none">
<input
Expand Down
4 changes: 2 additions & 2 deletions src/api-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class APIBase {

this.api.onOpen().subscribe(() => {
// eslint-disable-next-line no-console
console.log('Connection has been established!', this.api);
console.log('Connection has been established!');
});
} catch (error) {
globalObserver.emit('Error', error);
Expand Down Expand Up @@ -155,7 +155,7 @@ class APIBase {

this.api_chart.onOpen().subscribe(() => {
// eslint-disable-next-line no-console
console.log('Connection has been established for chart ws!', this.api_chart);
console.log('Connection has been established for chart ws!');
});
} catch (error) {
globalObserver.emit('Error', error);
Expand Down
45 changes: 30 additions & 15 deletions src/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import GTM from '@utilities/integrations/gtm';
import { useSelector, useDispatch } from 'react-redux';
import { api_base } from '@api-base';
import { observer as globalObserver } from '@utilities/observer';
import { isProduction } from '@utils';
import initLogHandler from '@utilities/logger';
import { getActiveLoginId } from '@storage';
import trackjs_config from '../botPage/view/trackJs_config';
import Routes from '../routes';
import ActiveSymbols from '../botPage/common/symbolApi/activeSymbols';
Expand All @@ -13,19 +16,21 @@ import { setActiveSymbols } from '../redux-store/client-slice';
const App = () => {
const dispatch = useDispatch();
const has_active_symbols = useSelector(state => state.client.active_symbols);
const has_logged_in = useSelector(state => state.client.is_logged);
const is_logged_in = useSelector(state => state.client.is_logged);

const initActiveSymbols = data => {
symbolPromise.then(() => {
try {
/* eslint-disable no-new */
new ActiveSymbols(data.active_symbols);
} catch (error) {
globalObserver.emit('Error', error);
}
dispatch(setActiveSymbols(data));
});
};
React.useEffect(() => {
if (isProduction()) {
TrackJS.install(trackjs_config);
GTM.init();
}
}, []);

React.useEffect(() => {
if (isProduction()) {
const user_id = getActiveLoginId();
initLogHandler(user_id);
}
}, [initLogHandler]);

React.useEffect(() => {
api_base.api.expectResponse('authorize').then(() =>
Expand All @@ -37,7 +42,7 @@ const App = () => {
/* This code is used to monitor active_symbols when the user is not logged in and
will initialize the app without requiring an authorization response. */
const listenToActiveSymbols = data => {
if (!has_logged_in && data.msg_type === 'active_symbols') {
if (!is_logged_in && data.msg_type === 'active_symbols') {
initActiveSymbols(data);
}
};
Expand All @@ -49,8 +54,18 @@ const App = () => {
};
}, []);

TrackJS.install(trackjs_config);
GTM.init();
const initActiveSymbols = data => {
symbolPromise.then(() => {
try {
/* eslint-disable no-new */
new ActiveSymbols(data.active_symbols);
} catch (error) {
globalObserver.emit('Error', error);
}
dispatch(setActiveSymbols(data));
});
};

$.ajaxSetup({
cache: false,
});
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/after_purchase/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#i7qkfj
import { translate } from '@i18n';
import './check_result';
import './read_details';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/after_purchase/read_details.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#u8i287
import { translate } from '@i18n';
import config from '@currency-config';
import { insideAfterPurchase } from '../../relationChecker';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/after_purchase/trade_again.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#xkasg4
import { translate } from '@i18n';
import { insideAfterPurchase } from '../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/before_purchase/ask_price.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#pbvgpo
import { translate } from '@i18n';
import { insideBeforePurchase } from '../../relationChecker';
import { getPurchaseChoices } from '../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/before_purchase/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#u7tjez
import { translate } from '@i18n';
import './purchase';
import './ask_price';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/before_purchase/payout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#pbvgpo
import { translate } from '@i18n';
import { insideBeforePurchase } from '../../relationChecker';
import { getPurchaseChoices } from '../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/before_purchase/purchase.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#pbvgpo
import { translate } from '@i18n';
import { insideBeforePurchase } from '../../relationChecker';
import { getPurchaseChoices } from '../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/during_purchase/check_sell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import { insideDuringPurchase } from '../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/during_purchase/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#qx2zox
import { translate } from '@i18n';
import './sell_at_market';
import './check_sell';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/during_purchase/sell_at_market.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#pbvgpo
import { translate } from '@i18n';
import { insideDuringPurchase } from '../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/bb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import config from '@currency-config';
import { expectValue } from '../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/bba.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import config from '@currency-config';
import { expectValue } from '../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/ema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import { expectValue } from '../shared';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/emaa.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import { expectValue } from '../shared';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/macda.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import config from '@currency-config';
import { expectValue } from '../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/rsi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import { expectValue } from '../shared';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/rsia.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import { expectValue } from '../shared';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/sma.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import { expectValue } from '../shared';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/indicators/smaa.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3qghes
import { translate } from '@i18n';
import { expectValue } from '../shared';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/direction.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#n3drko
import { translate } from '@i18n';
import { disable } from '../../utils';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/get_ohlc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#szwuog
import { translate } from '@i18n';
import { mainScope } from '../../relationChecker';
import candleInterval, { getGranularity } from './candleInterval';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/lastDigitList.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import { mainScope } from '../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/last_digit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import { mainScope } from '../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/ohlc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import { mainScope } from '../../relationChecker';
import candleInterval, { getGranularity } from './candleInterval';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/ohlc_values.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import config from '@currency-config';
import { mainScope } from '../../relationChecker';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/readOhlc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#szwuog
import { translate } from '@i18n';
import config from '@currency-config';
import { mainScope } from '../../relationChecker';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/tick.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import { mainScope } from '../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/tick_analysis.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#i7qkfj
import { translate } from '@i18n';

Blockly.Blocks.tick_analysis = {
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/ticks/ticks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import { mainScope } from '../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/balance.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#kqvz7z
import { translate } from '@i18n';
import config from '@currency-config';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/block_holder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#i7qkfj
import { translate } from '@i18n';

Blockly.Blocks.block_holder = {
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/candle/is_candle_black.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#szwuog
import { translate } from '@i18n';
import { expectValue } from '../../shared';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/candle/ohlc_values_in_list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#2jo335
import { translate } from '@i18n';
import config from '@currency-config';
import { expectValue } from '../../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/candle/read_ohlc_obj.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#szwuog
import { translate } from '@i18n';
import config from '@currency-config';
import { expectValue } from '../../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#tkcvmb
import { translate } from '@i18n';
import { observer as globalObserver } from '@utilities/observer';
import { deleteBlocksLoadedBy, loadRemote, recoverDeletedBlock } from '../../utils';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/notify.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#pmhydb
import { translate } from '@i18n';
import config from '@currency-config';
import { expectValue } from '../shared';
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/time/epoch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3bwqd4
import { translate } from '@i18n';

Blockly.Blocks.epoch = {
Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/time/interval.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#wupwb4
import { translate } from '@i18n';
import { disable } from '../../../utils';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/time/timeout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#wupwb4
import { translate } from '@i18n';
import { mainScope } from '../../../relationChecker';

Expand Down
1 change: 0 additions & 1 deletion src/blockly/blocks/tools/total_profit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#3bwqd4
import { translate } from '@i18n';

Blockly.Blocks.total_profit = {
Expand Down
Loading